Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decide whether ids need to be globally unique or not #31

Closed
jrudolph opened this issue Jun 24, 2024 · 4 comments
Closed

Decide whether ids need to be globally unique or not #31

jrudolph opened this issue Jun 24, 2024 · 4 comments

Comments

@jrudolph
Copy link
Contributor

Since all entities share the same entity log, right now entity ids need to be unique across all entity types. Either the queries could be improved not to make this assumption (add another WHERE clause everywhere) or this assumption needs to be documented.

@hseeberger
Copy link
Owner

Hmm ... so change UNIQUE (entity_id, version) to UNIQUE (entity_id, type_name, version)?

@jrudolph
Copy link
Contributor Author

Hmm ... so change UNIQUE (entity_id, version) to UNIQUE (entity_id, type_name, version)?

Yes that, and also add an extra constraint on the type to all queries.

@jrudolph
Copy link
Contributor Author

I actually already ran into this problem because you can just load the entity of a certain id with the wrong entity type and it will happily recover that entity (which somewhat likely fails during deserializing the wrong event types but might not depending on lucky circumstances).

@jrudolph
Copy link
Contributor Author

jrudolph commented Jul 4, 2024

Done in #38.

@jrudolph jrudolph closed this as completed Jul 4, 2024
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

No branches or pull requests

2 participants