Merge branch 'master' into fix/user-column-search-mapping
This commit is contained in:
commit
7934e984cc
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"version": "2.11.12",
|
"version": "2.11.13",
|
||||||
"npmClient": "yarn",
|
"npmClient": "yarn",
|
||||||
"packages": [
|
"packages": [
|
||||||
"packages/*"
|
"packages/*"
|
||||||
|
|
|
@ -308,12 +308,19 @@ class LinkController {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
// remove schema from other table
|
try {
|
||||||
let linkedTable = await this._db.get<Table>(field.tableId)
|
// remove schema from other table, if it exists
|
||||||
if (field.fieldName) {
|
let linkedTable = await this._db.get<Table>(field.tableId)
|
||||||
delete linkedTable.schema[field.fieldName]
|
if (field.fieldName) {
|
||||||
|
delete linkedTable.schema[field.fieldName]
|
||||||
|
}
|
||||||
|
await this._db.put(linkedTable)
|
||||||
|
} catch (error: any) {
|
||||||
|
// ignore missing to ensure broken relationship columns can be deleted
|
||||||
|
if (error.statusCode !== 404) {
|
||||||
|
throw error
|
||||||
|
}
|
||||||
}
|
}
|
||||||
await this._db.put(linkedTable)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -233,4 +233,19 @@ describe("test the link controller", () => {
|
||||||
}
|
}
|
||||||
await config.updateTable(table)
|
await config.updateTable(table)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it("should be able to remove a linked field from a table, even if the linked table does not exist", async () => {
|
||||||
|
await createLinkedRow()
|
||||||
|
await createLinkedRow("link2")
|
||||||
|
table1.schema["link"].tableId = "not_found"
|
||||||
|
const controller = await createLinkController(table1, null, table1)
|
||||||
|
await context.doInAppContext(appId, async () => {
|
||||||
|
let before = await controller.getTableLinkDocs()
|
||||||
|
await controller.removeFieldFromTable("link")
|
||||||
|
let after = await controller.getTableLinkDocs()
|
||||||
|
expect(before.length).toEqual(2)
|
||||||
|
// shouldn't delete the other field
|
||||||
|
expect(after.length).toEqual(1)
|
||||||
|
})
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue