Skip to content

How to efficiently query for a subset of required fields #363

Answered by collerek
johnthagen asked this question in Q&A
Discussion options

You must be logged in to vote

This one is quite tricky -> cause if you want to have multiple models operating on one table and each of them has different required columns you would end up with some of the models that should be read only.

Cause if you insert a row without columns that are required by the other model you wouldn't be able to read this row with another model as the data would be corrupted (required columns would be null).

The other solution is that each model is still storing the data in the same table, but each row is "marked" as one of the models, so the data is stored in the same table but rows are actually separated and operates on their own rows only.

Both of those scenarios are kinds of inheritance …

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@johnthagen
Comment options

@collerek
Comment options

@johnthagen
Comment options

Answer selected by johnthagen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants