So far, pgMemento does not enable hierarchical versioning where users can work in separate branches and merge different versions with each other. This is a feature, I had in mind since I've started the development. So, you can find some prerequisites here and there in the code.

  • There is only one global sequence for audit_ids. This would be useful to reference tuples accross separate branches.
  • Function pgmemento.move_table_state can be used to copy a whole schema. This sets the foundation for intitializing a branch. Probably I should use CREATE TABLE ... LIKE to copy also constraints, indexes, triggers etc.
  • There are a couple of functions to add constraints, indexes and sequences to a restored state (see next chapter).
  • Code from revert_transaction might be useful for merging changes (ergo logs) into another branch. But only, a yet to be developed replay API would open the door widely for hierarchical versioning.
  • The audit_tables VIEW was intended to help for switching the production state to a restored schema. With the improvements on reverting transaction, this idea has been dropped.