Making sure that keys cannot be duplicated for primary keys, this wouldn't have any function.
This commit is contained in:
parent
6648e548c5
commit
ede0a5ec9b
|
@ -163,7 +163,7 @@ module MySQLModule {
|
|||
)
|
||||
for (let column of descResp) {
|
||||
const columnName = column.Field
|
||||
if (column.Key === "PRI") {
|
||||
if (column.Key === "PRI" && primaryKeys.indexOf(column.Key) === -1) {
|
||||
primaryKeys.push(columnName)
|
||||
}
|
||||
const constraints = {
|
||||
|
|
|
@ -147,7 +147,11 @@ module PostgresModule {
|
|||
if (!tableKeys[tableName]) {
|
||||
tableKeys[tableName] = []
|
||||
}
|
||||
tableKeys[tableName].push(table.column_name || table.primary_key)
|
||||
const key = table.column_name || table.primary_key
|
||||
// only add the unique keys
|
||||
if (key && tableKeys[tableName].indexOf(key) === -1) {
|
||||
tableKeys[tableName].push(key)
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
tableKeys = {}
|
||||
|
|
Loading…
Reference in New Issue