"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
Object.defineProperty(exports, "migrateCommand", {
    enumerable: true,
    get: function() {
        return migrateCommand;
    }
});
const _commander = require("commander");
const _migrations = require("@tamanu/database/services/migrations");
const _database = require("../database");
const _versionCompatibility = require("../middleware/versionCompatibility");
// This is the "just-migrate" command for running database migrations only
// Note: there's also a 'migrate' alias on the 'upgrade' command for deployment safety, which
// includes database migrations plus automated upgrade steps
async function migrate(direction, { dryRun = false } = {}) {
    const store = await (0, _database.initDatabase)({
        testMode: false
    });
    await store.sequelize.migrate(direction, {
        serverVersion: _versionCompatibility.VERSION,
        dryRun
    });
    process.exit(0);
}
const migrateCommand = (0, _migrations.createMigrateCommand)(_commander.Command, migrate, 'just-migrate');

//# sourceMappingURL=migrate.js.map