Merge pull request #14860 from Budibase/BUDI-8774/delete-row-actions-when-unfetching-tables
Remove row actions when unfetching tables
This commit is contained in:
commit
c13613f75c
|
@ -9,6 +9,7 @@ import * as datasources from "./datasources"
|
||||||
import tableSdk from "../tables"
|
import tableSdk from "../tables"
|
||||||
import { getIntegration } from "../../../integrations"
|
import { getIntegration } from "../../../integrations"
|
||||||
import { context } from "@budibase/backend-core"
|
import { context } from "@budibase/backend-core"
|
||||||
|
import sdk from "../.."
|
||||||
|
|
||||||
function checkForSchemaErrors(schema: Record<string, Table>) {
|
function checkForSchemaErrors(schema: Record<string, Table>) {
|
||||||
const errors: Record<string, string> = {}
|
const errors: Record<string, string> = {}
|
||||||
|
@ -96,6 +97,15 @@ export async function buildSchemaFromSource(
|
||||||
const datasource = await datasources.get(datasourceId)
|
const datasource = await datasources.get(datasourceId)
|
||||||
|
|
||||||
const { tables, errors } = await buildFilteredSchema(datasource, tablesFilter)
|
const { tables, errors } = await buildFilteredSchema(datasource, tablesFilter)
|
||||||
|
|
||||||
|
const oldTables = datasource.entities || {}
|
||||||
|
const tablesToRemove = Object.keys(oldTables).filter(
|
||||||
|
t => !Object.keys(tables).includes(t)
|
||||||
|
)
|
||||||
|
for (const table of tablesToRemove) {
|
||||||
|
await sdk.rowActions.deleteAll(oldTables[table]._id!)
|
||||||
|
}
|
||||||
|
|
||||||
datasource.entities = tables
|
datasource.entities = tables
|
||||||
|
|
||||||
datasources.setDefaultDisplayColumns(datasource)
|
datasources.setDefaultDisplayColumns(datasource)
|
||||||
|
|
Loading…
Reference in New Issue