From e38e096ca0b5ecf9d1dd6029efcfd0705077505c Mon Sep 17 00:00:00 2001 From: Vibhav Pant Date: Mon, 11 Apr 2016 18:48:39 +0530 Subject: [PATCH] Fix postgres' HasForeignKey --- dialect_postgres.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dialect_postgres.go b/dialect_postgres.go index 09ac5961..51911656 100644 --- a/dialect_postgres.go +++ b/dialect_postgres.go @@ -89,7 +89,7 @@ func (s postgres) HasIndex(tableName string, indexName string) bool { func (s postgres) HasForeignKey(tableName string, foreignKeyName string) bool { var count int - s.db.QueryRow("SELECT count(con.conname) FROM pg_constraint con WHERE $1::regclass::oid = con.conrelid AND con.conname = $2 AND con.contype='f'", s.currentDatabase(), foreignKeyName).Scan(&count) + s.db.QueryRow("SELECT count(con.conname) FROM pg_constraint con WHERE $1::regclass::oid = con.conrelid AND con.conname = $2 AND con.contype='f'", tableName, foreignKeyName).Scan(&count) return count > 0 }