How does version control on quorum work? Database design

Well, I saw some plugins to create a version table to track changes on specific models, but can't do as easily as quora shows

Changing a topic photo on quora

What I have so far is this:

  • identifier
  • item_type : indicates which version of the model applies: "Theme"
  • item_id
  • event : if it was: "edited, added, canceled, deleted"
  • who : who triggered the event
  • column . Which column in the subject line has changed. "Topic.photo_url"
  • new : new value: http: //s3.amazonaws.../pic.png "
  • old old value: " http: //s3.amazonaws.../oldpic.png "
  • revision_rel : indicates a previous revision
  • Time stamp

enter image description here

Can anyone give me some help and recommendations with this design? I'm worried about performance, wrong columns, missing columns, etc.

id | item_type | item_id | event | who | column | new | old | revision_rel | date ________________________________________________________________________________________________________ 1 | Topic | 2 | edit | Luccas | photo | pic.png | oldpic.png | null | m:d:y 2 | Topic | 2 | revert | Chris | photo | oldpic.png | pic.png | 1 | m:d:y 
+6
source share
1 answer

There are some gems that are already doing what you are looking for. You studied:

Take a look at existing gems: https://www.ruby-toolbox.com/categories/Active_Record_Versioning

I use verified (previously act_as_audited) for something very similar: https://github.com/collectiveidea/audited

+1
source

Source: https://habr.com/ru/post/918911/


All Articles