-- Add missing columns to users_customuser table
ALTER TABLE users_customuser 
ADD COLUMN IF NOT EXISTS approved_by_id char(32) NULL,
ADD COLUMN IF NOT EXISTS approved_at datetime NULL,
ADD COLUMN IF NOT EXISTS approval_reason text NULL,
ADD COLUMN IF NOT EXISTS rejected_by_id char(32) NULL,
ADD COLUMN IF NOT EXISTS rejected_at datetime NULL,
ADD COLUMN IF NOT EXISTS rejection_reason text NULL;

-- Add foreign key constraints
ALTER TABLE users_customuser 
ADD CONSTRAINT IF NOT EXISTS users_customuser_approved_by_id_fk 
FOREIGN KEY (approved_by_id) REFERENCES users_customuser(id) ON DELETE SET NULL;

ALTER TABLE users_customuser 
ADD CONSTRAINT IF NOT EXISTS users_customuser_rejected_by_id_fk 
FOREIGN KEY (rejected_by_id) REFERENCES users_customuser(id) ON DELETE SET NULL;
