Implement deletion
This commit is contained in:
parent
f2e46863f6
commit
7b0419773c
|
@ -267,6 +267,8 @@ export async function destroy(ctx: UserCtx) {
|
|||
const datasource = await sdk.datasources.get(datasourceId)
|
||||
// Delete all queries for the datasource
|
||||
|
||||
await sdk.rowActions.deleteAllForDatasource(datasourceId)
|
||||
|
||||
if (datasource.type === dbCore.BUDIBASE_DATASOURCE_TYPE) {
|
||||
await destroyInternalTablesBySourceId(datasourceId)
|
||||
} else {
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
export * from "./crud"
|
||||
export * from "./utils"
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
import sdk from "../../../sdk"
|
||||
|
||||
export async function deleteAllForDatasource(datasourceId: string) {
|
||||
const allTables = await sdk.tables.getAllTables()
|
||||
const tables = allTables.filter(t => t.sourceId === datasourceId)
|
||||
for (const table of Object.values(tables)) {
|
||||
await sdk.rowActions.deleteAll(table._id!)
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue