-- Migration: Make name column required (NOT NULL) in users table -- Run this as a PostgreSQL superuser or with appropriate permissions -- Prerequisites: All existing users must have a non-null name value -- First, ensure all existing users have a name (safety check) -- This should not update any rows if all users already have names UPDATE users SET name = email WHERE name IS NULL; -- Alter the column to be NOT NULL ALTER TABLE users ALTER COLUMN name SET NOT NULL; -- Verify the column constraint SELECT column_name, data_type, is_nullable, column_default FROM information_schema.columns WHERE table_name = 'users' AND column_name = 'name';