-- SMS template verification workflow: free | pending | verified ALTER TABLE sms_templates ADD COLUMN IF NOT EXISTS verification_status VARCHAR(32) NOT NULL DEFAULT 'free'; UPDATE sms_templates SET verification_status = 'verified' WHERE is_verified = TRUE; ALTER TABLE sms_templates DROP CONSTRAINT IF EXISTS sms_templates_verification_status_check; ALTER TABLE sms_templates ADD CONSTRAINT sms_templates_verification_status_check CHECK (verification_status IN ('free', 'pending', 'verified')); CREATE INDEX IF NOT EXISTS idx_sms_templates_verification_status ON sms_templates (verification_status); CREATE INDEX IF NOT EXISTS idx_sms_templates_business_status ON sms_templates (business_id, verification_status);