diff --git a/src/migrations/20260225_175000_native_localization.ts b/src/migrations/20260225_175000_native_localization.ts index 59678da7..a5ba9dd5 100644 --- a/src/migrations/20260225_175000_native_localization.ts +++ b/src/migrations/20260225_175000_native_localization.ts @@ -221,6 +221,54 @@ export async function up({ db }: MigrateUpArgs): Promise { await db.execute(sql`ALTER TABLE "products" DROP COLUMN IF EXISTS "locale"`); // ── 12. Version tables (_posts_v, _products_v, _pages_v) locale columns ────── + await db.execute(sql` + CREATE TABLE IF NOT EXISTS "_posts_v" ( + "id" serial PRIMARY KEY NOT NULL, + "parent_id" integer, + "version_title" varchar, + "version_slug" varchar, + "version_excerpt" varchar, + "version_content" jsonb, + "version_updated_at" timestamp(3) with time zone, + "version_created_at" timestamp(3) with time zone, + "version__status" "enum__posts_v_version_status" DEFAULT 'draft', + "created_at" timestamp(3) with time zone DEFAULT now() NOT NULL, + "updated_at" timestamp(3) with time zone DEFAULT now() NOT NULL, + "latest" boolean + ) + `); + await db.execute(sql` + CREATE TABLE IF NOT EXISTS "_products_v" ( + "id" serial PRIMARY KEY NOT NULL, + "parent_id" integer, + "version_title" varchar, + "version_description" varchar, + "version_content" jsonb, + "version_updated_at" timestamp(3) with time zone, + "version_created_at" timestamp(3) with time zone, + "version__status" "enum__products_v_version_status" DEFAULT 'draft', + "created_at" timestamp(3) with time zone DEFAULT now() NOT NULL, + "updated_at" timestamp(3) with time zone DEFAULT now() NOT NULL, + "latest" boolean + ) + `); + await db.execute(sql` + CREATE TABLE IF NOT EXISTS "_pages_v" ( + "id" serial PRIMARY KEY NOT NULL, + "parent_id" integer, + "version_title" varchar, + "version_slug" varchar, + "version_excerpt" varchar, + "version_content" jsonb, + "version_updated_at" timestamp(3) with time zone, + "version_created_at" timestamp(3) with time zone, + "version__status" "enum__pages_v_version_status" DEFAULT 'draft', + "created_at" timestamp(3) with time zone DEFAULT now() NOT NULL, + "updated_at" timestamp(3) with time zone DEFAULT now() NOT NULL, + "latest" boolean + ) + `); + await db.execute( sql`ALTER TABLE "_posts_v" ADD COLUMN IF NOT EXISTS "published_locale" "enum__posts_v_published_locale"`, );