Skip to content

Commit

Permalink
Fix postgres' HasForeignKey
Browse files Browse the repository at this point in the history
  • Loading branch information
vibhavp committed Apr 11, 2016
1 parent 5174cc5 commit e38e096
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion dialect_postgres.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit e38e096

Please sign in to comment.