Skip to content

Conversation

@jhoward-lm
Copy link
Contributor

@jhoward-lm jhoward-lm commented Aug 6, 2024

Description

This PR adds an Annotations attribute to the Document schema. These are arbitrary key-value pairs.

However, special significance is given to a key named "alias" to make it unique for a given document ID.

All changes in this PR are auto-generated except the files in backends/ent/ and internal/backends/ent/schema/.

Miscellaneous

  • Change the relationship for NodeList --> Node from one-to-many to many-to-many, so that any node in the database can be contained in more than one node list
  • Remove unique constraint from Node schema id field, nodes are now uniquely identified by a composite primary key of node ID and node list ID

Signed-off-by: Jonathan Howard <jonathan.w.howard@lmco.com>
Signed-off-by: Jonathan Howard <jonathan.w.howard@lmco.com>
Signed-off-by: Jonathan Howard <jonathan.w.howard@lmco.com>
Signed-off-by: Jonathan Howard <jonathan.w.howard@lmco.com>
@jhoward-lm jhoward-lm self-assigned this Aug 6, 2024
@jhoward-lm jhoward-lm requested review from enifsieus and removed request for enifsieus August 7, 2024 13:24
Signed-off-by: Jonathan Howard <jonathan.w.howard@lmco.com>
@jhoward-lm
Copy link
Contributor Author

@houdini91 Feel free to review as well, I just couldn't find your name in the reviewers

@fkautz
Copy link

fkautz commented Aug 14, 2024

Note From meeting: Alias is a human readable name that the user can assign in the database. So instead of a query on the document id you can pull it up by a human readable name.

@jhoward-lm jhoward-lm requested a review from fkautz August 14, 2024 16:50
@jhoward-lm
Copy link
Contributor Author

@fkautz @eddiezane @puerco @houdini91 Need this reviewed and merged for a bomctl capability under development

Copy link
Member

@puerco puerco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, there is a small question below but feel free to merge it 🚀

Comment on lines +128 to +130
if backend.client == nil {
return nil, errUninitializedClient
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've noticed the transaction client get initialized on the fly while this one errs when undefined. Any reason for the inconsistency?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The transactional client is currently only used for batching create/update/delete operations so it can be safely rolled back before committing any changes. Read operations just use the regular client since nothing is being altered. The txClient function also starts off by running this check, so it seemed consistent to me

@jhoward-lm jhoward-lm merged commit 796210d into protobom:main Aug 27, 2024
@jhoward-lm jhoward-lm deleted the document-tags branch August 27, 2024 04:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants