20 lines
497 B
TypeScript
20 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
|
||
|
}
|