Skip to content

Conversation

iderdik
Copy link

@iderdik iderdik commented Mar 25, 2015

When redeploying an older version of the app, the database is left in it's newest state, even if the older application expects an older version of the database.

To rollback when an older version of the app is deployed, we must:

  • Insert the "down" portion of the script into the database when the initial "up" migration is performed because the older app will not have the sql file embedded in it!
  • On "up" migrations, compare the database to the new list of migrations in the MigrationSource. Any extra migrations in the database need to be rolled back.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be a problem, anyone who is currently using sql-migrate won't have this column in their migrations table.

We've come at the sad point that we'll need to migrate the migrations table, but we have no way of doing so.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ugh, that's a good point. I'll try to add something that detects an older database and migrate it but that feels "off", especially since package is meant to migrate databases!

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm. What if we store the DownSql in a separate new table? Does that let us avoid compatibility issues?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants