"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.AddMaxOrganizationalDecksToOrganization1692712800000 = void 0;
const typeorm_1 = require("typeorm");
class AddMaxOrganizationalDecksToOrganization1692712800000 {
    constructor() {
        this.name = 'AddMaxOrganizationalDecksToOrganization1692712800000';
    }
    async up(queryRunner) {
        // Add maxOrganizationalDecks column to Organizations table
        await queryRunner.addColumn('Organizations', new typeorm_1.TableColumn({
            name: 'maxOrganizationalDecks',
            type: 'int',
            isNullable: true, // No default - set by admin
            comment: 'Maximum number of organizational decks a premium user can create in this organization'
        }));
        // Add performance indexes for deck filtering queries
        await queryRunner.query(`CREATE INDEX "IDX_DECK_USER_STATE_CTYPE" ON "Decks" ("user_id", "state", "ctype")`);
        await queryRunner.query(`CREATE INDEX "IDX_DECK_ORG_CTYPE_STATE" ON "Decks" ("organization_id", "ctype", "state")`);
    }
    async down(queryRunner) {
        // Drop indexes
        await queryRunner.query(`DROP INDEX "IDX_DECK_ORG_CTYPE_STATE"`);
        await queryRunner.query(`DROP INDEX "IDX_DECK_USER_STATE_CTYPE"`);
        // Remove maxOrganizationalDecks column
        await queryRunner.dropColumn('Organizations', 'maxOrganizationalDecks');
    }
}
exports.AddMaxOrganizationalDecksToOrganization1692712800000 = AddMaxOrganizationalDecksToOrganization1692712800000;
//# sourceMappingURL=AddMaxOrganizationalDecksToOrganization.js.map