Files
starr-philproperties/apps/api/database/migrations/20270101000091-drop-plan-policies.js
T

32 lines
1.5 KiB
JavaScript

'use strict';
// The "Access Rules" feature (rule-based access on top of/instead of item-
// specific entitlement — course_subscription_access/required_active_tier/
// group_restriction/item_allowlist rule types, plus the "starter-set purchase
// eligibility" gate derived from item_allowlist) has been removed entirely,
// admin UI and runtime enforcement both — item-specific `user_tier_grants` is
// the only entitlement mechanism now (see hasItemGrant() in
// controllers/client/courses.controller.js). No other table has an FK into
// plan_policies (only plan_policies.plan_id -> tier_plans.plan_id), so this
// is a clean, isolated drop.
//
// NOT auto-run — do not execute against the shared dev/prod database without
// explicit confirmation.
module.exports = {
async up(queryInterface) {
await queryInterface.dropTable('plan_policies');
},
async down(queryInterface, Sequelize) {
await queryInterface.createTable('plan_policies', {
policy_id: { type: Sequelize.BIGINT, primaryKey: true, autoIncrement: true },
plan_id: { type: Sequelize.BIGINT, allowNull: false, unique: true,
references: { model: 'tier_plans', key: 'plan_id' },
onUpdate: 'CASCADE', onDelete: 'CASCADE' },
access_rules: { type: Sequelize.JSONB, allowNull: false, defaultValue: [] },
createdAt: { type: Sequelize.DATE, allowNull: false },
updatedAt: { type: Sequelize.DATE, allowNull: false },
});
},
};