Migrate: Dirty Database Troubleshooting Docs

Created on 13 Feb 2020  路  3Comments  路  Source: golang-migrate/migrate

Is your feature request related to a problem? Please describe.
In working through learning how to use this migration tool, I ran into an issue where I wrote some silly SQL with a syntax error, resulting in me getting this error upon rerunning the migrations after fixing the SQL syntax issues - error: Dirty database version 0. Fix and force version. Maybe I have not exhaustively searched the docs for the answer on how to troubleshoot this, but looking around made me think some troubleshooting steps for this issue should be present in the FAQ. For me specifically, I am unsure how to "force a version"

Describe the solution you'd like
I think the docs should be updated to include some more explicit troubleshooting for this issue. I'm suggesting an addition to the FAQ near the explanation of what a dirty database means.

Describe alternatives you've considered
If this already exists in the docs, please point me there. I still think, however, that this information could be better surfaced to folks browsing the repo if it is already available.

Most helpful comment

I remember I also needed to check out closed issues on github to figure out how migrate force works. It is pretty well described in https://github.com/golang-migrate/migrate/issues/282, hope this will help you

All 3 comments

Yeah, the docs aren't very well organized. Any help you can offer to clean up the docs would be greatly appreciated!

Some options include updating GETTING_STARTED and/or FAQ to mention the migrate force CLI and migrate.Migrate.Force()

See also: https://github.com/golang-migrate/migrate/issues/40

I remember I also needed to check out closed issues on github to figure out how migrate force works. It is pretty well described in https://github.com/golang-migrate/migrate/issues/282, hope this will help you

Fixed in #361
Thanks @mknycha for helping others with this issue and for the PR!

Was this page helpful?
0 / 5 - 0 ratings