diff --git a/packages/builder/src/builderStore/store/backend.js b/packages/builder/src/builderStore/store/backend.js
index faf5b460f1..010e2ecde1 100644
--- a/packages/builder/src/builderStore/store/backend.js
+++ b/packages/builder/src/builderStore/store/backend.js
@@ -232,8 +232,9 @@ export const getBackendUiStore = () => {
return state
})
},
- saveField: ({ originalName, field, primaryDisplay = false }) => {
+ saveField: ({ originalName, field, primaryDisplay = false, oneToMany = false }) => {
store.update(state => {
+ console.log(state)
// delete the original if renaming
// need to handle if the column had no name, empty string
if (originalName || originalName === "") {
@@ -248,6 +249,10 @@ export const getBackendUiStore = () => {
if (primaryDisplay) {
state.draftTable.primaryDisplay = field.name
}
+ // Set one-to-many
+ if (oneToMany) {
+ state.draftTable.oneToMany = field.name
+ }
state.draftTable.schema[field.name] = cloneDeep(field)
store.actions.tables.save(state.draftTable)
diff --git a/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte b/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte
index 084e28ed3f..ce5abeddce 100644
--- a/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte
+++ b/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte
@@ -24,6 +24,7 @@
let primaryDisplay =
$backendUiStore.selectedTable.primaryDisplay == null ||
$backendUiStore.selectedTable.primaryDisplay === field.name
+ let oneToMany = false;
let confirmDeleteDialog
let deletion
@@ -41,6 +42,7 @@
originalName,
field,
primaryDisplay,
+ oneToMany,
})
return state
})
@@ -150,7 +152,7 @@
bind:value={field.constraints.numericality.lessThanOrEqualTo} />
{:else if field.type === 'link'}