"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.replaceMigrationCommands = replaceMigrationCommands;
exports.createMigration = createMigration;
exports.runMigrations = runMigrations;
const tslib_1 = require("tslib");
function __assignType(fn, args) {
    fn.__type = args;
    return fn;
}
const app_1 = require("@deepkit/app");
/*@ts-ignore*/
var { __ΩClassType } = require('@deepkit/core');
const framework_1 = require("@deepkit/framework");
const resolver_1 = require("../../app/resolver");
const state_1 = require("../../app/state");
const common_1 = require("../common");
const characters_1 = require("./characters");
const MigrationCreateCommand_1 = require("./create/MigrationCreateCommand");
const MigrationResetCommand_1 = require("./MigrationResetCommand");
const MigrationRunCommand_1 = require("./MigrationRunCommand");
tslib_1.__exportStar(require("./characters"), exports);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function replaceMigrationCommands(_app, frameworkModule, dbClass) {
    frameworkModule.controllers = frameworkModule.controllers.filter(__assignType(c => !c.name.startsWith('Migration'), ['c', '', 'P"2!"/"']));
    if (!dbClass) {
        return;
    }
    frameworkModule.addController(MigrationRunCommand_1.MigrationRunCommand);
    frameworkModule.addController(MigrationCreateCommand_1.MigrationCreateCommand);
    frameworkModule.addController(characters_1.MigrationCharactersCommand);
    frameworkModule.addController(MigrationResetCommand_1.MigrationResetCommand);
}
replaceMigrationCommands.__type = [() => app_1.App, '_app', () => framework_1.FrameworkModule, 'frameworkModule', () => __ΩClassType, () => common_1.BaseDatabase, 'dbClass', 'replaceMigrationCommands', 'PP"7!2"P7#2$P7&o%"2\'8"/('];
function createMigration(fn) {
    return fn;
}
createMigration.__type = ['db', '', 'fn', 'createMigration', 'PP"2!$`/"2#"/$'];
function runMigrations() {
    return new MigrationRunCommand_1.MigrationRunCommand((0, resolver_1.r)(state_1.DBProvider)).execute();
}
runMigrations.__type = ['runMigrations', 'P"/!'];
//# sourceMappingURL=index.js.map