From a7d9f119f124ca49c8f43ea6b4df2bc7fe540e99 Mon Sep 17 00:00:00 2001 From: Christian Michallek Date: Tue, 18 Jun 2024 11:51:27 +0200 Subject: [PATCH] fix: using quotes instead of renaming the 'rows' keyword --- database/seed.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/database/seed.go b/database/seed.go index 3ea3e1c..ef49a73 100644 --- a/database/seed.go +++ b/database/seed.go @@ -23,21 +23,21 @@ func MustApplyDatabaseSeed(file string, db *gorm.DB, excludedTables ...[]string) applySeedCheckSQL := ` SELECT - SUM(TABLE_ROWS) AS rows2 + SUM(TABLE_ROWS) AS 'rows' FROM information_schema.TABLES WHERE TABLE_SCHEMA = ? AND TABLE_NAME NOT IN ? ` result := struct { - Rows2 uint64 + Rows uint64 }{} statement := db.Raw(applySeedCheckSQL, db.Migrator().CurrentDatabase(), excludedTablesInSQL) if err := statement.Scan(&result).Error; err != nil { panic(fmt.Errorf("failed to check whether seed should be applied: %w", err)) } - if result.Rows2 > 0 { + if result.Rows > 0 { return }