-- Migration: Add has_write_access column to users table -- Run this as a PostgreSQL superuser or with appropriate permissions -- Add the has_write_access column with default false ALTER TABLE users ADD COLUMN IF NOT EXISTS has_write_access BOOLEAN NOT NULL DEFAULT false; -- Create an index on has_write_access for faster queries CREATE INDEX IF NOT EXISTS idx_users_has_write_access ON users(has_write_access); -- Update existing users: only admins should have write access initially -- (You may want to adjust this based on your needs) UPDATE users SET has_write_access = false WHERE has_write_access IS NULL; -- Verify the column was added SELECT column_name, data_type, column_default FROM information_schema.columns WHERE table_name = 'users' AND column_name = 'has_write_access';