chore: relocate backend into apps/api ahead of monorepo merge

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-24 12:20:40 +08:00
co-authored by Claude Sonnet 5
parent af44598df6
commit eaa6d2276a
388 changed files with 0 additions and 13998 deletions
@@ -0,0 +1,24 @@
'use strict';
// Backstop for the stacked-tier model: application code now enforces "at most
// one active row per (user_id, tier)" (see controllers/client/tiers.controller.js
// createOrder/captureOrder and controllers/admin/tiers.controller.js grantTier),
// but a race or a future code path could still violate it. This partial unique
// index makes the DB reject that case outright instead of silently allowing two
// active rows for the same user+tier.
//
// NOT auto-run — this file only defines the migration. Do not execute it against
// the shared dev/prod database without explicit confirmation.
module.exports = {
async up(queryInterface) {
await queryInterface.addIndex('user_tiers', ['user_id', 'tier'], {
unique: true,
where: { status: 'active' },
name: 'user_tiers_one_active_per_user_tier',
});
},
async down(queryInterface) {
await queryInterface.removeIndex('user_tiers', 'user_tiers_one_active_per_user_tier');
},
};