rubenv / sql-migrate

SQL schema migration tool for Go.
MIT License
3.19k stars 275 forks source link

Support timestamp 'versions' by falling back to string comparison when to VersionInts() are equal #25

Closed larsmoa closed 8 years ago

larsmoa commented 8 years ago

Currently, the two following migrations are considered to have the same version:

20160126_1100_migration1.sql
20160126_1200_migration2.sql

This happens because only the first number in the ID string is used for comparion, i.e. 20160126 for both migrations. The patch fixes this by falling back to string comparsion when Migration.VersionInt() returns the same version for two migrations.

Also, generalize temporary filename used for migration_test.go by using ioutil.TempFile() to create one.

rubenv commented 8 years ago

Cool, thanks!

Sorry for taking this long to merge.