-- Add title and role_keys to coupons for admin UI
ALTER TABLE coupons
  ADD COLUMN IF NOT EXISTS title VARCHAR(255),
  ADD COLUMN IF NOT EXISTS role_keys TEXT[] NOT NULL DEFAULT '{}';

-- Backfill title from description
UPDATE coupons SET title = description WHERE title IS NULL AND description IS NOT NULL;
