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 { getIntegration } from "../../../integrations"
|
||||
import { context } from "@budibase/backend-core"
|
||||
import sdk from "../.."
|
||||
|
||||
function checkForSchemaErrors(schema: Record<string, Table>) {
|
||||
const errors: Record<string, string> = {}
|
||||
|
@ -96,6 +97,15 @@ export async function buildSchemaFromSource(
|
|||
const datasource = await datasources.get(datasourceId)
|
||||
|
||||
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
|
||||
|
||||
datasources.setDefaultDisplayColumns(datasource)
|
||||
|
|
Loading…
Reference in New Issue