westonganger / active_snapshot

Simplified snapshots and restoration for ActiveRecord models and associations with a transparent white-box implementation
MIT License
103 stars 16 forks source link

Feature request: storing the snapshot's JSON in ActiveStorage instead of the database #48

Open feliperaul opened 5 months ago

feliperaul commented 5 months ago

First of all, this gem brings a fresh approach to version tracking and I love it! Very well written, congrats.

When using version tracking, specially with heavy models (think long text / html documents, where each save creates a snapshot), the number of versions tracked can really start bloating up the database.

Even if the developer is considerate with the settings (how long and how many versions are tracked), I still think that only the Snapshots (which are the 'metadata' of each version) need to be in the database; the actual JSON of the models stored could be stored in S3 and fetched only when needed.

This is because, in general, version tracking UI is not used frequently by the users; it's often a 'backup restore' kinda of feature.

So the user can tolerate a few extra ms of latency when fetching versions, and I think that even holds when you are comparing the JSON between two versions for some diffing.

Do you think supporting ActiveStorage storage of the JSON blobs would be something to be implemented in the feature, as an option for the user, being configured on a per-model basis?

westonganger commented 4 months ago

@feliperaul I think that this is a cool idea and would be interested in a PR which implements this.