mothership-ec / cog

Cog
Other
2 stars 3 forks source link

Run migrations in timestamp order #454

Closed thomasjthomasj closed 9 years ago

thomasjthomasj commented 9 years ago

This PR changes the way that the migrate:run command works so that instead of looping through the modules and running the migrations for that module, it loads all of the migrations and sorts them by filename (and therefore the unix timestamp) so that they run in chronological order. This prevents issues where a migration could rely on a table that hasn't yet been created.

In order to maintain BC, I have added a new method called runFromReferences() which takes an array of references. The original run() method gives the given reference parameter to runFromReferences() in an array