rubenv / sql-migrate

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

Scripts not executing in order #89

Closed stephen-kruger closed 7 years ago

stephen-kruger commented 7 years ago

Anyone have any idea why the scripts appear to be executing out of order? After running an "up" which fails and then sql-migrate status -env="schema" I get the following very odd status :

+---------------------------------+-------------------------------+ | MIGRATION | APPLIED | +---------------------------------+-------------------------------+ | 000000001-bs.sql | no | | 000000002-cdata.sql | no | | 000000003-cdataau.sql | no | | 000000004-colorblindlist.sql | no | | 000000005-commission.sql | no | | 000000006-commons.sql | 2017-09-16 08:30:18 +0000 UTC | | 000000007-eligible_items.sql | 2017-09-16 08:30:18 +0000 UTC | | 000000008-flags_view.sql | 2017-09-16 08:30:18 +0000 UTC | | 000000009-orders.sql | no | | 000000010-items.sql | no | | 000000011-attention.sql | no | | 000000012-itemexpress.sql | no |

I am generating the migration scripts automatically, but I don't think there is anything out of order in my naming schema. Anyone have an idea?

stephen-kruger commented 7 years ago

I found the issue (stupid user error). My dbconfig .yaml was specifying a table and datasource db which were being manipulated by the migration scripts themselves.

So it leads me to a question : could sql-migrate not autocreate a db and schema based on the yaml config if it does not exist? If I specify non-existing values it generates an error.