feat: auto-run SQL migrations and one-time seed on boot
This commit is contained in:
@@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user