srcshelton / myway

Enhanced MySQL-targeted Flyway alternative
0 stars 0 forks source link

Migration failures when attempting to migrate from databases with old/legacy metadata schema #3

Closed srcshelton closed 8 years ago

srcshelton commented 8 years ago

When running against already initialised databases (where myway_version_history.init_string has 'INIT' value), the script is not able to succesfully migrate the database to the new schema format.

Interim fix is to run with OLDSCHEMA=1.

srcshelton commented 8 years ago

OLDSCHEMA is a debug option, and should not be used.

There are a few bugs outstanding in the myway.pl migration code (a few more now fixed and being tested in integration than currently in master!) but it's now much improved.

Known failures are:

I'm tempted to remove all of the inference currently used and simply perform more time-consuming but direct checks of the current state of the schema, and migrate as appropriate...

srcshelton commented 8 years ago

(... although the current implementation is intended to support many migrations over time as necessary and the current code attempts to handle any number of generic upgrades - this is good. What's needed is a way to tell the difference between a fresh new installation and a fresh legacy installation without specific knowledge of the exact changes entailed in the migration process)

Originally, we did CREATE TABLE IF NOT EXISTS ... followed immediately by INSERT IGNORE ... to load the current schema version. This broke when the table actually did exist, and was then updated erroneously to indicate that it was of the current standard. We're now only setting the metadata as current once we've checked the schemata state, but hit the edge-case above on otherwise empty databases.

srcshelton commented 8 years ago

Should be fixed by 94083a7, but leaving open for now in case there are further edge-cases are found...

srcshelton commented 8 years ago

Final call for any update on this issue, otherwise closing shortly...

srcshelton commented 8 years ago

No failures encountered, closing.