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).