I am still experimenting with a native SQL data storage. I can generate a schema from the JSON description of the various genealogical objects (Person, Event, Family, …).
Until now, I postponed management of dates.
In the JSON schemas, dates are inserted via Date.get_schema() which embeds the Date schema in the “outer” JSON, e.g. a Date is fully duplicated inside an Event as a subschema.
I have then two options:
- do the same, i.e. duplicate the Date COLUMNs in every TABLE using a Date
This simply requires an adaptation of serialize() and unserialize() methods.
- create a separate table for dates and replace the Date columns by a handle
The aforementioned methods need also to be adapted but it probably simplifies reloading and saving dates.
The second option eventually suggests that Date records may be shared between several genealogical objects. Does this make sense? Are there contexts in which several records are so intimately related that they in fact make a single “meta-record” and a single date for them all is meaningful?
If the answer is “no”, both options are open. Which would be the best from a logical point of view or implementation robustness (fault tolerance, inconsistencies in records, …)?