Open aryanprince opened 1 year ago
Made some progress with this issue, I set up a Docker Compose script so we can just run that to spin up a quick Postgres database for local development. This means we won't have to mess with our production data during development.
What do you think?
Script rn:
This creates a Postgres container we can connect to in our ENV file:
Thing is, now we only have 1 database that's used in production and during local development.
Ideally we would have a setup like this:
.env
file only contains connection URL to thedev
databaseprod
databaseemail
column toStudent
table - I would typeprisma migrate dev -name "Added email column"
and this would create anemail
column only ondev
database. Theprod
database would remain unchanged.main
branch on GitHub (directly or PR)prisma migrate deploy
and that's it -email
field will show up onprod
database too...ONLY after we've actually made a push to GitHub. Until then,email
column only exists ondev
database.PS: Although we can run
prisma migrate deploy
locally, it's best to useprisma migrate dev
on our local machine and instead useprisma migrate deploy
only on our CI/CD pipeline.You can read more about this on: https://www.prisma.io/docs/guides/deployment/deploy-database-changes-with-prisma-migrate
What I Want Us To Do
.env
toprod
and update our local.env
to our newdev
databaseprisma migrate deploy
command on new changes tomain
branch