mirror of
https://github.com/rgrgogu/new_starr.git
synced 2026-09-27 00:12:54 +08:00
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
32 lines
1.5 KiB
JavaScript
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 },
|
|
});
|
|
},
|
|
};
|