Browse Source
Merge pull request #5073 from Budibase/fix/5049
Fixing an issue with many-to-many SQL relationships generated in SQL tables
master
Michael Drury
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
3 additions and
3 deletions
-
packages/server/src/api/controllers/table/external.js
|
|
@ -118,8 +118,8 @@ function generateManyLinkSchema(datasource, column, table, relatedTable) { |
|
|
}, |
|
|
}, |
|
|
} |
|
|
} |
|
|
column.through = junctionTable._id |
|
|
column.through = junctionTable._id |
|
|
column.throughFrom = primary |
|
|
column.throughFrom = relatedPrimary |
|
|
column.throughTo = relatedPrimary |
|
|
column.throughTo = primary |
|
|
column.fieldName = relatedPrimary |
|
|
column.fieldName = relatedPrimary |
|
|
return junctionTable |
|
|
return junctionTable |
|
|
} |
|
|
} |
|
|
@ -146,7 +146,7 @@ function generateRelatedSchema(linkColumn, table, relatedTable, columnName) { |
|
|
// is many to many
|
|
|
// is many to many
|
|
|
else { |
|
|
else { |
|
|
// don't need to copy through, already got it
|
|
|
// don't need to copy through, already got it
|
|
|
relatedSchema.fieldName = linkColumn.throughFrom |
|
|
relatedSchema.fieldName = linkColumn.throughTo |
|
|
relatedSchema.throughTo = linkColumn.throughFrom |
|
|
relatedSchema.throughTo = linkColumn.throughFrom |
|
|
relatedSchema.throughFrom = linkColumn.throughTo |
|
|
relatedSchema.throughFrom = linkColumn.throughTo |
|
|
} |
|
|
} |
|
|
|