feat: add RUN_SEED support and nullable tenantId migration

- New migration: make users.tenantId nullable for super_admin
- Dockerfile: RUN_SEED=true env var triggers seed after migrations
- Seed uses npx tsx (available in node_modules)
This commit is contained in:
kevin-asprec
2026-04-15 06:04:57 +08:00
parent 555bd4a9f8
commit bef320f32e
2 changed files with 13 additions and 1 deletions

View File

@@ -34,4 +34,4 @@ COPY --from=builder /app/packages/db/src ./packages/db/src
ENV NODE_ENV=production
EXPOSE 3001
ENTRYPOINT ["dumb-init", "--"]
CMD ["sh", "-c", "cd packages/db && npx prisma migrate deploy && cd /app && node dist/main"]
CMD ["sh", "-c", "cd packages/db && npx prisma migrate deploy && if [ \"$RUN_SEED\" = \"true\" ]; then echo 'Seeding database...' && npx tsx prisma/seed.ts; fi && cd /app && node dist/main"]