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>
31 lines
1.6 KiB
JavaScript
31 lines
1.6 KiB
JavaScript
'use strict';
|
|
|
|
// `tier` started as ENUM('premium','exclusive') but 20260101000063 dropped
|
|
// its CHECK constraint entirely so it can hold any tier_categories.slug
|
|
// value (including admin-created ones) — it's a free-form STRING now, not
|
|
// an enum.
|
|
module.exports = {
|
|
async up(queryInterface, Sequelize) {
|
|
await queryInterface.createTable('tier_plans', {
|
|
plan_id: { type: Sequelize.BIGINT, primaryKey: true, autoIncrement: true },
|
|
tier: { type: Sequelize.STRING(20), allowNull: false },
|
|
label: { type: Sequelize.STRING(100), allowNull: false },
|
|
description: { type: Sequelize.TEXT, allowNull: true },
|
|
features: { type: Sequelize.JSONB, allowNull: true },
|
|
duration_days: { type: Sequelize.FLOAT, allowNull: false },
|
|
duration_unit: { type: Sequelize.STRING(10), allowNull: false, defaultValue: 'day' },
|
|
price: { type: Sequelize.DECIMAL(10, 2), allowNull: false },
|
|
currency: { type: Sequelize.CHAR(3), allowNull: false, defaultValue: 'USD' },
|
|
is_active: { type: Sequelize.BOOLEAN, allowNull: false, defaultValue: true },
|
|
tier_category_id: { type: Sequelize.BIGINT, allowNull: true, references: { model: 'tier_categories', key: 'tier_category_id' }, onUpdate: 'CASCADE', onDelete: 'SET NULL' },
|
|
createdAt: { type: Sequelize.DATE, allowNull: false },
|
|
updatedAt: { type: Sequelize.DATE, allowNull: false },
|
|
deletedAt: { type: Sequelize.DATE, allowNull: true },
|
|
});
|
|
},
|
|
|
|
async down(queryInterface) {
|
|
await queryInterface.dropTable('tier_plans');
|
|
},
|
|
};
|