Questions
8 of 25
1How do you define a TypeORM entity and register it in a NestJS feature module?
2How do you handle TypeORM migrations in a NestJS project?
3How do you run a transaction with Prisma in NestJS?
4How do you perform CRUD operations and add query methods to a Mongoose model in NestJS?
5How do you use Prisma with multiple databases in a single NestJS application?
6What is the difference between find(), findOne(), findOneOrFail(), and the Query Builder in TypeORM?
7What are the two main ways to run a database transaction in TypeORM with NestJS?
8How do you handle Prisma migrations in a CI/CD pipeline?
9How do you add schema middleware (hooks) and instance methods in NestJS Mongoose?
10How do you mock a repository in a NestJS unit test?
11How do you seed a database in a NestJS application?
12How do you implement a Unit of Work pattern to group database operations across repositories in NestJS?
13How do you implement optimistic locking with TypeORM to prevent lost updates in NestJS?
14How do you integrate Prisma into a NestJS application?
15How do you implement soft deletes in NestJS with TypeORM?
16How do you implement multi-tenancy with a shared database in NestJS TypeORM?
17How do you set up TypeORM in a NestJS application?
18How do you implement a custom TypeORM repository in NestJS?
19How do you propagate a TypeORM transaction across multiple services in NestJS?
20What are Prisma middleware and how do you use them for audit logging in NestJS?
21How do you set up Mongoose in a NestJS application and define a schema?
22How do you handle Mongoose transactions for multi-document atomic operations in NestJS?
23What is the repository pattern and why use it in NestJS?
24How do you handle database connection pooling and health checks in NestJS?
25How do you implement database read replicas in NestJS for read/write splitting with TypeORM?
08 / 25

How do you handle Prisma migrations in a CI/CD pipeline?

Difficulty: 5/10
Prisma migrations, CI/CD integration, NestJS

Use prisma migrate dev for local development — it creates migration files and applies them. Use prisma migrate deploy in CI/CD — it applies only pending migrations without modifying the schema or resetting data. Always commit migration files to version control.

Prisma migration commands for dev and production
Migration workflow rules:
  1. 1

    prisma migrate dev — development only; can reset the database on schema conflicts; never use in production.

  2. 2

    prisma migrate deploy — production and CI; applies only pending migrations; never destructive.

  3. 3

    Always commit migration SQL files to version control — they are the schema change history.

  4. 4

    Run prisma generate in CI after deploying to regenerate the typed Prisma Client.

  5. 5

    Use prisma migrate status in health checks to verify the database is in sync with the code.

Scenario Questions

0-2 years experience

  1. 1You have a NestJS project using Prisma. How would you add a step to your GitHub Actions workflow so that migrations run automatically on every push to the main branch?
  2. 2If a migration fails during the CI run, what output would you expect and what immediate steps would you take to fix it?
  3. 3Which Prisma CLI command would you use to generate a new migration locally and ensure it gets applied in the CI environment?

2-5 years experience

  1. 1During a feature rollout, a migration that adds a non‑null column without a default caused the CI pipeline to hang. How would you diagnose the problem and adjust the migration?
  2. 2You need to run Prisma migrations as part of a blue‑green deployment for a NestJS service. What trade‑offs do you consider and how would you orchestrate the migration steps?
  3. 3Why is using `prisma migrate dev` in a CI pipeline often discouraged, and which command would you prefer for production deployments?

5-8 years experience

  1. 1Our monorepo contains several NestJS microservices that share a Prisma schema. How would you design the CI/CD pipeline to apply migrations safely across all services without causing downtime?
  2. 2Migration execution is taking several minutes and slowing down our pipeline. What strategies could you employ to speed up migrations while preserving data integrity?
  3. 3Describe a robust rollback strategy for a failed Prisma migration in production and how you would integrate it into the CI/CD workflow.

8+ years experience

  1. 1Multiple teams maintain divergent Prisma schema versions. How would you architect a migration governance model and CI/CD process that lets teams release independently while avoiding schema conflicts?
  2. 2We anticipate moving away from Prisma to another ORM in the future. How would you design the current CI/CD pipeline to be future‑proof yet still handle Prisma migrations effectively today?
  3. 3Discuss the long‑term maintenance implications of embedding migration logic inside NestJS application code versus using a dedicated migration service, and how that choice shapes your CI/CD architecture.

Follow-up Questions

  • What logs or metrics would you watch to confirm a migration succeeded?
  • How would you handle a migration that introduces a breaking schema change?
  • Can you describe a rollback process if a migration fails in production?
Share

Share via WhatsApp, X, Facebook, LinkedIn or copy link. Open Graph preview enabled.