From 1ac3eedca10ad2fc7c78b7ecbcc9604b26de80b4 Mon Sep 17 00:00:00 2001 From: Nikola Kovacs Date: Tue, 22 Mar 2016 13:49:22 +0100 Subject: [PATCH] fix mysql HasForeignKey --- dialect_mysql.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dialect_mysql.go b/dialect_mysql.go index a6946d5c..6fade59d 100644 --- a/dialect_mysql.go +++ b/dialect_mysql.go @@ -99,7 +99,7 @@ func (s mysql) RemoveIndex(tableName string, indexName string) error { func (s mysql) HasForeignKey(tableName string, foreignKeyName string) bool { var count int - s.db.QueryRow("SELECT count(*) FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS WHERE CONSTRAINT_SCHEMA=? AND TABLE_NAME=? AND CONSTRAINT_NAME=? AND CONSTRAINT_TYPE='FOREIGN KEY'", s.currentDatabase(), foreignKeyName).Scan(&count) + s.db.QueryRow("SELECT count(*) FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS WHERE CONSTRAINT_SCHEMA=? AND TABLE_NAME=? AND CONSTRAINT_NAME=? AND CONSTRAINT_TYPE='FOREIGN KEY'", s.currentDatabase(), tableName, foreignKeyName).Scan(&count) return count > 0 }