normalizing common id form common opposing tables


this simplified chronicle problem.



we have business send us lots information following query it. mandatory have several "public" ids query the information by. (most wish query the component around id send along data, nonetheless always). simplicity, we'll "pid", "crid" "musicbrainzid". have an "entity" list stores information. looks something (the "authority" sent data):



entity 
--
entity_id
authority // sent data
type // 'pid', 'crid', 'musicbrainz', etc.
value // tangible id value


then have removed entities such "episode", "series" "broadcast" (actually, there's lot more, nonetheless i'm retaining rudimentary here). any an entity_id indicating entity table.



how outmost business search, around pid crid suitable part series, along repremand marker is? given pid, fetch entity id, nonetheless following need hunt episode, array foster tables value. further, ids indispensably associated tables, nonetheless any entity (e.g., an "episode") competence have several ids (pid, crid, etc.)



strategies:




  1. find entity id pid hunt each list pid.

  2. put an "entity_type" buttress entity, nonetheless it's pid part list nonetheless incidentally set episode.type series? don't wish register information i don't wish put database metadata buttress values.



option array 1 delayed seems wrong (further, several tables have opposite structures origination problematic).



option 2 means register information data out synch. triggers force this, nonetheless seems unequivocally nasty and, any event, bugs doing mysql triggers have strike us several times. we're controlling plan right now, nonetheless but triggers.



what's choice 3?



side note: know need smack "authority" out removed list since authority/type combinations valid.



Comments

Popular posts from this blog

list macos calm editors formula editors

how hibernate @any-related annotations?

using mvc, should hoop communication between views? between models?