RezinaLMS-BackEnd/db/migrations/000115_education_subscription_category.down.sql

14 lines
581 B
SQL

ALTER TABLE programs DROP CONSTRAINT IF EXISTS chk_programs_category;
UPDATE programs SET category = 'LEARN_ENGLISH', updated_at = NOW();
ALTER TABLE programs
ADD CONSTRAINT chk_programs_category CHECK (category = 'LEARN_ENGLISH');
UPDATE subscription_plans
SET category = 'LEARN_ENGLISH', updated_at = NOW()
WHERE category = 'EDUCATION';
ALTER TABLE subscription_plans DROP CONSTRAINT IF EXISTS chk_subscription_plans_category;
ALTER TABLE subscription_plans
ADD CONSTRAINT chk_subscription_plans_category
CHECK (category IN ('LEARN_ENGLISH', 'IELTS', 'DUOLINGO'));