diff --git a/packages/builder/src/utilities/backend/index.js b/packages/builder/src/builderStore/utils.js
similarity index 94%
rename from packages/builder/src/utilities/backend/index.js
rename to packages/builder/src/builderStore/utils.js
index 464b25f5d3..a95ba3a601 100644
--- a/packages/builder/src/utilities/backend/index.js
+++ b/packages/builder/src/builderStore/utils.js
@@ -1,10 +1,10 @@
-import { TableNames } from "../../constants"
+import { TableNames } from "../constants"
import {
AUTO_COLUMN_DISPLAY_NAMES,
AUTO_COLUMN_SUB_TYPES,
FIELDS,
isAutoColumnUserRelationship
-} from "../../constants/backend"
+} from "../constants/backend"
export function getAutoColumnInformation(enabled = true) {
let info = {}
@@ -52,4 +52,4 @@ export function buildAutoColumn(tableName, name, subtype) {
base.fieldName = `${tableName}-${name}`
}
return base
-}
\ No newline at end of file
+}
diff --git a/packages/builder/src/components/backend/DataTable/DataTable.svelte b/packages/builder/src/components/backend/DataTable/DataTable.svelte
index b0a1c0fdfe..505bfeb6d9 100644
--- a/packages/builder/src/components/backend/DataTable/DataTable.svelte
+++ b/packages/builder/src/components/backend/DataTable/DataTable.svelte
@@ -13,10 +13,9 @@
import CreateEditUser from "./modals/CreateEditUser.svelte"
import CreateEditRow from "./modals/CreateEditRow.svelte"
+ let hideAutocolumns
let data = []
let loading = false
- let hideAutocolumns
-
$: isUsersTable = $backendUiStore.selectedTable?._id === TableNames.USERS
$: title = $backendUiStore.selectedTable.name
$: schema = $backendUiStore.selectedTable.schema
@@ -52,10 +51,12 @@
modalContentComponent={isUsersTable ? CreateEditUser : CreateEditRow} />
-
+ {#if isUsersTable}
+
+ {/if}
+
+
{/if}
- {#if isUsersTable}
-
- {/if}
+
diff --git a/packages/builder/src/components/backend/DataTable/buttons/HideAutocolumnButton.svelte b/packages/builder/src/components/backend/DataTable/buttons/HideAutocolumnButton.svelte
index ec8c85da62..79fbb15b54 100644
--- a/packages/builder/src/components/backend/DataTable/buttons/HideAutocolumnButton.svelte
+++ b/packages/builder/src/components/backend/DataTable/buttons/HideAutocolumnButton.svelte
@@ -13,10 +13,11 @@
-
{#if hideAutocolumns}
+
Show Auto Columns
{:else}
+
Hide Auto Columns
{/if}
diff --git a/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte b/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte
index eba5a99e87..811c005fca 100644
--- a/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte
+++ b/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte
@@ -17,7 +17,7 @@
import {
getAutoColumnInformation,
buildAutoColumn,
- } from "utilities/backend"
+ } from "builderStore/utils"
import { notifier } from "builderStore/store/notifications"
import ValuesList from "components/common/ValuesList.svelte"
import DatePicker from "components/common/DatePicker.svelte"
diff --git a/packages/builder/src/components/backend/TableNavigator/modals/CreateTableModal.svelte b/packages/builder/src/components/backend/TableNavigator/modals/CreateTableModal.svelte
index cba0cb02cd..abc53d9813 100644
--- a/packages/builder/src/components/backend/TableNavigator/modals/CreateTableModal.svelte
+++ b/packages/builder/src/components/backend/TableNavigator/modals/CreateTableModal.svelte
@@ -6,10 +6,10 @@
import TableDataImport from "../TableDataImport.svelte"
import analytics from "analytics"
import screenTemplates from "builderStore/store/screenTemplates"
+ import { buildAutoColumn, getAutoColumnInformation } from "builderStore/utils"
import { NEW_ROW_TEMPLATE } from "builderStore/store/screenTemplates/newRowScreen"
import { ROW_DETAIL_TEMPLATE } from "builderStore/store/screenTemplates/rowDetailScreen"
import { ROW_LIST_TEMPLATE } from "builderStore/store/screenTemplates/rowListScreen"
- import { buildAutoColumn, getAutoColumnInformation } from "utilities/backend"
const defaultScreens = [
NEW_ROW_TEMPLATE,
diff --git a/packages/server/src/db/linkedRows/LinkController.js b/packages/server/src/db/linkedRows/LinkController.js
index 54a0bfdd58..d202c07d63 100644
--- a/packages/server/src/db/linkedRows/LinkController.js
+++ b/packages/server/src/db/linkedRows/LinkController.js
@@ -259,14 +259,18 @@ class LinkController {
} catch (err) {
continue
}
- // create the link field in the other table
- linkedTable.schema[field.fieldName] = {
+ const linkConfig = {
name: field.fieldName,
type: FieldTypes.LINK,
// these are the props of the table that initiated the link
tableId: table._id,
fieldName: fieldName,
}
+ if (field.autocolumn) {
+ linkConfig.autocolumn = field.autocolumn
+ }
+ // create the link field in the other table
+ linkedTable.schema[field.fieldName] = linkConfig
const response = await this._db.put(linkedTable)
// special case for when linking back to self, make sure rev updated
if (linkedTable._id === table._id) {
diff --git a/packages/server/src/db/linkedRows/linkUtils.js b/packages/server/src/db/linkedRows/linkUtils.js
index c07c17eda7..fba12aec0b 100644
--- a/packages/server/src/db/linkedRows/linkUtils.js
+++ b/packages/server/src/db/linkedRows/linkUtils.js
@@ -1,7 +1,6 @@
const CouchDB = require("../index")
const Sentry = require("@sentry/node")
const { ViewNames, getQueryIndex } = require("../utils")
-const { FieldTypes } = require("../../constants")
/**
* Only needed so that boolean parameters are being used for includeDocs