units,lesson as standalone

This commit is contained in:
2026-07-10 11:44:46 +08:00
parent 86fba50b95
commit e1ffdab190
46 changed files with 1463 additions and 197 deletions
@@ -0,0 +1,23 @@
'use strict';
// Part 2B — standalone (non-course) units currently can never be tier-gated:
// canAccessUnit only ever checks course links, and an independent unit by
// definition has none. Add a direct, optional subscription field so a
// standalone unit can require a tier on its own. Deliberately no CHECK
// constraint — mirrors 20260101000065-drop-tier-enum-check-user-tiers.js's
// fix, since tier slugs are admin-defined (tier_categories.slug) and not a
// fixed enum.
module.exports = {
async up(queryInterface, Sequelize) {
await queryInterface.addColumn('units', 'subscription', {
type: Sequelize.STRING(50),
allowNull: true,
after: 'title',
});
},
async down(queryInterface) {
await queryInterface.removeColumn('units', 'subscription');
},
};