From 7c0f9bfcbd479c70005fbf48f7c153fdb45a2699 Mon Sep 17 00:00:00 2001 From: ectasy663 Date: Fri, 25 Sep 2026 16:48:58 +0530 Subject: [PATCH] Add migrations/002_schema_updates.sql for terms_agreed, streak_count, and pdf_url --- migrations/002_schema_updates.sql | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 migrations/002_schema_updates.sql diff --git a/migrations/002_schema_updates.sql b/migrations/002_schema_updates.sql new file mode 100644 index 0000000..00f8ebe --- /dev/null +++ b/migrations/002_schema_updates.sql @@ -0,0 +1,10 @@ +-- Schema Updates: terms_agreed, pdf_url, streaks +ALTER TABLE "user" ADD COLUMN IF NOT EXISTS terms_agreed BOOLEAN DEFAULT FALSE; +ALTER TABLE "user" ADD COLUMN IF NOT EXISTS streak_count INTEGER NOT NULL DEFAULT 0; +ALTER TABLE "user" ADD COLUMN IF NOT EXISTS longest_streak INTEGER NOT NULL DEFAULT 0; +ALTER TABLE "user" ADD COLUMN IF NOT EXISTS is_active BOOLEAN DEFAULT TRUE; + +ALTER TABLE "test" ADD COLUMN IF NOT EXISTS pdf_url VARCHAR; + +-- Update existing streaks to have default 1 if empty +UPDATE "user" SET streak_count = 1, longest_streak = 1 WHERE streak_count = 0;