question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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.

Issue Analytics

  • State:open
  • Created 10 years ago
  • Reactions:1
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
grakiccommented, 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.

0reactions
davidchenfncommented, May 16, 2019

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Versions aren't created when owned relations are updated #195
When writing a relation that is owned by a versioned DataObject, a new version is not created. There's a few ways this can...
Read more >
Version Control: A Good Practice Guide - University of Glasgow
Version control is the process by which different drafts and versions of a document or record are managed. It is a tool which...
Read more >
Version Class (System) | Microsoft Learn
Represents the version number of an assembly, operating system, or the common language runtime. This class cannot be inherited.
Read more >
API design: Which version of versioning is right for you?
Learn the two different techniques of API versioning so you can decide how and when to use each.
Read more >
Configuration Management: Revision or version?
For instance, changing an item's lifecycle phase from prototype to production may not represent any change to the item's design or production documentation,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found