-
-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error "Checksum failed for migration ..." when upgrading from 3.1.0 to latest #78
Comments
Is it possible that migrations need to be "read-only" and this commit mutates the migration that is failing? 34f1d2a By read-only, I mean migrations should run ONCE, in a predetermined order (I assume that's what the date prefix is for). |
I guess it's easy enough to test this theory by updating another migration and see if it also fails. |
@dianabarsan, yes the problem is the one you mention. I think the approach I'll take to fix it is:
|
Note that if I move the change to a new SQL script and rolling back the original content, it should works for new Postgres databases and it should works for existent databases created with older versions of medic-couch2pg , but not for Postgres databases that were created with the version that introduced the bug (v3.2.0, last version), because in that case the md5 sum will be the one computed with the edited version. A solution to the problem could be check the md5 sum stored in the database, and only if the "edited" md5 sum is found in the database, patch it, and then run the migrations. |
Another path:
The cons is that we don't have to change one more time a file that is supposedly immutable, and it is easier to implement. |
@mrsarm |
@nomulex |
I can confirm that we do not have any project running medic-couch2pg@3.2.0 |
Thanks @nomulex and @dianabarsan , In this case, I'll rollback the change in a patch release, and maybe leave a new section "Known issues" pointing to this issue an the following SQL script to run against the Postgres database in case somebody did start a fresh database with medic-couch2pg 3.2.0: UPDATE xmlforms_migrations SET md5 = 'e0535c9fe3faef6e66a31691deebf1a8'
WHERE version = '201606200952' AND md5 = '40187aa5ee95eda0e154ecefd7512cda'; |
Ready for AT, branch Summarizing, the PR rollbacks the last changes in the 3.2.0 migration scripts and adds a new migration script that applies the same changes in a new change-set. Despite the many SQL instructions the script has, the only real change is that a new column So the scenarios to tests are:
NOTE: in my local test moving data from a small local medic DB in CouchDB to Postgres using medic-couch2pg, I couldn't see any value in the new column ``contactview_metadata.contact_type`, but the field didn't exist at the source so it's OK to not see any value in Postgres, and I don't know how to populate that field to check. |
LGTM. Thanks @mrsarm for your help in getting
NOTE |
Merged changes to master and closing the ticket, @garethbowen I think we are ready for a patch release. |
This error was reported here, and I could confirm the error in my local environment migrating a small database, so we will keep track of the solution in this.
When you have a Postgres database created and maintained with medic-couch2pg 3.1.0, and the you try to run medic-couch2pg 3.2.0 over the same database, the process is exited with the following error:
CC @nomulex @garethbowen
The text was updated successfully, but these errors were encountered: