ts-tmpl/src/start.ts
2023-07-31 21:31:51 +02:00

19 lines
497 B
TypeScript

import "reflect-metadata"; // Required for TypeORM
import TypeORMDataSource from "~/db/index.js";
import log from "~/log.js";
export default async function start() {
log.info("Initializing database");
await TypeORMDataSource.initialize();
const pendingMigrations = await TypeORMDataSource.showMigrations();
if (pendingMigrations) {
log.error(
"There are pending migrations, please run these with `pnpm migrate`.",
);
return;
}
// add your logic below this line
}