Conversation
|
Is there an easy way to test this by inserting it into an existing project? In the meantime, I tried manually running the commands that the For create, it looks like prisma still demands a I had been thinking it might also be nice to have an option on During dev, just using Even if you need to at some point the manual |
|
@pc-erin this feature has been publicly released as part of |
|
I created a migration file in dev. Had to backup the database and then import it again in dev. In production, when i try to deploy the database, it tells me tables already created. Couldn't figure out how to do it. Ended up backing up database, import to dev, and then export and import into production. Only way i can update the schema in production for now. |
This pull request adds
keystone migrate createandkeystone migrate apply. #9090 didn't satisfy the workflow that I wanted when it came to creating migrations. Unfortunatelykeystone prisma migrate dev --create-onlystill asks you to reset your database. That need not be the DX, so myself and @molomby discussed a number of different workflows to try and help some developers with a few common scenarios.If you don't need to think about migrations, or migrations aren't relevant to you for a time, then you should continue using
keystone devas usual.If you need to rebase on some work, and that work has migrations; you probably want to apply the migrations to your work.
To apply migrations,
keystone migrate applywill ask you to RESET your local database. After rebasing and migrating, you continue usingkeystone dev [--db-push]. Your workflow will probably be something like the following:If you don't want to reset your local database when applying the migrations, then you are in a situation that is pretty difficult to generalise about. We recommend you use Prisma yourself, potentially leveraging
prisma migrate resolveas needed. Your workflow will probably be something like the following:Ready to write migrations?
If you have recently completed some local development, and now you're ready to write a migration for that work; you can now create a migration (similar to
keystone prisma migrate dev --create-only, but without the reset) usingkeystone migrate create. Your workflow will probably be something like the following:keystone migrate create # edit ... keystone migrate applyTo apply and test your migrations,
keystone migrate applywill ask you to RESET your local database.