diff --git a/packages/builder/.gitignore b/packages/builder/.gitignore
index e5c961d509..acd1a70579 100644
--- a/packages/builder/.gitignore
+++ b/packages/builder/.gitignore
@@ -5,4 +5,4 @@ package-lock.json
release/
dist/
routify
-.routify/
\ No newline at end of file
+.routify/
diff --git a/packages/builder/src/builderStore/store/frontend.js b/packages/builder/src/builderStore/store/frontend.js
index a567caf87f..a4729b4a8a 100644
--- a/packages/builder/src/builderStore/store/frontend.js
+++ b/packages/builder/src/builderStore/store/frontend.js
@@ -580,7 +580,7 @@ export const getFrontendStore = () => {
let table = validTables.find(table => {
return (
table.sourceId !== BUDIBASE_INTERNAL_DB_ID &&
- table.type === DB_TYPE_INTERNAL
+ table.sourceType === DB_TYPE_INTERNAL
)
})
if (table) {
@@ -591,7 +591,7 @@ export const getFrontendStore = () => {
table = validTables.find(table => {
return (
table.sourceId === BUDIBASE_INTERNAL_DB_ID &&
- table.type === DB_TYPE_INTERNAL
+ table.sourceType === DB_TYPE_INTERNAL
)
})
if (table) {
@@ -599,7 +599,7 @@ export const getFrontendStore = () => {
}
// Finally try an external table
- return validTables.find(table => table.type === DB_TYPE_EXTERNAL)
+ return validTables.find(table => table.sourceType === DB_TYPE_EXTERNAL)
},
enrichEmptySettings: (component, opts) => {
if (!component?._component) {
diff --git a/packages/builder/src/components/backend/DataTable/RelationshipDataTable.svelte b/packages/builder/src/components/backend/DataTable/RelationshipDataTable.svelte
index 8ef870caca..4e67a92443 100644
--- a/packages/builder/src/components/backend/DataTable/RelationshipDataTable.svelte
+++ b/packages/builder/src/components/backend/DataTable/RelationshipDataTable.svelte
@@ -16,7 +16,6 @@
$: linkedTable = $tables.list.find(table => table._id === linkedTableId)
$: schema = linkedTable?.schema
$: table = $tables.list.find(table => table._id === tableId)
- $: type = table?.type
$: fetchData(tableId, rowId)
$: {
let rowLabel = row?.[table?.primaryDisplay]
@@ -41,5 +40,5 @@
{#if row && row._id === rowId}
-
+
{/if}
diff --git a/packages/builder/src/components/backend/DataTable/TableDataTable.svelte b/packages/builder/src/components/backend/DataTable/TableDataTable.svelte
index 5fee849afb..8dd685e766 100644
--- a/packages/builder/src/components/backend/DataTable/TableDataTable.svelte
+++ b/packages/builder/src/components/backend/DataTable/TableDataTable.svelte
@@ -16,6 +16,7 @@
import GridRelationshipButton from "components/backend/DataTable/buttons/grid/GridRelationshipButton.svelte"
import GridEditColumnModal from "components/backend/DataTable/modals/grid/GridEditColumnModal.svelte"
import GridUsersTableButton from "components/backend/DataTable/modals/grid/GridUsersTableButton.svelte"
+ import { DB_TYPE_EXTERNAL } from "constants/backend"
const userSchemaOverrides = {
firstName: { displayName: "First name", disabled: true },
@@ -27,7 +28,7 @@
$: id = $tables.selected?._id
$: isUsersTable = id === TableNames.USERS
- $: isInternal = $tables.selected?.type !== "external"
+ $: isInternal = $tables.selected?.sourceType !== DB_TYPE_EXTERNAL
$: gridDatasource = {
type: "table",
tableId: id,
@@ -46,10 +47,7 @@
tables.replaceTable(id, e.detail)
// We need to refresh datasources when an external table changes.
- // Type "external" may exist - sometimes type is "table" and sometimes it
- // is "external" - it has different meanings in different endpoints.
- // If we check both these then we hopefully catch all external tables.
- if (e.detail?.type === "external" || e.detail?.sql) {
+ if (e.detail?.sourceType === DB_TYPE_EXTERNAL) {
await datasources.fetch()
}
}
diff --git a/packages/builder/src/components/backend/DataTable/ViewDataTable.svelte b/packages/builder/src/components/backend/DataTable/ViewDataTable.svelte
index f6160e3caa..bdf62f2959 100644
--- a/packages/builder/src/components/backend/DataTable/ViewDataTable.svelte
+++ b/packages/builder/src/components/backend/DataTable/ViewDataTable.svelte
@@ -17,7 +17,6 @@
let hideAutocolumns = true
let data = []
let loading = false
- let type = "internal"
$: name = view.name
$: calculation = view.calculation
@@ -65,7 +64,6 @@
tableId={view.tableId}
{data}
{loading}
- {type}
rowCount={10}
allowEditing={false}
bind:hideAutocolumns
diff --git a/packages/builder/src/components/backend/DataTable/buttons/grid/GridImportButton.svelte b/packages/builder/src/components/backend/DataTable/buttons/grid/GridImportButton.svelte
index 71d971891c..74e255cf7e 100644
--- a/packages/builder/src/components/backend/DataTable/buttons/grid/GridImportButton.svelte
+++ b/packages/builder/src/components/backend/DataTable/buttons/grid/GridImportButton.svelte
@@ -10,6 +10,6 @@
diff --git a/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte b/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte
index 467ae413c3..d5a9aba488 100644
--- a/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte
+++ b/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte
@@ -26,6 +26,7 @@
ALLOWABLE_NUMBER_TYPES,
SWITCHABLE_TYPES,
PrettyRelationshipDefinitions,
+ DB_TYPE_EXTERNAL,
} from "constants/backend"
import { getAutoColumnInformation, buildAutoColumn } from "builderStore/utils"
import ConfirmDialog from "components/common/ConfirmDialog.svelte"
@@ -254,10 +255,11 @@
!uneditable &&
editableColumn?.type !== AUTO_TYPE &&
!editableColumn.autocolumn
- $: external = table.type === "external"
+ $: externalTable = table.sourceType === DB_TYPE_EXTERNAL
// in the case of internal tables the sourceId will just be undefined
$: tableOptions = $tables.list.filter(
- opt => opt.type === table.type && table.sourceId === opt.sourceId
+ opt =>
+ opt.sourceType === table.sourceType && table.sourceId === opt.sourceId
)
$: typeEnabled =
!originalName ||
@@ -409,7 +411,7 @@
editableColumn.type === FieldType.BB_REFERENCE &&
editableColumn.subtype === FieldSubtype.USERS
- if (!external) {
+ if (!externalTable) {
return [
FIELDS.STRING,
FIELDS.BARCODEQR,
@@ -441,7 +443,7 @@
isUsers ? FIELDS.USERS : FIELDS.USER,
]
// no-sql or a spreadsheet
- if (!external || table.sql) {
+ if (!externalTable || table.sql) {
fields = [...fields, FIELDS.LINK, FIELDS.ARRAY]
}
return fields
@@ -486,7 +488,7 @@
})
}
const newError = {}
- if (!external && fieldInfo.name?.startsWith("_")) {
+ if (!externalTable && fieldInfo.name?.startsWith("_")) {
newError.name = `Column name cannot start with an underscore.`
} else if (fieldInfo.name && !fieldInfo.name.match(ValidColumnNameRegex)) {
newError.name = `Illegal character; must be alpha-numeric.`
@@ -498,7 +500,7 @@
newError.name = `Column name already in use.`
}
- if (fieldInfo.type == "auto" && !fieldInfo.subtype) {
+ if (fieldInfo.type === "auto" && !fieldInfo.subtype) {
newError.subtype = `Auto Column requires a type`
}
diff --git a/packages/builder/src/components/backend/TableNavigator/ExistingTableDataImport.svelte b/packages/builder/src/components/backend/TableNavigator/ExistingTableDataImport.svelte
index 43751ad944..eb1e7bc7ff 100644
--- a/packages/builder/src/components/backend/TableNavigator/ExistingTableDataImport.svelte
+++ b/packages/builder/src/components/backend/TableNavigator/ExistingTableDataImport.svelte
@@ -1,6 +1,6 @@