From 9bf9c0f85e415873d94295c5c43e1ea377ebef07 Mon Sep 17 00:00:00 2001 From: Denis Shkrut Date: Thu, 9 Apr 2020 12:10:47 +0300 Subject: [PATCH] Fix ordering migrations for select last batch --- model/migration.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/model/migration.go b/model/migration.go index 490d43c..f8ae9c0 100644 --- a/model/migration.go +++ b/model/migration.go @@ -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 }