Write relations directly as part of batch add / update of entities.

This implies a slight change of the CommonDatabase contract.

The huge LDAP dataset is now down to 10s to write, both on postgres and sqlite.
This commit is contained in:
Fredrik Adelöw
2020-12-13 15:03:39 +01:00
parent 5153e3eed9
commit 6b37c95bfb
6 changed files with 168 additions and 175 deletions
+26
View File
@@ -0,0 +1,26 @@
---
'@backstage/plugin-catalog-backend': minor
---
Write relations directly as part of batch add / update of entities.
Slight change of the `CommonDatabase` contract:
## `addEntity` removed
This method was unused by the core, and rendered unnecessary when `addEntities`
exists.
If you were a user of `addEntity`, please call `addEntities` instead, with an
array of one element.
## `DbEntityRequest` has a new field `relations`
This is the structure that is passed to `addEntities` and `updateEntity`. It
used to be the case that you needed to call `setRelations` separately, but now
this instead happens directly when you call `addEntities` or `updateEntity`.
If you were using `addEntities` or `updateEntity` directly, please adapt your
code to add the `relations` array to each request. If you were calling
`setRelations` separately next to these methods, you no longer need to do so,
after adding the relations to the `DbEntityRequest`s.