logidze 1.2.2 → 1.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 68d689e98373be99d5039ebc70fc05d369a75b94e20ef0bb9d0d9d43e70c3887
4
- data.tar.gz: 3c3c24bd36f3af269d1443562f271ede71d222dfea5ad8d52c9199ca72d91244
3
+ metadata.gz: ac315542fe9ec1866a4395ed04f1e431d65fe6c9dfc72874a423224c0b52b3cb
4
+ data.tar.gz: deb4efcba8179273185738fbe395458f6bd4165bf8ed1263b0348bf9bc4b45ab
5
5
  SHA512:
6
- metadata.gz: 78217c05e5bab5aa2ce2a865c1a9e84cdf76ceb56e52e951394c58e098f295732981fc911a499d6c6fd2fa81f3ea25636dcd1708f8940df068dfc37ca367cfac
7
- data.tar.gz: 0e050d100d842aaeb75b9f7764d4ee5e862ace9cfe3a880f0538839898f87ebf317884d51136be8600e374f8ceeed38605aa44b0952b16f270df20b5017e99c2
6
+ metadata.gz: bffd04a3005c169a56e3280eaceb7c22623b7d7cfdf82719d65f16804fd86adee32f9afdccd6e767923dd5f6b0b63c0354455ad5daba7a608a420190cae4c2fd
7
+ data.tar.gz: c7296b56fed241dc7f55a16a5307b596f1ec016f334cb743c47272295db3ee4d1236bbda0f97c78a9b4a8e50309e07757322611c41bb5386bdbee3500fa57a1b
data/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## master (unreleased)
4
4
 
5
+ ## 1.2.3 (2023-01-03)
6
+
7
+ - [Fixes [#217](https://github.com/palkan/logidze/issues/217)] Fix switch_to with `append: true` when there are changes on JSONB columns. ([@miharekar][])
8
+
5
9
  ## 1.2.2 (2022-07-13)
6
10
 
7
11
  - [Fixes [#209](https://github.com/palkan/logidze/issues/209)] Fix tracking JSONB column changes. ([@baygeldin][])
@@ -66,7 +70,7 @@ now we filter the columns within the trigger function (thus, schema changes do n
66
70
 
67
71
  - PR [#143](https://github.com/palkan/logidze/pull/143) Add `:transactional` option to `#with_meta` and `#with_responsible` ([@oleg-kiviljov][])
68
72
 
69
- 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`.
73
+ 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`.
70
74
 
71
75
  Usage:
72
76
 
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2016-2020 Vladimir Dementyev
3
+ Copyright (c) 2016-2023 Vladimir Dementyev
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -485,7 +485,7 @@ $ bundle exec rails generate logidze:model Post --update --only=title,body,ratin
485
485
 
486
486
  ### Pending upgrade check [Experimental]
487
487
 
488
- Logidze can check for a pending upgrade. Use `Logidze.on_pending_upgrade = :warn` to be notified by warning, or `Logidze.on_pending_upgrade = :error` if you want Logidze to raise an error.
488
+ Logidze can check for a pending upgrade. Use `Logidze.on_pending_upgrade = :warn` to be notified by warning, or `Logidze.on_pending_upgrade = :raise` if you want Logidze to raise an error.
489
489
 
490
490
  ### Upgrading from 0.x to 1.0 (edge)
491
491
 
data/lib/logidze/model.rb CHANGED
@@ -172,10 +172,14 @@ module Logidze
172
172
  # Restore record to the specified version.
173
173
  # Return false if version is unknown.
174
174
  def switch_to!(version, append: Logidze.append_on_undo)
175
+ raise ArgumentError, "#log_data is empty" unless log_data
176
+
175
177
  return false unless at_version(version)
176
178
 
177
179
  if append && version < log_version
178
- update!(log_data.changes_to(version: version))
180
+ changes = log_data.changes_to(version: version)
181
+ changes.each { |c, v| changes[c] = deserialize_value(c, v) }
182
+ update!(changes)
179
183
  else
180
184
  at_version!(version)
181
185
  self.class.without_logging { save! }
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Logidze
4
- VERSION = "1.2.2"
4
+ VERSION = "1.2.3"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logidze
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.2
4
+ version: 1.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - palkan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-07-13 00:00:00.000000000 Z
11
+ date: 2023-01-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -216,7 +216,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
216
216
  - !ruby/object:Gem::Version
217
217
  version: '0'
218
218
  requirements: []
219
- rubygems_version: 3.3.7
219
+ rubygems_version: 3.3.11
220
220
  signing_key:
221
221
  specification_version: 4
222
222
  summary: PostgreSQL JSONB-based model changes tracking