Skip to content

Commit

Permalink
Fix ordering migrations for select last batch
Browse files Browse the repository at this point in the history
  • Loading branch information
ShkrutDenis committed Apr 9, 2020
1 parent 7816979 commit 9bf9c0f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion model/migration.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func GetLastBatch(connection *sqlx.DB) int {

func GetLastMigrations(connection *sqlx.DB, lastBatch int) []*Migration {
var list []*Migration
_ = connection.Select(&list, "SELECT * FROM migrations WHERE batch=? ORDER BY created_at DESC;", lastBatch)
_ = connection.Select(&list, "SELECT * FROM migrations WHERE batch=? ORDER BY created_at DESC, id DESC;", lastBatch)
return list
}

Expand Down

0 comments on commit 9bf9c0f

Please sign in to comment.