1
0
Fork 0
mirror of synced 2024-09-08 21:51:58 +12:00

Fixing a mis-match of fields when creating many-to-many relationships on tables from within Budibase - #5049.

This commit is contained in:
mike12345567 2022-03-24 13:59:46 +00:00
parent 643d8017f5
commit 0b6a69b9c5

View file

@ -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
} }