UNPKG

@fdm-monster/server

Version:

FDM Monster is a bulk OctoPrint, Klipper, PrusaLink and BambuLab manager to set up, configure and monitor 3D printers. Our aim is to provide neat overview over your farm.

40 lines (39 loc) 1.19 kB
import { CommandUtils } from "typeorm/commands/CommandUtils"; import { PlatformTools } from "typeorm/platform/PlatformTools"; import path from "path"; //#region src/consoles/typeorm-migrate.ts async function main() { let dataSource = void 0; try { dataSource = await CommandUtils.loadDataSource(path.resolve(process.cwd(), "dist/data-source.js")); dataSource.setOptions({ subscribers: [], synchronize: false, migrationsRun: false, dropSchema: false, logging: [ "query", "error", "schema" ] }); await dataSource.initialize(); const options = { transaction: dataSource.options.migrationsTransactionMode ?? "all" }; options.transaction = "all"; await dataSource.runMigrations(options); await dataSource.destroy(); } catch (err) { PlatformTools.logCmdErr("Error during migration run:", err); if (dataSource && dataSource.isInitialized) await dataSource.destroy(); process.exit(1); } } let start = (/* @__PURE__ */ new Date()).getTime(); main().then(() => { let end = (/* @__PURE__ */ new Date()).getTime(); console.log("done", end - start, "ms"); process.exit(0); }); //#endregion export {}; //# sourceMappingURL=typeorm-migrate.js.map