josegonzalez / cakephp-version

CakePHP3: plugin that facilitates versioned database entities
MIT License
51 stars 22 forks source link

Associated table and find specific datetime #51

Open braguzz opened 1 month ago

braguzz commented 1 month ago

Hi, I have this situation, I'd like to version two tables

Procedures Specifics

Procedures has many Specifics

When I change something in a Procedure, all related specifics should point to last version.

When I change a Procedure last version should point to the specific.

I have to retrieve a procedure and its specific at a given a datetime (I mean I'd love to retrieve that procedure and specific at that datetime).

It is possible? It's the right plugin?

jeremyharris commented 1 month ago

Hi! I'm not sure I fully understand your use case, but in general the way this plugin works is transparent to your queries. Versions are saved in the background for later reference, but you will always query against the latest data (the current version).

If you change a Procedure it does not affect its Specifics. Likewise if you change a single Specific, it does not change the version of the Procedure or other Specifics. Updating those records only saves the old version (before the changes) into its version table.

If this doesn't answer your question, could you reply with some more information and maybe a more concrete example?