CI Pipeline with Test Management / 🧪 Run Tests & Generate Reports (push) Canceled after 0s
Test Reporting & Gherkin Analysis / 🧪 Run Tests & Generate Reports (push) Canceled after 0s
CI Pipeline with Test Management / 🐳 Docker Integration Tests (push) Canceled after 0s
CI Pipeline with Test Management / 🏗️ Build Docker Image (push) Canceled after 0s
CI Pipeline with Test Management / 📊 Generate Test Summary (push) Canceled after 0s
Test Reporting & Gherkin Analysis / 📊 Analyze Test Coverage (push) Canceled after 0s
Test Reporting & Gherkin Analysis / 🔄 Sync with Linear (push) Canceled after 0s
Test Reporting & Gherkin Analysis / ⚡ Performance Monitoring (push) Canceled after 0s
The editable id of the Home usps/items rows was also the row's primary key in PostgreSQL (a duplicate would fail to save; new rows needed a manual id). It is now the `key` field; migration 20260929_213538_home_row_keys adds the column and backfills it (main tables from id, version tables from _uuid). Tried on the staging pg_dump: keys backfilled, second run no-op, all 14 public pages unchanged. React keys use `key`; the transfer upgrades old bundles. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
27 lines
1.4 KiB
TypeScript
27 lines
1.4 KiB
TypeScript
/* MITHOME-138: generated by `payload migrate:create`, plus a hand-written backfill in up(). */
|
|
import { MigrateUpArgs, MigrateDownArgs, sql } from '@payloadcms/db-postgres'
|
|
|
|
export async function up({ db, payload, req }: MigrateUpArgs): Promise<void> {
|
|
await db.execute(sql`
|
|
ALTER TABLE "home_about_usps" ADD COLUMN "key" varchar;
|
|
ALTER TABLE "home_services_items" ADD COLUMN "key" varchar;
|
|
ALTER TABLE "_home_v_version_about_usps" ADD COLUMN "key" varchar;
|
|
ALTER TABLE "_home_v_version_services_items" ADD COLUMN "key" varchar;`)
|
|
// MITHOME-138 (hand-written backfill): the editable key used to be the row
|
|
// id itself; in the version tables the original row id is kept in `_uuid`.
|
|
// The row ids stay, so the page renders the same rows.
|
|
await db.execute(sql`
|
|
UPDATE "home_about_usps" SET "key" = "id" WHERE "key" IS NULL;
|
|
UPDATE "home_services_items" SET "key" = "id" WHERE "key" IS NULL;
|
|
UPDATE "_home_v_version_about_usps" SET "key" = "_uuid" WHERE "key" IS NULL;
|
|
UPDATE "_home_v_version_services_items" SET "key" = "_uuid" WHERE "key" IS NULL;`)
|
|
}
|
|
|
|
export async function down({ db, payload, req }: MigrateDownArgs): Promise<void> {
|
|
await db.execute(sql`
|
|
ALTER TABLE "home_about_usps" DROP COLUMN "key";
|
|
ALTER TABLE "home_services_items" DROP COLUMN "key";
|
|
ALTER TABLE "_home_v_version_about_usps" DROP COLUMN "key";
|
|
ALTER TABLE "_home_v_version_services_items" DROP COLUMN "key";`)
|
|
}
|