bmc_hub/migrations/135_subscription_extended_intervals.sql

18 lines
754 B
MySQL
Raw Normal View History

-- Migration 135: Add daily and biweekly billing intervals
-- Extends subscription billing intervals to support more frequent billing
-- Drop the old constraint
ALTER TABLE sag_subscriptions
DROP CONSTRAINT IF EXISTS sag_subscriptions_billing_interval_check;
-- Add new constraint with extended options
ALTER TABLE sag_subscriptions
ADD CONSTRAINT sag_subscriptions_billing_interval_check
CHECK (billing_interval IN ('daily', 'biweekly', 'monthly', 'quarterly', 'yearly'));
-- Update default if needed (keep monthly as default)
ALTER TABLE sag_subscriptions
ALTER COLUMN billing_interval SET DEFAULT 'monthly';
COMMENT ON COLUMN sag_subscriptions.billing_interval IS 'Billing frequency: daily, biweekly (every 14 days), monthly, quarterly, yearly';