Fixed query formatting
This commit is contained in:
parent
21917fcfc6
commit
8874738f73
1 changed files with 10 additions and 11 deletions
|
@ -244,18 +244,17 @@ func (m *MSSQLDriver) ForeignKeyInfo(schema, tableName string) ([]bdb.ForeignKey
|
||||||
var fkeys []bdb.ForeignKey
|
var fkeys []bdb.ForeignKey
|
||||||
|
|
||||||
query := `
|
query := `
|
||||||
SELECT
|
SELECT ccu.constraint_name ,
|
||||||
ccu.constraint_name
|
ccu.table_name AS local_table ,
|
||||||
,ccu.table_name AS local_table
|
ccu.column_name AS local_column ,
|
||||||
,ccu.column_name AS local_column
|
kcu.table_name AS foreign_table ,
|
||||||
,kcu.table_name AS foreign_table
|
kcu.column_name AS foreign_column
|
||||||
,kcu.column_name AS foreign_column
|
|
||||||
FROM information_schema.constraint_column_usage ccu
|
FROM information_schema.constraint_column_usage ccu
|
||||||
INNER JOIN information_schema.referential_constraints rc
|
INNER JOIN information_schema.referential_constraints rc ON ccu.constraint_name = rc.constraint_name
|
||||||
ON ccu.constraint_name = rc.constraint_name
|
INNER JOIN information_schema.key_column_usage kcu ON kcu.constraint_name = rc.unique_constraint_name
|
||||||
INNER JOIN information_schema.key_column_usage kcu
|
WHERE ccu.table_schema = ?
|
||||||
ON kcu.constraint_name = rc.unique_constraint_name
|
AND ccu.constraint_schema = ?
|
||||||
WHERE ccu.table_schema = ? AND ccu.constraint_schema = ? AND ccu.table_name = ?
|
AND ccu.table_name =
|
||||||
`
|
`
|
||||||
|
|
||||||
var rows *sql.Rows
|
var rows *sql.Rows
|
||||||
|
|
Loading…
Reference in a new issue