Difference between revisions of "Next Generation Schema/Advanced Relationships Table Structure"

From MusicBrainz Wiki
(Advanced Relationships Table Structure: correct based on IRC discussion)
(Advanced Relationships Table Structure)
Line 1: Line 1:
 
===Advanced Relationships Table Structure===
 
===Advanced Relationships Table Structure===
 
[[Image:ngs-ars.png|left|frameless|500px]]  
 
[[Image:ngs-ars.png|left|frameless|500px]]  
The main table is ''link''.  It contains the begin and end date info, and the '''link_type''' foreign key field that specifies what kind of AR it is.  It also has a count of how many other attributes that particular link has in the '''attributecount''' field.
+
The main table is ''link''.  It contains the begin and end date info, and the '''link_type''' foreign key field that specifies what kind of AR it is.  It also has a count of how many other attributes that particular link has in the '''attribute_count''' field, and a '''created''' field that specifies when it was created.
  
 
There are tables for every possible combination of primary entities (artist, label, recording, release, release_group, url, work), all prefixed with ''l_'' and all with the same format. Four of them are shown in the diagram above.  They contain a field, '''modpending''' that is a count of pending changes to the AR, and three foreign keys: '''link''' that points back to the associated entry in the ''link'' table, and '''entity0''' and '''entity1''' that point to the associated entry in the corresponding primary entity table (i.e. '''artist''', '''recording''', '''url''', etc.).
 
There are tables for every possible combination of primary entities (artist, label, recording, release, release_group, url, work), all prefixed with ''l_'' and all with the same format. Four of them are shown in the diagram above.  They contain a field, '''modpending''' that is a count of pending changes to the AR, and three foreign keys: '''link''' that points back to the associated entry in the ''link'' table, and '''entity0''' and '''entity1''' that point to the associated entry in the corresponding primary entity table (i.e. '''artist''', '''recording''', '''url''', etc.).

Revision as of 08:32, 14 September 2011

Advanced Relationships Table Structure

ngs-ars.png

The main table is link. It contains the begin and end date info, and the link_type foreign key field that specifies what kind of AR it is. It also has a count of how many other attributes that particular link has in the attribute_count field, and a created field that specifies when it was created.

There are tables for every possible combination of primary entities (artist, label, recording, release, release_group, url, work), all prefixed with l_ and all with the same format. Four of them are shown in the diagram above. They contain a field, modpending that is a count of pending changes to the AR, and three foreign keys: link that points back to the associated entry in the link table, and entity0 and entity1 that point to the associated entry in the corresponding primary entity table (i.e. artist, recording, url, etc.).