mirror of
https://github.com/complexcaresolutions/cms.c2sgmbh.git
synced 2026-03-17 17:24:12 +00:00
fix(Locations): add missing locations_hours_structured table
The Locations collection has an array field for structured opening hours that requires a separate table. This was missing and caused the admin panel to fail when accessing the Locations collection. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
6692af575e
commit
5a60d94cf9
2 changed files with 41 additions and 0 deletions
|
|
@ -0,0 +1,35 @@
|
||||||
|
import { MigrateUpArgs, MigrateDownArgs, sql } from '@payloadcms/db-postgres'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Migration: Add missing locations_hours_structured table
|
||||||
|
*
|
||||||
|
* The Locations collection has an array field for structured opening hours
|
||||||
|
* that requires this table to store the nested data.
|
||||||
|
*/
|
||||||
|
export async function up({ db, payload, req }: MigrateUpArgs): Promise<void> {
|
||||||
|
await db.execute(sql`
|
||||||
|
CREATE TABLE IF NOT EXISTS "locations_hours_structured" (
|
||||||
|
"id" serial PRIMARY KEY NOT NULL,
|
||||||
|
"_order" integer NOT NULL,
|
||||||
|
"_parent_id" integer NOT NULL REFERENCES locations(id) ON DELETE CASCADE,
|
||||||
|
"day" varchar,
|
||||||
|
"closed" boolean DEFAULT false,
|
||||||
|
"open" varchar,
|
||||||
|
"close" varchar,
|
||||||
|
"break_has_break" boolean DEFAULT false,
|
||||||
|
"break_start" varchar,
|
||||||
|
"break_end" varchar
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE INDEX IF NOT EXISTS "locations_hours_structured_order_idx"
|
||||||
|
ON "locations_hours_structured" USING btree ("_order");
|
||||||
|
CREATE INDEX IF NOT EXISTS "locations_hours_structured_parent_idx"
|
||||||
|
ON "locations_hours_structured" USING btree ("_parent_id");
|
||||||
|
`)
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function down({ db, payload, req }: MigrateDownArgs): Promise<void> {
|
||||||
|
await db.execute(sql`
|
||||||
|
DROP TABLE IF EXISTS "locations_hours_structured";
|
||||||
|
`)
|
||||||
|
}
|
||||||
|
|
@ -26,6 +26,7 @@ import * as migration_20260108_230500_add_pages_blocks_missing from './20260108_
|
||||||
import * as migration_20260108_231200_add_video_embed_block_tables from './20260108_231200_add_video_embed_block_tables';
|
import * as migration_20260108_231200_add_video_embed_block_tables from './20260108_231200_add_video_embed_block_tables';
|
||||||
import * as migration_20260108_231400_add_pages_rels_missing_columns from './20260108_231400_add_pages_rels_missing_columns';
|
import * as migration_20260108_231400_add_pages_rels_missing_columns from './20260108_231400_add_pages_rels_missing_columns';
|
||||||
import * as migration_20260109_020000_add_blogwoman_collections from './20260109_020000_add_blogwoman_collections';
|
import * as migration_20260109_020000_add_blogwoman_collections from './20260109_020000_add_blogwoman_collections';
|
||||||
|
import * as migration_20260109_023000_add_locations_hours_structured from './20260109_023000_add_locations_hours_structured';
|
||||||
|
|
||||||
export const migrations = [
|
export const migrations = [
|
||||||
{
|
{
|
||||||
|
|
@ -168,4 +169,9 @@ export const migrations = [
|
||||||
down: migration_20260109_020000_add_blogwoman_collections.down,
|
down: migration_20260109_020000_add_blogwoman_collections.down,
|
||||||
name: '20260109_020000_add_blogwoman_collections'
|
name: '20260109_020000_add_blogwoman_collections'
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
up: migration_20260109_023000_add_locations_hours_structured.up,
|
||||||
|
down: migration_20260109_023000_add_locations_hours_structured.down,
|
||||||
|
name: '20260109_023000_add_locations_hours_structured'
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue