All Versions
24
Latest Version
Avg Release Cycle
60 days
Latest Release
25 days ago

Changelog History
Page 1

  • v0.12.0

    January 02, 2020
    • PR #143 Add :transactional option to #with_meta and #with_responsible ([@oleg-kiviljov][])

    0️⃣ Now it's possible to set meta and responsible without wrapping the block into a DB transaction. For backward compatibility :transactional option by default is set to true.

    Usage:

    Logidze.with_meta({ip: request.ip}, transactional: false) do
      post.save!
    end
    

    or

    Logidze.with_responsible(user.id, transactional: false) do
      post.save!
    end
    
  • v0.11.0

    August 15, 2019

    🌲 This release reverts some changes made in 0.10.0 related to ignore_log_data functionality.

    🔄 Changes

    • 👻 Return nil when log_data is not loaded instead of raising an exception.

    We cannot distinguish between not loaded log_data and not-yet-created (i.e. for new records).
    The latter could be used in frameworks/gems (example).

    • 🌲 Only allow specifying ignore_log_data at boot time without runtime modifications.

    Playing with ActiveRecord default scopes wasn't a good idea. We fallback to a more explicit way of telling AR
    when to load or ignore the log_data column.

    🌲 This change removes Logidze.with_log_data method.

  • v0.10.0

    May 15, 2019

    🔄 Changes

    • 💎 Ruby >= 2.4 is required

    🔋 Features

    • 🌲 Added global configuration for :ignore_log_data option.

    0️⃣ Now it's possible to avoid loading log_data from the DB by default with

    Logidze.ignore\_log\_data\_by\_default = true
    

    🌲 In cases when ignore_log_data: false is explicitly passed to the ignore_log_data the default setting is being overriden. Also, it's possible to change it inside the block:

    Logidze.with\_log\_data doPost.find(params[:id]).log\_dataend
    

    PR #111

    • 🌲 Added #reset_log_data API to nullify log_data column.

    Now you can reset the history for a record (or records):

    # for single recordrecord.reset\_log\_data# for relationUser.where(active: true).reset\_log\_data
    

    PR #110

  • v0.9.0

    November 28, 2018

    🔋 Features

    • 🌲 Added #reload_log_data to fetch the actual log_data from DB.

      user = User.create!(params) user.log_data #=> nil, 'cause it's generated DB-sideuser.reload_log_data user.log_data #=> Logidze::History

    • 🌲 Added :ignore_log_data option to #has_logidze to avoid selecting log_data by default.

    Usage:

    class User \< ActiveRecord::Base has\_logidze ignore\_log\_data: trueendUser.all #=\> SELECT id, name FROM usersUser.with\_log\_data #=\> SELECT id, name, log\_data FROM usersuser = User.find(params[:id]) user.log\_data #=\> ActiveModel::MissingAttributeErroruser.reload\_log\_data #=\> Logidze::History
    
  • v0.8.1

    October 22, 2018
    • 🌲 PR #93] Return 0 for log size when log_data is nil ([@duderman][])
  • v0.8.0

    October 01, 2018

    🔋 Features

    Added ability to specify the debounce time to avoid spamming logs creation.

    👀 See PR #87.

    Usage:

    # 5000msrails generate logidze:model story --debounce\_time=5000
    

    👀 You see the following in generated migration

    CREATE TRIGGER logidze\_on\_stories BEFORE UPDATE OR INSERT ON stories FOR EACH ROW WHEN (coalesce(#{current\_setting('logidze.disabled')}, '') \<\> 'on') EXECUTE PROCEDURE logidze\_logger(null, 'updated\_at', null, 5000);
    

    ⬆️ How to upgrade.

    ⚡️ Please run rails generate logidze:install --update to regenerate stored functions.

    ✅ This feature checks if several logs came in within a debounce time period then only keep the latest one
    🔀 by merging the latest in previous others.

    The concept is similar to https://underscorejs.org/#debounce

    without debounce_time

    { "h": [{ "c": { "content": "Content 1" }, "v": 1, "ts": 0 }, { "c": { "content": "content 2", "active": true }, "v": 2, "ts": 100 }, { "c": { "content": "content 3", }, "v": 3, "ts": 101 }], "v": 3}
    

    with debounce_time of 10ms

    { "h": [{ "c": { "content": "Content 1" }, "v": 1, "ts": 0 }, { "c": { "content": "content 3", "active": true }, "v": 2, "ts": 101 }], "v": 3}
    
  • v0.7.0

    August 29, 2018
    • 🛠 [Fixes #75] Fix association versioning with an optional belongs to ([@ankursethi-uscis][])

    • [PR #79] Allow adding meta information to versions using with_meta (addressed Issue [#60]). ([@DmitryTsepelev][])

    Usage:

    Logidze.with_meta(ip: request.ip) { post.save }
    puts post.meta # => { 'ip' => '95.66.157.226' }
    

    ⬆️ How to upgrade.

    ⚡️ Please run rails generate logidze:install --update to regenerate stored functions.

    This feature replaces the implementation of with_responsible, now responsible_id is stored inside of the meta hash with the key _r.

    There is fallback to the old data structure ({ 'r' => 42 } opposed to { 'm' => { '_r' => 42 } } in the current implementation), so responsible_id should work as usual for the existing data.

    If you've accessed the value manually (e.g. post.log_data.current_version.data['r']), you'll have to add the fallback too.

  • v0.6.5

    August 08, 2018
    • 🚅 Make compatible with Rails 5.2.1 ([@palkan][])
  • v0.6.4

    April 30, 2018
    • 🚚 [Fixes #70] Ignore missing (e.g. removed) columns in diffs and past versions. ([@palkan][])

    👀 This is a quick fix for a more general problem (see #59).

  • v0.6.3

    January 17, 2018
    • 🛠 [Fixes #57] Support associations versioning for at(version:). ([@palkan][])

    • ➕ Add rubocop-md