That's correct. But in order to know which attributes a relationship has, we need that relationship_attribute table. That way we don't have to query for each possible attribute
That's going to be important down the line when we have more attributes
matterharz has quit
akashgp09
. > But in order to know which attributes a relationship has, we need that relationship_attribute table. That way we don't have to query for each possible attribute
If i am not wrong the same thing can also be achieved using only the `relationship_attribute_text_value`
monkey
OK, let me think it over again
akashgp09
Will it be better if i push my code ? you can have a look it yourself by running the models and tests
monkey
I guess it's more about trying to anticipate what the attributes will be used for in the future, so no rush to push the code if you're not ready
akashgp09
yep Okay : )
matterharz joined the channel
monkey can you give some light on the min, max column on the table `relationship_type_attribute_type`
monkey
akashgp09: while reviewing the schema for relationship attributes I realized we're missing something to track when a relationship attribute has changed. This is necessary with our revision system.
Say I change an item in a series from position "1" to position "2", how do we then record that as a revision change? How do we compare the two revisions? Sorry I missed that earlier; there are more changes needed to the schema.
We do indeed need that `relationship_attribute` with a few changes.
We are missing is a `relationship_attribute_set` table (similar to the relationship_set or alias_set tables) along with a `relationship_attribute_set__relationship_attribute` table (which links between rel_attr_set and rel_attr).
A new column on the `relationship` table will point to a relationship_attribute_set id.
Together they describe what attribute(s) a relationship has: relationship #123 has attribute_set #234 which contains relationship_attributes #456 and #567.
If one of the rel_attributes changes, we create a new rel_attribute and a new rel_attribute_set and in turn a new relationship and a new relationship_set.
That way we record all changes without losing any information and eventually we can revert revisions to a previous state.
With these changes we do not link the relationship id to the `relationship_attribute_text_value`` anymore. Instead we use FKs to get the text_value associated with a specific `relationship_attribute` that belongs to a `relationship_attribute_set`
And to answer your question, I'll admit I still haven't wrapped my head around what the min/max columns on `relationship_type_attribute_type` will be used for, and we might end up dropping them.
I need to read some of the musicbrainz server code and figure that out.
The MB schema docs say this: "The link_type_attribute_type table […] specifies how many instances of the attribute (or one of its children) can be added to the particular [relationship] type in the min and max fields." I have still to fully understand how/if that will transfer to BookBrainz.
reosarevok
monkey: the min-max will be needed if you have stuff where you need to select one or more of X. In MB it's stuff like instruments, which I guess doesn't translate to BB
I'd still suggest rather keep it in the schema and not use it yet than risk needing to schema change it in later, but dunno, maybe it just doesn't apply to books at all :)
monkey
Thanks :) That's where I got to, trying to figure out if there would be a need for it in BB, but can't think of a good example. I was also on the "better have it and not use it than…" train.
A story written under different pseudonyms over time, maybe?
Can't really think of a clear-cut example.
CatQuest
what exact thing is them in-max thing?
i mightthink of something
akashgp09
Okay monkey thank you for the suggestions, will look into this : )
monkey
Lots of flip-flopping on all this, I know it's making your job harder, so sorry about that :p
CatQuest
like one or more of x, one or more of x liek what? an example in musicbrainz?
I'm *certain* there could be an use for something
even if our model doesn't even scope for that *now* it maybe in scope 10, 15 20 years from now
monkey
CatQuest: An example in MB: an artist is a member of a band and plays multiple instruments in the band.