RezinaLMS-BackEnd/db/migrations/000100_subscription_plan_is_lifetime.up.sql

10 lines
394 B
SQL

-- Per-plan lifetime (one-time) billing flag, independent of content category.
ALTER TABLE subscription_plans
ADD COLUMN IF NOT EXISTS is_lifetime BOOLEAN NOT NULL DEFAULT FALSE;
-- Preserve existing product behavior: IELTS and DUOLINGO plans remain one-time.
UPDATE subscription_plans
SET is_lifetime = TRUE
WHERE UPPER(TRIM(category)) IN ('IELTS', 'DUOLINGO')
AND is_lifetime = FALSE;