Skip to content

Commit

Permalink
fix(migrations): add order by clause
Browse files Browse the repository at this point in the history
Order by clause is required to keep migrations in same order when rolling back
  • Loading branch information
belozer authored and thetutlage committed Dec 5, 2016
1 parent 6888f51 commit 0d1b9de
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Migrations/Mixins/Migrate.js
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ Migrate._mapMigrationsToActions = function (migrationsList, direction) {
* @private
*/
Migrate._getMigratedFiles = function () {
return this.database.select('name').from(this.migrationsTable).pluck('name')
return this.database.select('name').from(this.migrationsTable).orderBy('name').pluck('name')
}

/**
Expand All @@ -261,6 +261,7 @@ Migrate._getFilesTillBatch = function (batch) {
.select('name')
.from(this.migrationsTable)
.where('batch', '>', batch)
.orderBy('name')
.pluck('name')
}

Expand Down

0 comments on commit 0d1b9de

Please sign in to comment.