rubenv / sql-migrate

SQL schema migration tool for Go.
MIT License
3.23k stars 280 forks source link

PlanMigration returns error when no safe migration is possible #103

Closed ironsmile closed 6 years ago

ironsmile commented 6 years ago

As discussed in #43 and #85 there are problems when the database contains migrations which are not part of the current plan. Up to this PR sql-migrate was just ignoring such cases and hoped for the best.

The PR adds a new error type PlanError and uses it when a mismatch between the database migrations and the current source migrations is found. This way one would be able to ignore this error while using sql-migrate as a library if need be.

rubenv commented 6 years ago

Bit late to come back to this, but looks very good to me, thanks a lot!