Type checks pass.

This commit is contained in:
Sam Rose 2024-11-26 17:09:32 +00:00
parent c35e443225
commit 8e756ccf84
No known key found for this signature in database
2 changed files with 6 additions and 15 deletions

View File

@ -7,6 +7,7 @@ import {
Table,
TableSourceType,
SqlClient,
EnrichedQueryJson,
} from "@budibase/types"
import { sql } from "@budibase/backend-core"
import { join } from "path"
@ -35,8 +36,8 @@ describe("Captures of real examples", () => {
const relationshipLimit = 500
const primaryLimit = 100
function getJson(name: string): QueryJson {
return require(join(__dirname, "sqlQueryJson", name)) as QueryJson
function getJson(name: string) {
return require(join(__dirname, "sqlQueryJson", name)) as EnrichedQueryJson
}
describe("create", () => {
@ -252,9 +253,6 @@ describe("Captures of real examples", () => {
resource: {
fields,
},
meta: {
table: TABLE,
},
}
}

View File

@ -241,19 +241,12 @@ export async function save(
}
const operation = tableId ? Operation.UPDATE_TABLE : Operation.CREATE_TABLE
await makeTableRequest(
datasource,
operation,
tableToSave,
tables,
oldTable,
opts?.renaming
)
await makeTableRequest(datasource, operation, tableToSave, opts?.renaming)
// update any extra tables (like foreign keys in other tables)
for (let extraTable of extraTablesToUpdate) {
const oldExtraTable = oldTables[extraTable.name]
let op = oldExtraTable ? Operation.UPDATE_TABLE : Operation.CREATE_TABLE
await makeTableRequest(datasource, op, extraTable, tables, oldExtraTable)
await makeTableRequest(datasource, op, extraTable)
}
// make sure the constrained list, all still exist
@ -292,7 +285,7 @@ export async function destroy(datasourceId: string, table: Table) {
const operation = Operation.DELETE_TABLE
if (tables) {
await makeTableRequest(datasource, operation, table, tables)
await makeTableRequest(datasource, operation, table)
cleanupRelationships(table, tables, { deleting: true })
delete tables[table.name]
datasource.entities = tables