4 ms·
Alternatively, you can automate this with triggers, where the client only needs to know about the entity table, but all updates to an entity cause the previous
by iaabtpbtpnn 9y ago
Alternatively, you can automate this with triggers, where the client only needs to know about the entity table, but all updates to an entity cause the previous value to be inserted into another table entity_log. We do this and it works well for us.
- ComodoHacker 9y agoThe whole point of storing history is ability for clients to explicitly query it (and sometimes manipulate it), isn't it?
- renesd 9y agoYou can query a history table.
- ComodoHacker 9y agoNot if "client only needs to know about the entity table"
- Twisell 9y agoSo If you need to give history access to your client I guess you can put up a "entity_history" function that will generate a snapshot entity table from his request and the log table. It all depend on your need, RDMS schema are customely build to meet customers needs, I don't believe in proverbial Swiss knife tool anymore.
- fanf2 9y agoSee also the Temporal Tables extension to PostgreSQL https://github.com/arkhipov/temporal_tables https://github.com/arkhipov/temporal_tables