ALTER TABLE expenses ADD COLUMN IF NOT EXISTS status VARCHAR(20) NOT NULL DEFAULT 'draft';

UPDATE expenses
SET status = 'approved'
WHERE status = 'draft';

ALTER TABLE expenses DROP CONSTRAINT IF EXISTS expenses_status_check;
ALTER TABLE expenses ADD CONSTRAINT expenses_status_check CHECK (status IN ('draft', 'sent', 'approved', 'cancel'));

CREATE INDEX IF NOT EXISTS idx_expenses_status ON expenses(status);
