From 9f491035b54c380fc4186aba8fc3f80da707707d Mon Sep 17 00:00:00 2001 From: Dan Draper Date: Mon, 4 May 2026 19:52:25 +1000 Subject: [PATCH] test(integration): add otherField column to protect-ci fixture MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The supabase test suites (packages/protect/__tests__/supabase.test.ts, packages/stack/__tests__/supabase.test.ts) write a non-encrypted 'otherField' text column to 'protect-ci' that PR #400's union schema missed. Add it to all three CREATE TABLE IF NOT EXISTS bodies (drizzle plus the two supabase suites). Add an ALTER TABLE ADD COLUMN IF NOT EXISTS so long-lived CI databases — where CREATE TABLE IF NOT EXISTS is a no-op — get the column backfilled the next time any suite runs. --- packages/drizzle/__tests__/drizzle.test.ts | 7 +++++++ packages/protect/__tests__/supabase.test.ts | 7 +++++++ packages/stack/__tests__/supabase.test.ts | 7 +++++++ 3 files changed, 21 insertions(+) diff --git a/packages/drizzle/__tests__/drizzle.test.ts b/packages/drizzle/__tests__/drizzle.test.ts index 6a228f26..689cc725 100644 --- a/packages/drizzle/__tests__/drizzle.test.ts +++ b/packages/drizzle/__tests__/drizzle.test.ts @@ -130,10 +130,17 @@ beforeAll(async () => { score eql_v2_encrypted, profile eql_v2_encrypted, encrypted eql_v2_encrypted, + "otherField" TEXT, created_at TIMESTAMPTZ DEFAULT NOW(), test_run_id TEXT ) ` + // Backfill any column added after the table was first created on a + // long-lived CI database. CREATE TABLE IF NOT EXISTS is a no-op on + // those, so new columns need an explicit ADD COLUMN IF NOT EXISTS. + await postgresClient` + ALTER TABLE "protect-ci" ADD COLUMN IF NOT EXISTS "otherField" TEXT + ` const encryptedUsers = unwrapResult( await protectClient.bulkEncryptModels(userSeedData, users), diff --git a/packages/protect/__tests__/supabase.test.ts b/packages/protect/__tests__/supabase.test.ts index 1e4cf674..d8469db4 100644 --- a/packages/protect/__tests__/supabase.test.ts +++ b/packages/protect/__tests__/supabase.test.ts @@ -60,10 +60,17 @@ beforeAll(async () => { score eql_v2_encrypted, profile eql_v2_encrypted, encrypted eql_v2_encrypted, + "otherField" TEXT, created_at TIMESTAMPTZ DEFAULT NOW(), test_run_id TEXT ) ` + // Backfill any column added after the table was first created on a + // long-lived CI database. CREATE TABLE IF NOT EXISTS is a no-op on + // those, so new columns need an explicit ADD COLUMN IF NOT EXISTS. + await sql` + ALTER TABLE "protect-ci" ADD COLUMN IF NOT EXISTS "otherField" TEXT + ` // Tell PostgREST to refresh its schema cache so the supabase-js client // can see a freshly created table without waiting for the polling // interval. No-op on plain Postgres (no listener bound). diff --git a/packages/stack/__tests__/supabase.test.ts b/packages/stack/__tests__/supabase.test.ts index 67fae663..f25e2bc2 100644 --- a/packages/stack/__tests__/supabase.test.ts +++ b/packages/stack/__tests__/supabase.test.ts @@ -61,10 +61,17 @@ beforeAll(async () => { score eql_v2_encrypted, profile eql_v2_encrypted, encrypted eql_v2_encrypted, + "otherField" TEXT, created_at TIMESTAMPTZ DEFAULT NOW(), test_run_id TEXT ) ` + // Backfill any column added after the table was first created on a + // long-lived CI database. CREATE TABLE IF NOT EXISTS is a no-op on + // those, so new columns need an explicit ADD COLUMN IF NOT EXISTS. + await sql` + ALTER TABLE "protect-ci" ADD COLUMN IF NOT EXISTS "otherField" TEXT + ` // Tell PostgREST to refresh its schema cache so the supabase-js client // can see a freshly created table without waiting for the polling // interval. No-op on plain Postgres (no listener bound).