DO $$ BEGIN
  CREATE TYPE plan_billing_mode_enum AS ENUM ('ONE_TIME', 'RECURRING');
EXCEPTION
  WHEN duplicate_object THEN null;
END $$;

DO $$ BEGIN
  CREATE TYPE plan_billing_cycle_enum AS ENUM ('MONTHLY', 'ANNUAL');
EXCEPTION
  WHEN duplicate_object THEN null;
END $$;

ALTER TABLE membership_plans
  ADD COLUMN IF NOT EXISTS billing_mode plan_billing_mode_enum NOT NULL DEFAULT 'RECURRING';

ALTER TABLE membership_plans
  ADD COLUMN IF NOT EXISTS default_billing_cycle plan_billing_cycle_enum NOT NULL DEFAULT 'ANNUAL';
