mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-26 18:42:49 +00:00
24 lines
696 B
TypeScript
24 lines
696 B
TypeScript
import "dotenv/config";
|
|
import { AppDataSource } from "../data-source";
|
|
import { ensurePaymentSchema } from "../config/ensure-schema";
|
|
|
|
/** `pnpm --filter @edr/payment-api migration:run` — ensure schema, then run pending migrations. */
|
|
async function main(): Promise<void> {
|
|
await ensurePaymentSchema();
|
|
await AppDataSource.initialize();
|
|
try {
|
|
const applied = await AppDataSource.runMigrations();
|
|
for (const migration of applied) {
|
|
console.log(`applied: ${migration.name}`);
|
|
}
|
|
if (applied.length === 0) console.log("no pending migrations");
|
|
} finally {
|
|
await AppDataSource.destroy();
|
|
}
|
|
}
|
|
|
|
main().catch((err) => {
|
|
console.error(err);
|
|
process.exit(1);
|
|
});
|