You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Version numbers and relations (Should object version increase when its relations change?) #35
My Article has one-to-many to Tag. The end-user application only considers the Article history state (so the fact that Tags have state too is invisible), and is able to revert or see all snapshots of the Article history. The Article state is considered to be changed when the article itself is changed, when tags are added/removed and when one of its existing tags is modified.
How can I go back to all Article history (and by that I want to include snapshots where only the Tags of the article were modified, not necessarily the article column's)? The revert(relations=['Tags'] produces very unexpected results based on the number of the Article versions and the number of each Tag's versions.
If one of my tags has more versions that the article for example, there is no way to use article.revert(relations=['Tags']) to go back to all states of that tag. How can I achieve this?
It would be nice to have an option like increment_version_on_relation_change.
The next version of Continuum has a plugin architecture where you could create a plugin for local versions. Also the new Activity plugin offers means for handling local histories.
I hacked a naive plugin that adds related by foreign key objects into the current versioning transaction. The code is not tested and probably contain bugs. It also probably contains assumptions that are only true in my models. There are no unit tests.
It would be nice if this limitation was at least explicitly mentioned in the documentation related to relationships, the last place I expected to have to look to find a (sort of) solution to what appears to be a bug is in the plugin section! Given that both versions and relationships are expressed in the object model itself, the changes to the relationships should certainly affect the version. It makes sense to expect that given the intent of abstracting the underlying tables to an object model. And it appears to be a bug as the version of the relationships themselves is being incremented (as visible in the database tables) but there is no obvious way to see the versions of a relationship, because you are expected to access them via the object property of the parent (and/or child).
@grakic plugin works great with some changes to fit our code
I hacked a naive plugin that adds related by foreign key objects into the current versioning transaction. The code is not tested and probably contain bugs. It also probably contains assumptions that are only true in my models. There are no unit tests.
Activity
dtheodor commentedon Jan 10, 2014
I would really like some feedback on this one by @kvesteri . Is the issue clear or should I describe it more in detail?
kvesteri commentedon Jan 12, 2014
This kind of functionality can be emulated with TransactionMeta. I'm going to update the docs for how to use it.
kvesteri commentedon Mar 13, 2014
The next version of Continuum has a plugin architecture where you could create a plugin for local versions. Also the new Activity plugin offers means for handling local histories.
alexandreyc commentedon Nov 28, 2016
Hello all, any news on incrementing object version when its relations change ? If no, is there any workaround documented ?
grakic commentedon Jan 23, 2017
I hacked a naive plugin that adds related by foreign key objects into the current versioning transaction. The code is not tested and probably contain bugs. It also probably contains assumptions that are only true in my models. There are no unit tests.
https://gist.github.com/grakic/66006440ed871c8b9d73a2206dff8a5e
From some simple playing in the shell, it looks like it is working. I will keep working on this as time permits.
billw2012 commentedon Nov 21, 2018
It would be nice if this limitation was at least explicitly mentioned in the documentation related to relationships, the last place I expected to have to look to find a (sort of) solution to what appears to be a bug is in the plugin section! Given that both versions and relationships are expressed in the object model itself, the changes to the relationships should certainly affect the version. It makes sense to expect that given the intent of abstracting the underlying tables to an object model. And it appears to be a bug as the version of the relationships themselves is being incremented (as visible in the database tables) but there is no obvious way to see the versions of a relationship, because you are expected to access them via the object property of the parent (and/or child).
davidchenfn commentedon May 16, 2019
@grakic plugin works great with some changes to fit our code