How to store meta-data on columns

前端 未结 9 606
死守一世寂寞
死守一世寂寞 2020-12-28 09:31

Let\'s say you\'re collecting insider info on upcoming superhero movie releases and your main Movie table looks something like this:

Table 1

9条回答
  •  清歌不尽
    2020-12-28 10:14

    Interesting scenario. You could get around the EAV ghetto-ness by thinking about your entities as first class objects; let's call them Facts. And it helps that you're pretty orthogonal in this case, in that every movie has the exact same four facts. Your EAV table can be your pristine/correct table, and then you can have an outside process that mines that table and replicates the data into a properly normalized form (i.e. your first table). This way you have the data you want, with its meta data, and, you have an easy way to query for movie information, accurate to how often your mining process runs.

    I think you definitely need some "out-of-database" muscle to make sure the data remains valid, since there doesn't seem to be any in-database way of maintaining integrity across your regular and EAV tables. I guess with a complex series of triggers you can pretty much accomplish anything, but one human administrator who "gets" your problem is probably much easier to handle.

提交回复
热议问题