I am developing a database schema for a video production project management application and struggling with how to preserve some embedded but not repeatable data. In several CS courses that I took, part of normalizing the relational database was identifying duplicate blocks and encapsulating them in their own table. What should I do if I have a block of embedded / nested data, which, as I know, can be unique for writing?
Example. There are many shoot_locations video shoot_locations . These places are likely to never be repeated. shoot_locations may also contain multiple shoot_times . A representation of this in JSON might look like this:
{ video: { shoot_locations: [ { name: "Bob Pony Shack", address: "99 Horseman Street, Anywhere, US 12345", shoot_times: { shoot_at: "2015-08-15 21:00:00", ... } }, { name: "Jerry Tackle", address: "15 Pike Place, Anywhere, US 12345", shoot_times: { shoot_at: "2015-08-16 21:00:00" ... } } ], ... } }
Options...
- save
shoot_locations in JSON field (available in MySQL 5.7.8?) - Create a separate table for the data.
- something else?
It seems to me that I should split the embedded data into my own tables and save JSON for non-critical metadata.
Summary
What is the best option for storing non-duplicate embedded data?
source share