Live data from Hacker News

Hassle-Free Database Migrations with Prisma Migrate

prisma.io

11–20 of 28 posts

Re: Hassle-Free Database Migrations with Prisma Migrate

#11
post #9
post #6

What I need from migrations is collaboration. When I make a schema migration locally and push it to the repository, then 3 other PRs with their own migrations are being merged before mine, it is very likely that my local database will be in the wrong state. Correct me if I'm wrong, but using an ORM (be it Django, Prisma, liquibase, ...) to handle your migrations will only generate the SQL queries for you, it won't ha…

EF 6 had an interesting take on this problem. If two migrations had the same parent (aka we both branched and added a migration), whoever merged second would have to generate a "merge" migration to resolve the conflict. It wasn't the most elegant solution, or even a solution period, but it made the problem explicit. This happened because the full schema model was serialized and encoded into the migration journal tabl…

This is the actual model of git.

You try to push on a remote after somebody else, you have to create a merge commit.

But it would be nice to have a rebase to keep linearity in your history.

Re: Hassle-Free Database Migrations with Prisma Migrate

#13
Migrations as a service? I feel like I'm going crazy here. It's like we're moving to microservices for not just deployment but our development, but its even worse because now not only does everything have to cross network boundaries, it crosses corporate boundaries. How does anybody expect to write software that lasts when your whole app is dependent on 15 different service providers not selling out and screwing you over to get their VC payday?

Re: Hassle-Free Database Migrations with Prisma Migrate

#14

Migrations as a service? I feel like I'm going crazy here. It's like we're moving to microservices for not just deployment but our development, but its even worse because now not only does everything have to cross network boundaries, it crosses corporate boundaries. How does anybody expect to write software that lasts when your whole app is dependent on 15 different service providers not selling out and screwing you…

More like "Database as a service with integrated tooling for migrations".

Prisma (and Prisma Migrate) can be self hosted, so no corporate boundaries needs to be crossed.

They can run on the same host as your application, so the only overhead is on the loopback interface (localhost).

The SaaS solutions for a young business who does not have the time/skill/resources to deploy/maintain the infrastructure are great.

You should always consider the pros/cons before choosing between a managed or self-hosted solution. And once you scale, you can always go for the self-hosted solution.

Re: Hassle-Free Database Migrations with Prisma Migrate

#15

Migrations as a service? I feel like I'm going crazy here. It's like we're moving to microservices for not just deployment but our development, but its even worse because now not only does everything have to cross network boundaries, it crosses corporate boundaries. How does anybody expect to write software that lasts when your whole app is dependent on 15 different service providers not selling out and screwing you…

Nikolas from the Prisma team here. Could you elaborate what you mean with "as a service" in this context exactly?

Prisma Migrate is entirely open source and works via a CLI. My understanding of "X as a service" typically includes some web service layer which is why I have a hard time following what you mean with your comment exactly.

Re: Hassle-Free Database Migrations with Prisma Migrate

#16
This looks similar to Django's migration system. There you change your model, and issue a "makemigrations"-command. Django then automatically generates python code that you run to change your database to sync with your model. You can commit that file and get it under version control. It has support for history merges so that it works collaboratively.

More details here: https://docs.djangoproject.com/en/3.1/topics/migrations/

Re: Hassle-Free Database Migrations with Prisma Migrate

#17
post #14

Migrations as a service? I feel like I'm going crazy here. It's like we're moving to microservices for not just deployment but our development, but its even worse because now not only does everything have to cross network boundaries, it crosses corporate boundaries. How does anybody expect to write software that lasts when your whole app is dependent on 15 different service providers not selling out and screwing you…

More like "Database as a service with integrated tooling for migrations". Prisma (and Prisma Migrate) can be self hosted, so no corporate boundaries needs to be crossed. They can run on the same host as your application, so the only overhead is on the loopback interface (localhost). The SaaS solutions for a young business who does not have the time/skill/resources to deploy/maintain the infrastructure are great. You…

> Prisma (and Prisma Migrate) can be self hosted, so no corporate boundaries needs to be crossed.

Just to clarify: Prisma is an open-source ORM [1] that's available via an npm package, so there really isn't a component that needs to be "hosted" here. (You might be referring to Prisma 1 which came with its own DB proxy server that was run via Docker, but Prisma 2 [2] doesn't have this Docker container any more and is "just" an npm library).

[1] https://github.com/prisma/prisma

[2] https://www.prisma.io/blog/announcing-prisma-2-n0v98rzc8br1

Re: Hassle-Free Database Migrations with Prisma Migrate

#18
post #14

Earlier quoted context omitted.

More like "Database as a service with integrated tooling for migrations". Prisma (and Prisma Migrate) can be self hosted, so no corporate boundaries needs to be crossed. They can run on the same host as your application, so the only overhead is on the loopback interface (localhost). The SaaS solutions for a young business who does not have the time/skill/resources to deploy/maintain the infrastructure are great. You…

> Prisma (and Prisma Migrate) can be self hosted, so no corporate boundaries needs to be crossed. Just to clarify: Prisma is an open-source ORM [1] that's available via an npm package, so there really isn't a component that needs to be "hosted" here. (You might be referring to Prisma 1 which came with its own DB proxy server that was run via Docker, but Prisma 2 [2] doesn't have this Docker container any more and is…

Yes I was referring to Prisma 1, never looked in details to Prisma 2 because we moved to Hasura before Prisma 2 got released.

I loved Prisma 1, and probably would love Prisma 2 too, but Hasura was enabling us to query already existing databases without rewriting the schema (and having to maintain it), which was a necessity at the time.

Re: Hassle-Free Database Migrations with Prisma Migrate

#20
post #18

Earlier quoted context omitted.

> Prisma (and Prisma Migrate) can be self hosted, so no corporate boundaries needs to be crossed. Just to clarify: Prisma is an open-source ORM [1] that's available via an npm package, so there really isn't a component that needs to be "hosted" here. (You might be referring to Prisma 1 which came with its own DB proxy server that was run via Docker, but Prisma 2 [2] doesn't have this Docker container any more and is…

Yes I was referring to Prisma 1, never looked in details to Prisma 2 because we moved to Hasura before Prisma 2 got released. I loved Prisma 1, and probably would love Prisma 2 too, but Hasura was enabling us to query already existing databases without rewriting the schema (and having to maintain it), which was a necessity at the time.

Ah I see, that makes a lot of sense, thanks for clarifying :) Prisma 2 actually is quite different compared to Prisma 1 as there's no native GraphQL layer any more and it's now pretty much "just an ORM".
Post reply on HN