prisma / docs

📚 Prisma Documentation
https://www.prisma.io/docs
Apache License 2.0
975 stars 763 forks source link

Strategy to avoid duplication in version controlling migrations #5053

Open tvvignesh opened 4 years ago

tvvignesh commented 4 years ago

Hi. In the microservices setup I have, so far, I have been having the migrations generated and kept along with my service code. But, to have better separation of concerns and have a proper CI/CD pipeline, I want to separate out the service as well as the database migrations to 2 repos.

The only problem I have is that, both the service and the database uses schema.prisma file. Service for running prisma2 generate and DB for running prisma2 migrate and thus, if I change the schema.prisma file, I have to change in 2 places leading to duplication and possible mistakes.

Is there any way to avoid this or any better strategy to separate it? With service in 1 repo and migrations in another repo with their own CI/CD pipelines.

tomhoule commented 3 years ago

Moving to prisma/prisma repo since this is a product question about schema modularity.

floelhoeffel commented 2 years ago

We believe this should be solved with tooling and probably we could have some best practices documented around that.