gohorsejobs/backend/migrations/032_update_superadmin_lol.sql
2026-02-07 10:41:16 -03:00

25 lines
1,006 B
SQL

-- Migration: Update Super Admin to 'lol' and force password reset
-- Description: Updates the superadmin identifier, email, name, and sets status to enforce password change.
-- Increase status column length to support 'force_change_password' (21 chars)
ALTER TABLE users ALTER COLUMN status TYPE VARCHAR(50);
-- Update only the intended superadmin identifier to avoid unique constraint conflicts.
UPDATE users
SET
identifier = 'lol',
email = 'lol@gohorsejobs.com',
full_name = 'Dr. Horse Expert',
name = 'Dr. Horse Expert',
status = 'force_change_password',
updated_at = CURRENT_TIMESTAMP
WHERE identifier = 'superadmin';
-- If there is a separate user with email 'admin@gohorsejobs.com', update non-identifier fields only
UPDATE users
SET
email = 'lol@gohorsejobs.com',
full_name = 'Dr. Horse Expert',
name = 'Dr. Horse Expert',
status = 'force_change_password',
updated_at = CURRENT_TIMESTAMP
WHERE email = 'admin@gohorsejobs.com' AND identifier <> 'lol';