feat: auto-run SQL migrations and one-time seed on boot

This commit is contained in:
mahmood
2026-09-10 17:15:17 +03:30
parent a4c5c9259f
commit f19f49daeb
12 changed files with 2569 additions and 0 deletions
+13
View File
@@ -83,8 +83,21 @@ async function main() {
await esbuild.build(config);
copyPrismaIntoRelease();
// SQL migrations are read at runtime by src/prisma/migrate.ts
cpSync(path.join(root, 'prisma', 'migrations'), path.join(releaseDir, 'migrations'), {
recursive: true,
});
// Seeding runs as a separate process on a fresh database (src/prisma/bootstrap.ts)
await esbuild.build({
...config,
entryPoints: [path.join(root, 'prisma', 'seed.ts')],
outfile: path.join(releaseDir, 'seed.js'),
});
console.log('نوشت:', config.outfile);
console.log('Prisma client در release/vendor کپی شد.');
console.log('migrations و seed.js در release کپی شدند.');
}
main().catch((err) => {