mirror of
https://github.com/complexcaresolutions/cms.c2sgmbh.git
synced 2026-03-17 20:54:11 +00:00
fix(BlogWoman): resolve RSC error by adding system table columns
Root cause: payload_locked_documents_rels table was missing columns for new collections, causing "column does not exist" errors during the dashboard query after login. Changes: - Enable Favorites and Series collections in payload.config.ts - Enable all BlogWoman blocks (FavoritesBlock, SeriesBlock, etc.) - Add migration with proper system table updates: - favorites_id column in payload_locked_documents_rels - series_id column in payload_locked_documents_rels - Include related migrations for Pages blocks and VideoEmbed Key insight: When adding new collections, the migration must also update payload_locked_documents_rels with a reference column. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
ba1fc6eb00
commit
6692af575e
8 changed files with 3966 additions and 4 deletions
|
|
@ -48,7 +48,7 @@ export { ComparisonBlock } from './ComparisonBlock'
|
||||||
// Tenant-specific Blocks
|
// Tenant-specific Blocks
|
||||||
export { BeforeAfterBlock } from './BeforeAfterBlock'
|
export { BeforeAfterBlock } from './BeforeAfterBlock'
|
||||||
|
|
||||||
// BlogWoman Blocks
|
// BlogWoman Blocks - ENABLED
|
||||||
export { FavoritesBlock } from './FavoritesBlock'
|
export { FavoritesBlock } from './FavoritesBlock'
|
||||||
export { SeriesBlock } from './SeriesBlock'
|
export { SeriesBlock } from './SeriesBlock'
|
||||||
export { SeriesDetailBlock } from './SeriesDetailBlock'
|
export { SeriesDetailBlock } from './SeriesDetailBlock'
|
||||||
|
|
|
||||||
38
src/migrations/20260108_170000_site_settings_address_geo.ts
Normal file
38
src/migrations/20260108_170000_site_settings_address_geo.ts
Normal file
|
|
@ -0,0 +1,38 @@
|
||||||
|
import { MigrateUpArgs, MigrateDownArgs, sql } from '@payloadcms/db-postgres'
|
||||||
|
|
||||||
|
export async function up({ db, payload, req }: MigrateUpArgs): Promise<void> {
|
||||||
|
// Add new address fields (structured) and geo coordinates to site_settings
|
||||||
|
await db.execute(sql`
|
||||||
|
-- Add contact_fax field
|
||||||
|
ALTER TABLE "site_settings" ADD COLUMN IF NOT EXISTS "contact_fax" varchar;
|
||||||
|
|
||||||
|
-- Add structured address fields
|
||||||
|
ALTER TABLE "site_settings" ADD COLUMN IF NOT EXISTS "address_street" varchar;
|
||||||
|
ALTER TABLE "site_settings" ADD COLUMN IF NOT EXISTS "address_additional_line" varchar;
|
||||||
|
ALTER TABLE "site_settings" ADD COLUMN IF NOT EXISTS "address_zip" varchar;
|
||||||
|
ALTER TABLE "site_settings" ADD COLUMN IF NOT EXISTS "address_city" varchar;
|
||||||
|
ALTER TABLE "site_settings" ADD COLUMN IF NOT EXISTS "address_state" varchar;
|
||||||
|
ALTER TABLE "site_settings" ADD COLUMN IF NOT EXISTS "address_country" varchar DEFAULT 'Deutschland';
|
||||||
|
|
||||||
|
-- Add geo coordinates fields
|
||||||
|
ALTER TABLE "site_settings" ADD COLUMN IF NOT EXISTS "geo_lat" numeric;
|
||||||
|
ALTER TABLE "site_settings" ADD COLUMN IF NOT EXISTS "geo_lng" numeric;
|
||||||
|
ALTER TABLE "site_settings" ADD COLUMN IF NOT EXISTS "geo_zoom" numeric DEFAULT 15;
|
||||||
|
`)
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function down({ db, payload, req }: MigrateDownArgs): Promise<void> {
|
||||||
|
// Remove the new columns
|
||||||
|
await db.execute(sql`
|
||||||
|
ALTER TABLE "site_settings" DROP COLUMN IF EXISTS "contact_fax";
|
||||||
|
ALTER TABLE "site_settings" DROP COLUMN IF EXISTS "address_street";
|
||||||
|
ALTER TABLE "site_settings" DROP COLUMN IF EXISTS "address_additional_line";
|
||||||
|
ALTER TABLE "site_settings" DROP COLUMN IF EXISTS "address_zip";
|
||||||
|
ALTER TABLE "site_settings" DROP COLUMN IF EXISTS "address_city";
|
||||||
|
ALTER TABLE "site_settings" DROP COLUMN IF EXISTS "address_state";
|
||||||
|
ALTER TABLE "site_settings" DROP COLUMN IF EXISTS "address_country";
|
||||||
|
ALTER TABLE "site_settings" DROP COLUMN IF EXISTS "geo_lat";
|
||||||
|
ALTER TABLE "site_settings" DROP COLUMN IF EXISTS "geo_lng";
|
||||||
|
ALTER TABLE "site_settings" DROP COLUMN IF EXISTS "geo_zoom";
|
||||||
|
`)
|
||||||
|
}
|
||||||
3576
src/migrations/20260108_230500_add_pages_blocks_missing.ts
Normal file
3576
src/migrations/20260108_230500_add_pages_blocks_missing.ts
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,96 @@
|
||||||
|
import { MigrateUpArgs, MigrateDownArgs, sql } from '@payloadcms/db-postgres'
|
||||||
|
|
||||||
|
export async function up({ db, payload, req }: MigrateUpArgs): Promise<void> {
|
||||||
|
await db.execute(sql`
|
||||||
|
DO $$ BEGIN
|
||||||
|
CREATE TYPE "public"."enum_pages_blocks_video_embed_block_video_source" AS ENUM('youtube', 'vimeo', 'custom');
|
||||||
|
EXCEPTION
|
||||||
|
WHEN duplicate_object THEN null;
|
||||||
|
END $$;
|
||||||
|
|
||||||
|
DO $$ BEGIN
|
||||||
|
CREATE TYPE "public"."enum_pages_blocks_video_embed_block_aspect_ratio" AS ENUM('16:9', '4:3', '1:1', '9:16');
|
||||||
|
EXCEPTION
|
||||||
|
WHEN duplicate_object THEN null;
|
||||||
|
END $$;
|
||||||
|
|
||||||
|
DO $$ BEGIN
|
||||||
|
CREATE TYPE "public"."enum_pages_blocks_video_embed_block_max_width" AS ENUM('full', 'large', 'medium', 'small');
|
||||||
|
EXCEPTION
|
||||||
|
WHEN duplicate_object THEN null;
|
||||||
|
END $$;
|
||||||
|
|
||||||
|
DO $$ BEGIN
|
||||||
|
CREATE TYPE "public"."enum_pages_blocks_video_embed_block_style_alignment" AS ENUM('left', 'center', 'right');
|
||||||
|
EXCEPTION
|
||||||
|
WHEN duplicate_object THEN null;
|
||||||
|
END $$;
|
||||||
|
|
||||||
|
DO $$ BEGIN
|
||||||
|
CREATE TYPE "public"."enum_pages_blocks_video_embed_block_style_border_radius" AS ENUM('none', 'sm', 'md', 'lg');
|
||||||
|
EXCEPTION
|
||||||
|
WHEN duplicate_object THEN null;
|
||||||
|
END $$;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS "pages_blocks_video_embed_block" (
|
||||||
|
"_order" integer NOT NULL,
|
||||||
|
"_parent_id" integer NOT NULL,
|
||||||
|
"_path" text NOT NULL,
|
||||||
|
"id" varchar PRIMARY KEY NOT NULL,
|
||||||
|
"video_source" "enum_pages_blocks_video_embed_block_video_source" DEFAULT 'youtube' NOT NULL,
|
||||||
|
"youtube_url" varchar,
|
||||||
|
"vimeo_url" varchar,
|
||||||
|
"custom_url" varchar,
|
||||||
|
"thumbnail_id" integer,
|
||||||
|
"privacy_mode" boolean DEFAULT true,
|
||||||
|
"lazy_load" boolean DEFAULT true,
|
||||||
|
"aspect_ratio" "enum_pages_blocks_video_embed_block_aspect_ratio" DEFAULT '16:9',
|
||||||
|
"max_width" "enum_pages_blocks_video_embed_block_max_width" DEFAULT 'large',
|
||||||
|
"playback_options_autoplay" boolean DEFAULT false,
|
||||||
|
"playback_options_muted" boolean DEFAULT false,
|
||||||
|
"playback_options_loop" boolean DEFAULT false,
|
||||||
|
"playback_options_show_controls" boolean DEFAULT true,
|
||||||
|
"playback_options_start_time" numeric,
|
||||||
|
"style_alignment" "enum_pages_blocks_video_embed_block_style_alignment" DEFAULT 'center',
|
||||||
|
"style_border_radius" "enum_pages_blocks_video_embed_block_style_border_radius" DEFAULT 'md',
|
||||||
|
"style_shadow" boolean DEFAULT true,
|
||||||
|
"block_name" varchar
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS "pages_blocks_video_embed_block_locales" (
|
||||||
|
"title" varchar,
|
||||||
|
"caption" varchar,
|
||||||
|
"id" serial PRIMARY KEY NOT NULL,
|
||||||
|
"_locale" "_locales" NOT NULL,
|
||||||
|
"_parent_id" varchar NOT NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
DO $$ BEGIN
|
||||||
|
ALTER TABLE "pages_blocks_video_embed_block" ADD CONSTRAINT "pages_blocks_video_embed_block_thumbnail_id_media_id_fk" FOREIGN KEY ("thumbnail_id") REFERENCES "public"."media"("id") ON DELETE set null ON UPDATE no action;
|
||||||
|
EXCEPTION
|
||||||
|
WHEN duplicate_object THEN null;
|
||||||
|
END $$;
|
||||||
|
|
||||||
|
DO $$ BEGIN
|
||||||
|
ALTER TABLE "pages_blocks_video_embed_block" ADD CONSTRAINT "pages_blocks_video_embed_block_parent_id_fk" FOREIGN KEY ("_parent_id") REFERENCES "public"."pages"("id") ON DELETE cascade ON UPDATE no action;
|
||||||
|
EXCEPTION
|
||||||
|
WHEN duplicate_object THEN null;
|
||||||
|
END $$;
|
||||||
|
|
||||||
|
DO $$ BEGIN
|
||||||
|
ALTER TABLE "pages_blocks_video_embed_block_locales" ADD CONSTRAINT "pages_blocks_video_embed_block_locales_parent_id_fk" FOREIGN KEY ("_parent_id") REFERENCES "public"."pages_blocks_video_embed_block"("id") ON DELETE cascade ON UPDATE no action;
|
||||||
|
EXCEPTION
|
||||||
|
WHEN duplicate_object THEN null;
|
||||||
|
END $$;
|
||||||
|
|
||||||
|
CREATE INDEX IF NOT EXISTS "pages_blocks_video_embed_block_order_idx" ON "pages_blocks_video_embed_block" USING btree ("_order");
|
||||||
|
CREATE INDEX IF NOT EXISTS "pages_blocks_video_embed_block_parent_id_idx" ON "pages_blocks_video_embed_block" USING btree ("_parent_id");
|
||||||
|
CREATE INDEX IF NOT EXISTS "pages_blocks_video_embed_block_path_idx" ON "pages_blocks_video_embed_block" USING btree ("_path");
|
||||||
|
CREATE INDEX IF NOT EXISTS "pages_blocks_video_embed_block_thumbnail_idx" ON "pages_blocks_video_embed_block" USING btree ("thumbnail_id");
|
||||||
|
CREATE UNIQUE INDEX IF NOT EXISTS "pages_blocks_video_embed_block_locales_locale_parent_id_uniq" ON "pages_blocks_video_embed_block_locales" USING btree ("_locale","_parent_id");
|
||||||
|
`)
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function down({ db, payload, req }: MigrateDownArgs): Promise<void> {
|
||||||
|
// No-op: data-preserving migration for the video embed block tables.
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,67 @@
|
||||||
|
import { MigrateUpArgs, MigrateDownArgs, sql } from '@payloadcms/db-postgres'
|
||||||
|
|
||||||
|
export async function up({ db, payload, req }: MigrateUpArgs): Promise<void> {
|
||||||
|
await db.execute(sql`
|
||||||
|
ALTER TABLE "pages_rels" ADD COLUMN IF NOT EXISTS "authors_id" integer;
|
||||||
|
ALTER TABLE "pages_rels" ADD COLUMN IF NOT EXISTS "posts_id" integer;
|
||||||
|
ALTER TABLE "pages_rels" ADD COLUMN IF NOT EXISTS "locations_id" integer;
|
||||||
|
ALTER TABLE "pages_rels" ADD COLUMN IF NOT EXISTS "partners_id" integer;
|
||||||
|
ALTER TABLE "pages_rels" ADD COLUMN IF NOT EXISTS "jobs_id" integer;
|
||||||
|
ALTER TABLE "pages_rels" ADD COLUMN IF NOT EXISTS "downloads_id" integer;
|
||||||
|
ALTER TABLE "pages_rels" ADD COLUMN IF NOT EXISTS "events_id" integer;
|
||||||
|
|
||||||
|
DO $$ BEGIN
|
||||||
|
ALTER TABLE "pages_rels" ADD CONSTRAINT "pages_rels_authors_fk" FOREIGN KEY ("authors_id") REFERENCES "public"."authors"("id") ON DELETE cascade ON UPDATE no action;
|
||||||
|
EXCEPTION
|
||||||
|
WHEN duplicate_object THEN null;
|
||||||
|
END $$;
|
||||||
|
|
||||||
|
DO $$ BEGIN
|
||||||
|
ALTER TABLE "pages_rels" ADD CONSTRAINT "pages_rels_posts_fk" FOREIGN KEY ("posts_id") REFERENCES "public"."posts"("id") ON DELETE cascade ON UPDATE no action;
|
||||||
|
EXCEPTION
|
||||||
|
WHEN duplicate_object THEN null;
|
||||||
|
END $$;
|
||||||
|
|
||||||
|
DO $$ BEGIN
|
||||||
|
ALTER TABLE "pages_rels" ADD CONSTRAINT "pages_rels_locations_fk" FOREIGN KEY ("locations_id") REFERENCES "public"."locations"("id") ON DELETE cascade ON UPDATE no action;
|
||||||
|
EXCEPTION
|
||||||
|
WHEN duplicate_object THEN null;
|
||||||
|
END $$;
|
||||||
|
|
||||||
|
DO $$ BEGIN
|
||||||
|
ALTER TABLE "pages_rels" ADD CONSTRAINT "pages_rels_partners_fk" FOREIGN KEY ("partners_id") REFERENCES "public"."partners"("id") ON DELETE cascade ON UPDATE no action;
|
||||||
|
EXCEPTION
|
||||||
|
WHEN duplicate_object THEN null;
|
||||||
|
END $$;
|
||||||
|
|
||||||
|
DO $$ BEGIN
|
||||||
|
ALTER TABLE "pages_rels" ADD CONSTRAINT "pages_rels_jobs_fk" FOREIGN KEY ("jobs_id") REFERENCES "public"."jobs"("id") ON DELETE cascade ON UPDATE no action;
|
||||||
|
EXCEPTION
|
||||||
|
WHEN duplicate_object THEN null;
|
||||||
|
END $$;
|
||||||
|
|
||||||
|
DO $$ BEGIN
|
||||||
|
ALTER TABLE "pages_rels" ADD CONSTRAINT "pages_rels_downloads_fk" FOREIGN KEY ("downloads_id") REFERENCES "public"."downloads"("id") ON DELETE cascade ON UPDATE no action;
|
||||||
|
EXCEPTION
|
||||||
|
WHEN duplicate_object THEN null;
|
||||||
|
END $$;
|
||||||
|
|
||||||
|
DO $$ BEGIN
|
||||||
|
ALTER TABLE "pages_rels" ADD CONSTRAINT "pages_rels_events_fk" FOREIGN KEY ("events_id") REFERENCES "public"."events"("id") ON DELETE cascade ON UPDATE no action;
|
||||||
|
EXCEPTION
|
||||||
|
WHEN duplicate_object THEN null;
|
||||||
|
END $$;
|
||||||
|
|
||||||
|
CREATE INDEX IF NOT EXISTS "pages_rels_authors_id_idx" ON "pages_rels" USING btree ("authors_id");
|
||||||
|
CREATE INDEX IF NOT EXISTS "pages_rels_posts_id_idx" ON "pages_rels" USING btree ("posts_id");
|
||||||
|
CREATE INDEX IF NOT EXISTS "pages_rels_locations_id_idx" ON "pages_rels" USING btree ("locations_id");
|
||||||
|
CREATE INDEX IF NOT EXISTS "pages_rels_partners_id_idx" ON "pages_rels" USING btree ("partners_id");
|
||||||
|
CREATE INDEX IF NOT EXISTS "pages_rels_jobs_id_idx" ON "pages_rels" USING btree ("jobs_id");
|
||||||
|
CREATE INDEX IF NOT EXISTS "pages_rels_downloads_id_idx" ON "pages_rels" USING btree ("downloads_id");
|
||||||
|
CREATE INDEX IF NOT EXISTS "pages_rels_events_id_idx" ON "pages_rels" USING btree ("events_id");
|
||||||
|
`)
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function down({ db, payload, req }: MigrateDownArgs): Promise<void> {
|
||||||
|
// No-op: data-preserving migration for pages_rels columns.
|
||||||
|
}
|
||||||
148
src/migrations/20260109_020000_add_blogwoman_collections.ts
Normal file
148
src/migrations/20260109_020000_add_blogwoman_collections.ts
Normal file
|
|
@ -0,0 +1,148 @@
|
||||||
|
import { MigrateUpArgs, MigrateDownArgs, sql } from '@payloadcms/db-postgres'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Migration: Add BlogWoman Collections (Favorites, Series)
|
||||||
|
*
|
||||||
|
* This migration creates:
|
||||||
|
* - favorites table with _rels table for multi-tenant support
|
||||||
|
* - series table with _locales and _rels tables
|
||||||
|
* - Adds columns to payload_locked_documents_rels for both collections
|
||||||
|
*/
|
||||||
|
export async function up({ db, payload, req }: MigrateUpArgs): Promise<void> {
|
||||||
|
await db.execute(sql`
|
||||||
|
-- =====================================================
|
||||||
|
-- FAVORITES COLLECTION
|
||||||
|
-- =====================================================
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS "favorites" (
|
||||||
|
"id" serial PRIMARY KEY NOT NULL,
|
||||||
|
"title" varchar NOT NULL,
|
||||||
|
"slug" varchar NOT NULL,
|
||||||
|
"description" varchar,
|
||||||
|
"category" varchar NOT NULL,
|
||||||
|
"subcategory" varchar,
|
||||||
|
"price" numeric,
|
||||||
|
"price_range" varchar,
|
||||||
|
"affiliate_url" varchar NOT NULL,
|
||||||
|
"affiliate_network" varchar,
|
||||||
|
"image_id" integer REFERENCES media(id) ON DELETE SET NULL,
|
||||||
|
"badge" varchar,
|
||||||
|
"featured" boolean DEFAULT false,
|
||||||
|
"is_active" boolean DEFAULT true NOT NULL,
|
||||||
|
"order" numeric DEFAULT 0,
|
||||||
|
"updated_at" timestamp(3) with time zone DEFAULT now() NOT NULL,
|
||||||
|
"created_at" timestamp(3) with time zone DEFAULT now() NOT NULL,
|
||||||
|
CONSTRAINT "favorites_slug_unique" UNIQUE("slug")
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS "favorites_rels" (
|
||||||
|
"id" serial PRIMARY KEY NOT NULL,
|
||||||
|
"order" integer,
|
||||||
|
"parent_id" integer NOT NULL REFERENCES favorites(id) ON DELETE CASCADE,
|
||||||
|
"path" varchar NOT NULL,
|
||||||
|
"tenants_id" integer REFERENCES tenants(id) ON DELETE CASCADE
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE INDEX IF NOT EXISTS "favorites_image_idx" ON "favorites" USING btree ("image_id");
|
||||||
|
CREATE INDEX IF NOT EXISTS "favorites_slug_idx" ON "favorites" USING btree ("slug");
|
||||||
|
CREATE INDEX IF NOT EXISTS "favorites_category_idx" ON "favorites" USING btree ("category");
|
||||||
|
CREATE INDEX IF NOT EXISTS "favorites_updated_at_idx" ON "favorites" USING btree ("updated_at");
|
||||||
|
CREATE INDEX IF NOT EXISTS "favorites_created_at_idx" ON "favorites" USING btree ("created_at");
|
||||||
|
|
||||||
|
CREATE INDEX IF NOT EXISTS "favorites_rels_order_idx" ON "favorites_rels" USING btree ("order");
|
||||||
|
CREATE INDEX IF NOT EXISTS "favorites_rels_parent_idx" ON "favorites_rels" USING btree ("parent_id");
|
||||||
|
CREATE INDEX IF NOT EXISTS "favorites_rels_path_idx" ON "favorites_rels" USING btree ("path");
|
||||||
|
CREATE INDEX IF NOT EXISTS "favorites_rels_tenants_idx" ON "favorites_rels" USING btree ("tenants_id");
|
||||||
|
|
||||||
|
-- =====================================================
|
||||||
|
-- SERIES COLLECTION
|
||||||
|
-- =====================================================
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS "series" (
|
||||||
|
"id" serial PRIMARY KEY NOT NULL,
|
||||||
|
"slug" varchar NOT NULL,
|
||||||
|
"logo_id" integer REFERENCES media(id) ON DELETE SET NULL,
|
||||||
|
"cover_image_id" integer REFERENCES media(id) ON DELETE SET NULL,
|
||||||
|
"brand_color" varchar,
|
||||||
|
"accent_color" varchar,
|
||||||
|
"youtube_playlist_id" varchar,
|
||||||
|
"youtube_playlist_url" varchar,
|
||||||
|
"order" numeric DEFAULT 0,
|
||||||
|
"is_active" boolean DEFAULT true NOT NULL,
|
||||||
|
"updated_at" timestamp(3) with time zone DEFAULT now() NOT NULL,
|
||||||
|
"created_at" timestamp(3) with time zone DEFAULT now() NOT NULL,
|
||||||
|
CONSTRAINT "series_slug_unique" UNIQUE("slug")
|
||||||
|
);
|
||||||
|
|
||||||
|
-- Localized fields for Series
|
||||||
|
CREATE TABLE IF NOT EXISTS "series_locales" (
|
||||||
|
"title" varchar NOT NULL,
|
||||||
|
"tagline" varchar,
|
||||||
|
"description" jsonb,
|
||||||
|
"id" serial PRIMARY KEY NOT NULL,
|
||||||
|
"_locale" varchar NOT NULL,
|
||||||
|
"_parent_id" integer NOT NULL REFERENCES series(id) ON DELETE CASCADE,
|
||||||
|
CONSTRAINT "series_locales_locale_parent_id_unique" UNIQUE("_locale", "_parent_id")
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS "series_rels" (
|
||||||
|
"id" serial PRIMARY KEY NOT NULL,
|
||||||
|
"order" integer,
|
||||||
|
"parent_id" integer NOT NULL REFERENCES series(id) ON DELETE CASCADE,
|
||||||
|
"path" varchar NOT NULL,
|
||||||
|
"tenants_id" integer REFERENCES tenants(id) ON DELETE CASCADE
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE INDEX IF NOT EXISTS "series_slug_idx" ON "series" USING btree ("slug");
|
||||||
|
CREATE INDEX IF NOT EXISTS "series_logo_idx" ON "series" USING btree ("logo_id");
|
||||||
|
CREATE INDEX IF NOT EXISTS "series_cover_image_idx" ON "series" USING btree ("cover_image_id");
|
||||||
|
CREATE INDEX IF NOT EXISTS "series_updated_at_idx" ON "series" USING btree ("updated_at");
|
||||||
|
CREATE INDEX IF NOT EXISTS "series_created_at_idx" ON "series" USING btree ("created_at");
|
||||||
|
|
||||||
|
CREATE INDEX IF NOT EXISTS "series_locales_locale_idx" ON "series_locales" USING btree ("_locale");
|
||||||
|
CREATE INDEX IF NOT EXISTS "series_locales_parent_idx" ON "series_locales" USING btree ("_parent_id");
|
||||||
|
|
||||||
|
CREATE INDEX IF NOT EXISTS "series_rels_order_idx" ON "series_rels" USING btree ("order");
|
||||||
|
CREATE INDEX IF NOT EXISTS "series_rels_parent_idx" ON "series_rels" USING btree ("parent_id");
|
||||||
|
CREATE INDEX IF NOT EXISTS "series_rels_path_idx" ON "series_rels" USING btree ("path");
|
||||||
|
CREATE INDEX IF NOT EXISTS "series_rels_tenants_idx" ON "series_rels" USING btree ("tenants_id");
|
||||||
|
|
||||||
|
-- =====================================================
|
||||||
|
-- SYSTEM TABLE UPDATES
|
||||||
|
-- Add columns to payload_locked_documents_rels
|
||||||
|
-- =====================================================
|
||||||
|
|
||||||
|
ALTER TABLE "payload_locked_documents_rels"
|
||||||
|
ADD COLUMN IF NOT EXISTS "favorites_id" integer REFERENCES favorites(id) ON DELETE CASCADE;
|
||||||
|
|
||||||
|
ALTER TABLE "payload_locked_documents_rels"
|
||||||
|
ADD COLUMN IF NOT EXISTS "series_id" integer REFERENCES series(id) ON DELETE CASCADE;
|
||||||
|
|
||||||
|
CREATE INDEX IF NOT EXISTS "payload_locked_documents_rels_favorites_idx"
|
||||||
|
ON "payload_locked_documents_rels" USING btree ("favorites_id");
|
||||||
|
|
||||||
|
CREATE INDEX IF NOT EXISTS "payload_locked_documents_rels_series_idx"
|
||||||
|
ON "payload_locked_documents_rels" USING btree ("series_id");
|
||||||
|
`)
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function down({ db, payload, req }: MigrateDownArgs): Promise<void> {
|
||||||
|
await db.execute(sql`
|
||||||
|
-- Remove indexes first
|
||||||
|
DROP INDEX IF EXISTS "payload_locked_documents_rels_favorites_idx";
|
||||||
|
DROP INDEX IF EXISTS "payload_locked_documents_rels_series_idx";
|
||||||
|
|
||||||
|
-- Remove columns from system table
|
||||||
|
ALTER TABLE "payload_locked_documents_rels" DROP COLUMN IF EXISTS "favorites_id";
|
||||||
|
ALTER TABLE "payload_locked_documents_rels" DROP COLUMN IF EXISTS "series_id";
|
||||||
|
|
||||||
|
-- Drop Series tables
|
||||||
|
DROP TABLE IF EXISTS "series_rels";
|
||||||
|
DROP TABLE IF EXISTS "series_locales";
|
||||||
|
DROP TABLE IF EXISTS "series";
|
||||||
|
|
||||||
|
-- Drop Favorites tables
|
||||||
|
DROP TABLE IF EXISTS "favorites_rels";
|
||||||
|
DROP TABLE IF EXISTS "favorites";
|
||||||
|
`)
|
||||||
|
}
|
||||||
|
|
@ -21,6 +21,11 @@ import * as migration_20251214_010000_tenant_specific_collections from './202512
|
||||||
import * as migration_20251216_073000_add_video_collections from './20251216_073000_add_video_collections';
|
import * as migration_20251216_073000_add_video_collections from './20251216_073000_add_video_collections';
|
||||||
import * as migration_20251216_080000_posts_featured_video_processed_fields from './20251216_080000_posts_featured_video_processed_fields';
|
import * as migration_20251216_080000_posts_featured_video_processed_fields from './20251216_080000_posts_featured_video_processed_fields';
|
||||||
import * as migration_20260108_160000_add_blogwoman_collections from './20260108_160000_add_blogwoman_collections';
|
import * as migration_20260108_160000_add_blogwoman_collections from './20260108_160000_add_blogwoman_collections';
|
||||||
|
import * as migration_20260108_170000_site_settings_address_geo from './20260108_170000_site_settings_address_geo';
|
||||||
|
import * as migration_20260108_230500_add_pages_blocks_missing from './20260108_230500_add_pages_blocks_missing';
|
||||||
|
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_20260109_020000_add_blogwoman_collections from './20260109_020000_add_blogwoman_collections';
|
||||||
|
|
||||||
export const migrations = [
|
export const migrations = [
|
||||||
{
|
{
|
||||||
|
|
@ -138,4 +143,29 @@ export const migrations = [
|
||||||
down: migration_20260108_160000_add_blogwoman_collections.down,
|
down: migration_20260108_160000_add_blogwoman_collections.down,
|
||||||
name: '20260108_160000_add_blogwoman_collections',
|
name: '20260108_160000_add_blogwoman_collections',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
up: migration_20260108_170000_site_settings_address_geo.up,
|
||||||
|
down: migration_20260108_170000_site_settings_address_geo.down,
|
||||||
|
name: '20260108_170000_site_settings_address_geo',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
up: migration_20260108_230500_add_pages_blocks_missing.up,
|
||||||
|
down: migration_20260108_230500_add_pages_blocks_missing.down,
|
||||||
|
name: '20260108_230500_add_pages_blocks_missing'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
up: migration_20260108_231200_add_video_embed_block_tables.up,
|
||||||
|
down: migration_20260108_231200_add_video_embed_block_tables.down,
|
||||||
|
name: '20260108_231200_add_video_embed_block_tables'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
up: migration_20260108_231400_add_pages_rels_missing_columns.up,
|
||||||
|
down: migration_20260108_231400_add_pages_rels_missing_columns.down,
|
||||||
|
name: '20260108_231400_add_pages_rels_missing_columns'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
up: migration_20260109_020000_add_blogwoman_collections.up,
|
||||||
|
down: migration_20260109_020000_add_blogwoman_collections.down,
|
||||||
|
name: '20260109_020000_add_blogwoman_collections'
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -64,10 +64,13 @@ import { Bookings } from './collections/Bookings'
|
||||||
import { Certifications } from './collections/Certifications'
|
import { Certifications } from './collections/Certifications'
|
||||||
import { Projects } from './collections/Projects'
|
import { Projects } from './collections/Projects'
|
||||||
|
|
||||||
// BlogWoman Collections
|
// BlogWoman Collections - ENABLED
|
||||||
import { Favorites } from './collections/Favorites'
|
import { Favorites } from './collections/Favorites'
|
||||||
import { Series } from './collections/Series'
|
import { Series } from './collections/Series'
|
||||||
|
|
||||||
|
// Debug: Minimal test collection - DISABLED (nur für Tests)
|
||||||
|
// import { TestMinimal } from './collections/TestMinimal'
|
||||||
|
|
||||||
// Consent Management Collections
|
// Consent Management Collections
|
||||||
import { CookieConfigurations } from './collections/CookieConfigurations'
|
import { CookieConfigurations } from './collections/CookieConfigurations'
|
||||||
import { CookieInventory } from './collections/CookieInventory'
|
import { CookieInventory } from './collections/CookieInventory'
|
||||||
|
|
@ -201,9 +204,11 @@ export default buildConfig({
|
||||||
Bookings,
|
Bookings,
|
||||||
Certifications,
|
Certifications,
|
||||||
Projects,
|
Projects,
|
||||||
// BlogWoman Collections
|
// BlogWoman Collections - ENABLED
|
||||||
Favorites,
|
Favorites,
|
||||||
Series,
|
Series,
|
||||||
|
// Debug: Minimal test collection - DISABLED
|
||||||
|
// TestMinimal,
|
||||||
// Consent Management
|
// Consent Management
|
||||||
CookieConfigurations,
|
CookieConfigurations,
|
||||||
CookieInventory,
|
CookieInventory,
|
||||||
|
|
@ -273,9 +278,11 @@ export default buildConfig({
|
||||||
bookings: {},
|
bookings: {},
|
||||||
certifications: {},
|
certifications: {},
|
||||||
projects: {},
|
projects: {},
|
||||||
// BlogWoman Collections
|
// BlogWoman Collections - ENABLED
|
||||||
favorites: {},
|
favorites: {},
|
||||||
series: {},
|
series: {},
|
||||||
|
// Debug: Minimal test collection - DISABLED
|
||||||
|
// 'test-minimal': {},
|
||||||
// Consent Management Collections - customTenantField: true weil sie bereits ein tenant-Feld haben
|
// Consent Management Collections - customTenantField: true weil sie bereits ein tenant-Feld haben
|
||||||
'cookie-configurations': { customTenantField: true },
|
'cookie-configurations': { customTenantField: true },
|
||||||
'cookie-inventory': { customTenantField: true },
|
'cookie-inventory': { customTenantField: true },
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue