fix(migrations): increase users.status VARCHAR(20→30), fix 010 status value

- 009: status column was VARCHAR(20), causing 'force_change_password' (21 chars)
  to fail on INSERT — changed to VARCHAR(30)
- 010: changed initial status from 'force_change_password' to 'pending' (fits
  any column size ≥7 chars, avoids future truncation)
- 046: ALTER TABLE for existing deployments where 009 already applied with VARCHAR(20)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Tiago Yamamoto 2026-02-23 21:17:34 -06:00
parent 028d26d2e6
commit e5e43974a5
3 changed files with 7 additions and 2 deletions

View file

@ -11,7 +11,7 @@ ALTER TABLE users ADD COLUMN IF NOT EXISTS email VARCHAR(255);
ALTER TABLE users ADD COLUMN IF NOT EXISTS name VARCHAR(255);
-- Add status field for compatibility
ALTER TABLE users ADD COLUMN IF NOT EXISTS status VARCHAR(20) DEFAULT 'active';
ALTER TABLE users ADD COLUMN IF NOT EXISTS status VARCHAR(30) DEFAULT 'active';
-- Create user_roles table (replaces core_user_roles)
CREATE TABLE IF NOT EXISTS user_roles (

View file

@ -35,7 +35,7 @@ VALUES (
'superadmin',
'Super Administrator',
'admin@gohorsejobs.com',
'force_change_password',
'pending',
true
) ON CONFLICT (identifier) DO NOTHING;
-- ON CONFLICT DO NOTHING: não sobrescreve se o seeder já definiu o hash.

View file

@ -0,0 +1,5 @@
-- Migration: Increase users.status column size
-- Description: Increase VARCHAR(20) to VARCHAR(30) to accommodate longer status values
-- like 'force_change_password' (21 chars) without truncation errors.
ALTER TABLE users ALTER COLUMN status TYPE VARCHAR(30);