wasp-lang / wasp

The fastest way to develop full-stack web apps with React & Node.js.
https://wasp-lang.dev
MIT License
13.92k stars 1.19k forks source link

Support data migrations & provide best practices and examples #330

Open matijaSos opened 3 years ago

matijaSos commented 3 years ago

While developing Waspello, at some point I wanted to migrate data in my db. I added pos field to List entity so I wanted to assign a default pos value to each existing List, otherwise the changed schema wouldn't fit with the present data.

I wasn't sure how to do it - should I connect to my Postgres db and do it from there, or write a script which uses Prisma SDK? I ended up deleting all the data and started fresh. But I would love to have a portion of the docs which explains the best practices and examples on this. We should make sure that we exposed everything that is necessary for developer to do this.

Martinsos commented 2 years ago

It is especially important to provide a good migration workflow and docs for production! Issue #215 is related to this.

Martinsos commented 1 month ago

User here mentioning having a bit hard time with db migrations: https://discord.com/channels/686873244791210014/1297209606749032491/1297796805836279879

eah I think we'd all benefit from a database migration document I'll work on writing something as well - I actually have been running into snags as well, for example I change something in my schema.prisma, i push to prod and expect the GitHub action to run the migration, but it doesn't pick the migration up. I've had to delete my app to pick up the migration, which is curious - I've looked at my logs and see there are conflicts, so maybe it is just my problem