-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ability to populate history table with insert #22
Comments
Actually I don' even want to add |
Yes, it is possible. Actually, that was also my first idea of how to implement system versioning, but not how the people who wrote the SQL standard decided it should be implemented. I will see if I can come up with something over this weekend. |
You could take a look at chronomodel that uses similar approach: https://github.com/ifad/chronomodel They just version whole schema, not only a table, and it's not as integrated with postgres as temporal_tables |
This turned out to be more difficult than I expected, so I gave it up after some time. The worst thing about this approach is that when you insert a new record into the table and then update that record in the same transaction, you have to find the history record you inserted before in order to update it. So, you must have a unique constraint in the original table and the corresponding index (which includes the |
I might be late for the party, but doesn't table inheritance as described in readme solve the original problem? You'll get all records including current ones. |
I think the main point was to get rid of the |
Hey,
I'd like history table to contain all the data, not only modified rows. Would it be possible to add another parameter to temporal_tables, so even an INSERT to original table creates a row in history table?
The text was updated successfully, but these errors were encountered: