From dd1b57159ac1d2a61595b08608b401cb525fbf0c Mon Sep 17 00:00:00 2001 From: Andrew Kumanyaev Date: Thu, 23 Apr 2020 17:25:33 +0300 Subject: [PATCH] fix: Quote `id` column as it described in dialect definition --- migrate.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/migrate.go b/migrate.go index 03f3d51e..ded76175 100644 --- a/migrate.go +++ b/migrate.go @@ -707,7 +707,7 @@ func (ms MigrationSet) GetMigrationRecords(db *sql.DB, dialect string) ([]*Migra } var records []*MigrationRecord - query := fmt.Sprintf("SELECT * FROM %s ORDER BY id ASC", dbMap.Dialect.QuotedTableForQuery(ms.SchemaName, ms.getTableName())) + query := fmt.Sprintf("SELECT * FROM %s ORDER BY %s ASC", dbMap.Dialect.QuotedTableForQuery(ms.SchemaName, ms.getTableName()), dbMap.Dialect.QuoteField("id")) _, err = dbMap.Select(&records, query) if err != nil { return nil, err