Add migrations/002_schema_updates.sql for terms_agreed, streak_count, and pdf_url

This commit is contained in:
2026-09-25 16:48:58 +05:30
parent 4be3676144
commit 7c0f9bfcbd

View File

@@ -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;