Apply Hasura migrations on current database pipeline #6469
Replies: 4 comments
-
Also, if we try to migrate to a fresh db and Hasura instance... We get this error.
|
Beta Was this translation helpful? Give feedback.
-
Very interested in a solution to this issue. |
Beta Was this translation helpful? Give feedback.
-
This may not be the most proper answer, but here are some of the steps I use for my migrations.
2 things I've seen:
After the initial creation I usually edit the migrations much less frequently (usually just to ensure that migrations and concise and the down.sql looks good). In the end though, migrations are just a system for managing applying sql (up), rolling back (down), and checking status. They're mainly SQL scripts, not too much magic - definitley safe to edit. |
Beta Was this translation helpful? Give feedback.
-
@mm-io suggestions are pretty much the way to go about it. I saw in the Discord channel that @adventurini was struggling with this issue for a few days and I took a look at his servers. There were basically two issues:
I will outline here the steps that I took to migrate the state of his
If this command return errors you need to manually edit the
Now the Those are the steps to apply the migrations and metadata from one Hasura server into another. Just note that the errors faced in the I hope this is clear and can help someone else that has similar issues. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I have three databases - dev, staging, and prod. There are 50+ tables and 10+ functions on these databases. They have a diff between them.
I ran
hasura migrate create
to get my up migrations.Then I run,
hasura migrate apply --endpoint STAGING_ENDPOINT --admin-secret STAGING_SECRET
I get a really long error that says the tables already exist. There is really nothing in the docs that explain this situation well. I have literally wiped my metadata, migrations, and entire dev database trying to get it to work. Luckily, I had created backups just in case.
I have also tried to start on a completely new Database from Heroku. I created the same steps, but the new error says that none of the tables exist.
What are the steps for bringing your own databases to apply migrations / metadata to all of them, so that the database pipeline works properly?
Beta Was this translation helpful? Give feedback.
All reactions