Skip to content

Version numbers and relations (Should object version increase when its relations change?) #35

Closed as not planned

Description

@dtheodor

I have a problem with the following use-case:

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.

Activity

  1. dtheodor commented on Jan 10, 2014

    @dtheodor
    ContributorAuthor

    I would really like some feedback on this one by @kvesteri . Is the issue clear or should I describe it more in detail?

  2. kvesteri commented on Jan 12, 2014

    @kvesteri
    Collaborator

    This kind of functionality can be emulated with TransactionMeta. I'm going to update the docs for how to use it.

  3. kvesteri commented on Mar 13, 2014

    @kvesteri
    Collaborator

    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.

  4. alexandreyc commented on Nov 28, 2016

    @alexandreyc

    Hello all, any news on incrementing object version when its relations change ? If no, is there any workaround documented ?

  5. grakic commented on Jan 23, 2017

    @grakic
    Contributor

    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.

  6. billw2012 commented on Nov 21, 2018

    @billw2012

    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).

  7. davidchenfn commented on May 16, 2019

    @davidchenfn

    @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.

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions