Everything Java Apache Geospatial Open Source. Hello Shinning Stars!!! Vincent Massol, Raphael Luta, Santiago Gala, Carsten Z.

Wednesday, November 03, 2004

How can a database model implement versioning of data? Flags perhaps, though not the best solution. Meta data seems to be the key. Each table maintains the following meta data. DATE_CREATED, DATE_CANCELLED, DATE_UPDATED, DATE_EXPORTED, DATE_VALIDATED (The last two implement export functions telling us when data was exported and when this data was validated by some authority), DATE_START, DATE_END (Dates that indicate a period during which the date is valid).

Inserting a version :

DATE_CANCELLED is initialized to the end of time for us that is the 31st of December 9999.
DATE_CREATED and DATE_UPDATED are set to SYSTIME
DATE_EXPORTED, DATE_VALIDATED is initialized to the beginning of time for us that is the 1st of January 1972.

Deleting versions set DATE_CANCELLED and DATE_UPDATED to the system time.

Senario 1 : (DCR, DCA, DUP, DEX, DVA, DST, DEN are abriviations for the above meta data)

t0 t1 t2 t3 t4 t5 t6
|------------------------------------------------> Version one was inserted at time t1, so version one has the following values.

DCR, DCA, DUP, DEX, DVA, DST, DEN
t1, te, t1, tb, tb, t0, t6

No comments: