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.

custom Version models per model?

See original GitHub issue

Ahoy @etianen ,

I googled for a while and couldn’t find any information on that:

I was wondering if it would be helpful/clever/possible to create per model Version models, i.e.:

@reversion.register()
class Person(models.Model):
    ...

would yield a myapp_person_version table, or a reversion_myapp_person_version or similar. Or alternatively add a function argument to register() to pass in a different Version-model for specific models?

My reasoning here being that that single reversion_version table is gonna grow quite rapidly in my scenario and at least based on my naive database knowledge I think it would be helpful to be able to spit it into semantically seperated tables.

Cheers

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
etianencommented, Nov 14, 2019

Yes, you would lose historical data when you remove a field. However, if you’re not going to be migrating historical data, it rapidly becomes unparseable by the current version of the app. You’d have to make sure that your migrations are all reversible with no data loss. That way you can migrate your current and historical data back and forth.

A general-purpose solution for lossless, migrateable historical data does not exist. django-reversion makes a best effort, but at some point if you make a radical schema change your reversion history has to be deleted or tediously manually migrated.

So if you truly need a lossless historical data record, you’ll need a careful, custom solution.

On Tue, 12 Nov 2019 at 10:24, Andreas Nüßlein notifications@github.com wrote:

But if it participated in the migrations, you’d lose historical field data if you also removed a field. Or would you never remove fields/columns, but only ever add? I do understand that you have the same problem now: if i remove a field and i want to roll back an old version, where would that extra data from the serialized json go, either way 🤔 . But at least in the JSON the data would still be there.

I guess you’re right about the performance. But still: the queryability 🎉

Hmmmmh you’ve given me a lot to think about 😃

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/etianen/django-reversion/issues/808?email_source=notifications&email_token=AABEKCF3YGM6WBB2NNK2BQ3QTJ77JA5CNFSM4JKUHOI2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEDZYTLY#issuecomment-552831407, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABEKCG7SQR2DV7TPFLGASDQTJ77JANCNFSM4JKUHOIQ .

0reactions
andreasnuessleincommented, Nov 12, 2019

But if it participated in the migrations, you’d lose historical field data if you also removed a field. Or would you never remove fields/columns, but only ever add? I do understand that you have the same problem now: if i remove a field and i want to roll back an old version, where would that extra data from the serialized json go, either way 🤔 . But at least in the JSON the data would still be there.

I guess you’re right about the performance. But still: the queryability 🎉

Hmmmmh you’ve given me a lot to think about 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Sharing custom models - Hugging Face
In this tutorial, we will show you how to write a custom model and its configuration so it can be used inside Transformers,...
Read more >
Custom Models - Meta Integration
o Custom Models are instantiations of a custom model type in the metamodel and may be populated via the UI, bulk CSV import,...
Read more >
Custom Vision “compact” models - MLearning.ai - Medium
Select “compact” when creating a new model, there is a lightweight version for each domain. And don't worry, you can set this option...
Read more >
Custom models with ML Kit | Google Developers
Supports custom models from a wide range of sources, from pre-trained models published on TensorFlow Hub to new models trained with TensorFlow, AutoML...
Read more >
Custom Models - DataRobot Python package documentation
Custom models provide users the ability to run arbitrary modeling code in an environment defined by the user.
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