Skip to content

Commit

Permalink
Relax the definition of unique on columns (mysql)
Browse files Browse the repository at this point in the history
- Fix #77
  • Loading branch information
aarondl committed Jan 4, 2017
1 parent dd73656 commit 23b6221
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion bdb/drivers/mysql.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,8 @@ func (m *MySQLDriver) Columns(schema, tableName string) ([]bdb.Column, error) {
inner join information_schema.key_column_usage kcu
on tc.constraint_name = kcu.constraint_name and tc.table_name = kcu.table_name and tc.table_schema = kcu.table_schema
where c.column_name = kcu.column_name and tc.table_name = c.table_name and
(tc.constraint_type = 'PRIMARY KEY' or tc.constraint_type = 'UNIQUE')
(tc.constraint_type = 'PRIMARY KEY' or tc.constraint_type = 'UNIQUE') and
(select count(*) from information_schema.key_column_usage where constraint_name = tc.constraint_name) = 1
) as is_unique
from information_schema.columns as c
where table_name = ? and table_schema = ?;
Expand Down

0 comments on commit 23b6221

Please sign in to comment.