This commit is contained in:
Tomas Dvorak
2025-10-23 22:26:50 +02:00
parent 63700eedb2
commit 70ea0c3c91
75 changed files with 3337 additions and 1160 deletions
@@ -0,0 +1,3 @@
-- Remove voter info fields from poll_votes (rollback)
ALTER TABLE poll_votes DROP COLUMN IF EXISTS voter_name;
ALTER TABLE poll_votes DROP COLUMN IF EXISTS voter_email;
@@ -0,0 +1,6 @@
-- Add optional voter info fields to poll_votes
ALTER TABLE poll_votes ADD COLUMN IF NOT EXISTS voter_name VARCHAR(150);
ALTER TABLE poll_votes ADD COLUMN IF NOT EXISTS voter_email VARCHAR(200);
-- Optional: index on voter_email for admin lookups
-- CREATE INDEX IF NOT EXISTS idx_poll_votes_voter_email ON poll_votes(voter_email);
@@ -0,0 +1,7 @@
-- Set default role to 'fan' and backfill existing records
ALTER TABLE IF EXISTS users ALTER COLUMN role SET DEFAULT 'fan';
-- Backfill NULL/empty/user -> fan (do not touch admin/editor)
UPDATE users
SET role = 'fan'
WHERE role IS NULL OR btrim(role) = '' OR lower(role) = 'user';