Skip to content

Commit

Permalink
fix(db): SQLite3 dialects return empty rows in HasColumn method
Browse files Browse the repository at this point in the history
  • Loading branch information
HFO4 committed Feb 12, 2023
1 parent 835605a commit 37cb292
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion models/dialects/dialect_sqlite.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ func (s sqlite) HasTable(tableName string) bool {

func (s sqlite) HasColumn(tableName string, columnName string) bool {
var count int
s.db.QueryRow(fmt.Sprintf("SELECT count(*) FROM sqlite_master WHERE tbl_name = ? AND (sql LIKE '%%\"%v\" %%' OR sql LIKE '%%%v %%');\n", columnName, columnName), tableName).Scan(&count)
s.db.QueryRow(fmt.Sprintf("SELECT count(*) FROM sqlite_master WHERE tbl_name = ? AND (sql LIKE '%%\"%v\" %%' OR sql LIKE '%%%v %%');", columnName, columnName), tableName).Scan(&count)
return count > 0
}

Expand Down

0 comments on commit 37cb292

Please sign in to comment.