From 3b2e6f5a9aae693f3602727df6e4932213fc48b6 Mon Sep 17 00:00:00 2001 From: DeNNiiInc Date: Mon, 29 Dec 2025 11:15:55 +1100 Subject: [PATCH] Add fix_schema.sql to ensure DB columns exist --- migrations/fix_schema.sql | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 migrations/fix_schema.sql diff --git a/migrations/fix_schema.sql b/migrations/fix_schema.sql new file mode 100644 index 0000000..fd07f54 --- /dev/null +++ b/migrations/fix_schema.sql @@ -0,0 +1,11 @@ +-- Ensure all columns exist +ALTER TABLE test_results ADD COLUMN IF NOT EXISTS user_ip TEXT; +ALTER TABLE test_results ADD COLUMN IF NOT EXISTS filmstrip JSONB; +ALTER TABLE test_results ADD COLUMN IF NOT EXISTS user_uuid TEXT; +ALTER TABLE test_results ADD COLUMN IF NOT EXISTS scores JSONB; +ALTER TABLE test_results ADD COLUMN IF NOT EXISTS metrics JSONB; + +-- Ensure unused columns are nullable (or drop them if you prefer, but let's just ensure they don't block inserts) +ALTER TABLE test_results ALTER COLUMN suite_id DROP NOT NULL; +ALTER TABLE test_results ALTER COLUMN run_number DROP NOT NULL; +ALTER TABLE test_results ALTER COLUMN is_median DROP NOT NULL;