mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-27 00:52:50 +00:00
feat: ( payment ) create payment microservice
This commit is contained in:
23
apps/edr-payment-api/src/scripts/migrate.ts
Normal file
23
apps/edr-payment-api/src/scripts/migrate.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
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);
|
||||
});
|
||||
Reference in New Issue
Block a user