rails_surrogate_key_logging 0.4.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d69d68a6bbbb693ad6e0858b770aab8ee4c430e309447bae5b4a7cd222286852
4
- data.tar.gz: 9b72303771b0704d71eb69dcd24e1120d7e4de0d755cfb8d07ad2ea520df90e1
3
+ metadata.gz: 3c294a79fb780fafbcbc06d116529cb816fd902a52fd1203cfe94ed31fca7ee1
4
+ data.tar.gz: 0710ba0071ffaeb46cc18bf8fb8805abed72d39ff4ebf586b605c353ddde9097
5
5
  SHA512:
6
- metadata.gz: 128b93f900cf248c250de95e8f4fd64db8ed4c437ffbe1eb40a79fbf002d101e4f3b566622aee962b434a3ebf0b196e559eab45f8a5e6cafc54398a6151a4658
7
- data.tar.gz: b15e7ac8901f0d43bf0f95f99e657bb65d90b4a2ec3e9123672ccf8a6464b587b32be03ab523b1b2214ce7cf77d66207a852081821885ba3a60d6099157ee9eb
6
+ metadata.gz: ee7d8c9c308fab4691cb7c01a465ce811203ab09db7849977766c84e48d30a8a1f9fdbedcb14add3436cbece9cd63e5c9c838c911c0f7c7a8a81a9c5103d60ef
7
+ data.tar.gz: 38fb223db0ae2dbe0f6e3625545c5aee91a3321fe33effda26a366defd0041b482cd4c5f136eb9a0cd4ea3ce5b05e543bb06380bc27387c4e04bc890554715b6
@@ -0,0 +1,15 @@
1
+ <%=
2
+ YAML.load(
3
+ ERB.new(
4
+ File.read(
5
+ Rails.root.join('config', 'database.yml')
6
+ ),
7
+ nil, nil, '__dummy_config_database_yml_erbout__'
8
+ ).result(binding)
9
+ ).inject({}) do |memo, conf|
10
+ k, v = conf
11
+ memo[k.sub(Regexp.new("^surrogate_key_logging_"),'')] = v if k.starts_with?("surrogate_key_logging_")
12
+
13
+ memo
14
+ end.to_yaml
15
+ %>
@@ -0,0 +1,13 @@
1
+ class CreateSurrogates < ActiveRecord::Migration[6.0]
2
+ def change
3
+ create_table :surrogates, id: false, options: 'ENGINE=InnoDB, CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci' do |t|
4
+ t.string :key, primary_key: true, null: false
5
+ t.text :value, limit: 4294967295, null: false
6
+ t.string :hashed_value, null: false
7
+
8
+ t.datetime :updated_at, null: false
9
+ end
10
+ add_index :surrogates, :key, unique: true
11
+ add_index :surrogates, :hashed_value, unique: true
12
+ end
13
+ end
@@ -36,6 +36,7 @@ module SurrogateKeyLogging
36
36
  end
37
37
 
38
38
  def call(_key, value, _parents = [], _original_params = nil)
39
+ return "" if value.blank?
39
40
  surrogate = get(value)
40
41
  Rails.logger.tagged('SurrogateKeyLogging') { Rails.logger.info "Surrogate: `#{surrogate}`, value: `#{value}`" } if SurrogateKeyLogging.config.debug
41
42
  surrogate
@@ -4,7 +4,7 @@ module SurrogateKeyLogging
4
4
 
5
5
  module Version
6
6
  MAJOR = 0
7
- MINOR = 4
7
+ MINOR = 6
8
8
  PATCH = 0
9
9
 
10
10
  end
@@ -21,7 +21,7 @@ Gem::Specification.new do |s|
21
21
  'rubygems_mfa_required' => 'true',
22
22
  }
23
23
 
24
- s.files = Dir['app/**/*', 'lib/**/*', 'README.md', 'MIT-LICENSE', 'rails_surrogate_key_logging.gemspec']
24
+ s.files = Dir['app/**/*', 'lib/**/*', 'config/**/*', 'db/**/*', 'README.md', 'MIT-LICENSE', 'rails_surrogate_key_logging.gemspec']
25
25
 
26
26
  s.require_paths = %w[ lib ]
27
27
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_surrogate_key_logging
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Taylor Yelverton
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-02-24 00:00:00.000000000 Z
11
+ date: 2023-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionpack
@@ -99,6 +99,8 @@ files:
99
99
  - README.md
100
100
  - app/models/surrogate_key_logging/application_record.rb
101
101
  - app/models/surrogate_key_logging/surrogate.rb
102
+ - config/database.yml
103
+ - db/migrate/20230119211745_create_surrogates.rb
102
104
  - lib/rails_surrogate_key_logging.rb
103
105
  - lib/surrogate_key_logging.rb
104
106
  - lib/surrogate_key_logging/action_controller.rb