snapcher 0.1.5 → 0.3.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: bae931c7528d7bffe91dec097d6ead260efd735ab12382162b4e8882b7d8e8c4
4
- data.tar.gz: 9d53f6a77bfef51b30fff83a3f462534a8f3fea9832af6c1bb4eb4e56baaf5f8
3
+ metadata.gz: e451f8410d9ef2ca33254b255bdde727d2f9a3872f585adc858f60db6aa790d3
4
+ data.tar.gz: e65e54268eec21fd4319d70db673f92c79bda6236a034fc47d78dadbeb8ce3a3
5
5
  SHA512:
6
- metadata.gz: 37f7bf0ef0bbef1bf9a9891586305680f3af12041511c9ab019fa7950eb0a0ef26751200514823bc3f2b3eb735521c5f8f3b95ef307630f99776509da0c70aff
7
- data.tar.gz: e92d5dffce405f03d8b832ad8dc32fcd18ece0bb6e2dc99379509cfe7b46c15978fa61fb379463786e78a4a6c01312efa3946a287cda030606d909487fa19d23
6
+ metadata.gz: 7467703fdd41b839c084d3cb3f0bdcb391c0bdb71bb998624bb15851a63182d25b606345466451854a55473c38b0cd6d9653fd457d027d3152a1b344962de25b
7
+ data.tar.gz: 0e94835a649439317cc0a0f2ffa0e0dceb8821f462f4707e6492ed9c3994532700dca74843e8327ea85e014dd16add2fc5f542ba1f22ad8aad8b2a46380e68ef
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- snapcher (0.1.5)
4
+ snapcher (0.3.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -13,6 +13,10 @@ When a change is made to a specific column, the difference between before and af
13
13
 
14
14
  To make it easier for analysts, save the table name, column name, and data before and after changes as separate columns.
15
15
 
16
+ The name of this gem comes from one of Hideo Kojima's game works, ["Snatcher"](https://en.wikipedia.org/wiki/Snatcher_(video_game)).
17
+
18
+ It was the first of his game works to introduce cinematic direction, and "Snapcher" is also the first of my gem works.
19
+
16
20
  ## Supported
17
21
 
18
22
  ### Snapcher supports Ruby versions:
@@ -76,3 +80,11 @@ snapcher.action # => "update"
76
80
  snapcher.before_params # => "Gillian Seed"
77
81
  snapcher.after_params # => "Mika Slayton"
78
82
  ```
83
+ If the "Snatcher" column you want to capture is not user_id, you can specify this.
84
+
85
+ ```ruby
86
+ class User < ActiveRecord::Base
87
+ scanning column_name: "name", change_user_column: "id"
88
+ end
89
+ ```
90
+
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Snapcher
4
+ module Generators
5
+ module Migration
6
+ # Implement the required interface for Rails::Generators::Migration.
7
+ def next_migration_number(dirname) # :nodoc:
8
+ next_migration_number = current_migration_number(dirname) + 1
9
+ if timestamped_migrations?
10
+ [Time.now.utc.strftime("%Y%m%d%H%M%S"), "%.14d" % next_migration_number].max
11
+ else
12
+ "%.3d" % next_migration_number
13
+ end
14
+ end
15
+
16
+ private
17
+
18
+ def timestamped_migrations?
19
+ (Rails.gem_version >= Gem::Version.new("7.0")) ?
20
+ ::ActiveRecord.timestamped_migrations :
21
+ ::ActiveRecord::Base.timestamped_migrations
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Snapcher
4
+ module Generators
5
+ module MigrationHelper
6
+ def migration_parent
7
+ "ActiveRecord::Migration[#{ActiveRecord::Migration.current_version}]"
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ class <%= migration_class_name %> < <%= migration_parent %>
4
+ def self.up
5
+ add_column :scannings, :user_id, :<%= options[:snapcher_user_id_column_type] %>, after: :action
6
+
7
+ add_index :scannings, [:user_id], name: index_name
8
+ end
9
+
10
+ def self.down
11
+ remove_column :scannings, :user_id
12
+ remove_index :scannings, name: index_name
13
+ end
14
+
15
+ private
16
+
17
+ def index_name
18
+ 'snapcher_user_index'
19
+ end
20
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "rails/generators"
4
+ require "rails/generators/migration"
5
+ require "active_record"
6
+ require "rails/generators/active_record"
7
+ require "generators/snapcher/migration"
8
+ require "generators/snapcher/migration_helper"
9
+
10
+ module Snapcher
11
+ module Generators
12
+ class UpgradeGenerator < Rails::Generators::Base
13
+ include Rails::Generators::Migration
14
+ include Snapcher::Generators::MigrationHelper
15
+ extend Snapcher::Generators::Migration
16
+
17
+ class_option :snapcher_user_id_column_type, type: :string, default: "integer", required: false
18
+
19
+ source_root File.expand_path("../templates", __FILE__)
20
+
21
+ def copy_templates
22
+ migration_template "add_user_id_to_scannings.rb", "db/migrate/add_user_id_to_scannings.rb"
23
+ end
24
+ end
25
+ end
26
+ end
@@ -32,6 +32,7 @@ module Snapcher
32
32
  run_scanning(action: "create",
33
33
  column_name: snapcher_options[:column_name],
34
34
  after_params: snapcher_attributes[snapcher_options[:column_name]],
35
+ user_id: snatch,
35
36
  table_name: self.class.table_name)
36
37
  end
37
38
 
@@ -41,6 +42,7 @@ module Snapcher
41
42
  run_scanning(action: "update",
42
43
  column_name: snapcher_options[:column_name],
43
44
  table_name: self.class.table_name,
45
+ user_id: snatch,
44
46
  before_params: snapcher_changes[:before_params],
45
47
  after_params: snapcher_changes[:after_params])
46
48
  end
@@ -48,8 +50,10 @@ module Snapcher
48
50
  def scanning_destroy
49
51
  return if new_record?
50
52
 
51
- run_scanning(action: "destroy", column_name: snapcher_options[:column_name],
52
- table_name: self.class.table_name)
53
+ run_scanning(action: "destroy",
54
+ column_name: snapcher_options[:column_name],
55
+ table_name: self.class.table_name,
56
+ user_id: snatch)
53
57
  end
54
58
 
55
59
  # List of attributes that are snapcher.
@@ -58,6 +62,10 @@ module Snapcher
58
62
  normalize_enum_changes(snapcher_attributes)
59
63
  end
60
64
 
65
+ def snatch
66
+ snapcher_attributes[snapcher_options[:change_user_column]] || snapcher_attributes["user_id"]
67
+ end
68
+
61
69
  def scanning_change_values
62
70
  all_changes = if respond_to?(:changes_to_save)
63
71
  changes_to_save
@@ -71,9 +79,10 @@ module Snapcher
71
79
  end
72
80
 
73
81
  def snapcher_changes
82
+ snapcher_attributes = filter_encrypted_attrs(attributes)
74
83
  filtered_changes = scanning_change_values
75
-
76
84
  monitoring_column_name = snapcher_options[:column_name]
85
+ change_user_column = snapcher_options[:change_user_column]
77
86
 
78
87
  return if filtered_changes[monitoring_column_name.to_s].nil?
79
88
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Snapcher
4
- VERSION = "0.1.5"
4
+ VERSION = "0.3.0"
5
5
  end
data/lib/snapcher.rb CHANGED
@@ -6,8 +6,13 @@ module Snapcher
6
6
  class Error < StandardError; end
7
7
  # Your code goes here...
8
8
 
9
+ class RequestStore < ActiveSupport::CurrentAttributes
10
+ attribute :snapcher_store
11
+ end
12
+
9
13
  class << self
10
- attr_accessor :column_name
14
+ attr_accessor :column_name, :current_user
15
+ attr_accessor :change_user_column
11
16
  attr_writer :scanning_class
12
17
 
13
18
  def scanning_class
@@ -17,7 +22,13 @@ module Snapcher
17
22
  @scanning_class = @scanning_class.safe_constantize if @scanning_class.is_a?(String)
18
23
  @scanning_class ||= Snapcher::Scanning
19
24
  end
25
+
26
+ def store
27
+ RequestStore.snapcher_store ||= {}
28
+ end
20
29
  end
30
+
31
+ @current_user_method = :current_user
21
32
  end
22
33
 
23
34
  require "snapcher/junker"
@@ -1,75 +1,76 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- snapcher (0.1.0)
4
+ snapcher (0.3.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- actioncable (7.1.1)
10
- actionpack (= 7.1.1)
11
- activesupport (= 7.1.1)
9
+ actioncable (7.1.3.2)
10
+ actionpack (= 7.1.3.2)
11
+ activesupport (= 7.1.3.2)
12
12
  nio4r (~> 2.0)
13
13
  websocket-driver (>= 0.6.1)
14
14
  zeitwerk (~> 2.6)
15
- actionmailbox (7.1.1)
16
- actionpack (= 7.1.1)
17
- activejob (= 7.1.1)
18
- activerecord (= 7.1.1)
19
- activestorage (= 7.1.1)
20
- activesupport (= 7.1.1)
15
+ actionmailbox (7.1.3.2)
16
+ actionpack (= 7.1.3.2)
17
+ activejob (= 7.1.3.2)
18
+ activerecord (= 7.1.3.2)
19
+ activestorage (= 7.1.3.2)
20
+ activesupport (= 7.1.3.2)
21
21
  mail (>= 2.7.1)
22
22
  net-imap
23
23
  net-pop
24
24
  net-smtp
25
- actionmailer (7.1.1)
26
- actionpack (= 7.1.1)
27
- actionview (= 7.1.1)
28
- activejob (= 7.1.1)
29
- activesupport (= 7.1.1)
25
+ actionmailer (7.1.3.2)
26
+ actionpack (= 7.1.3.2)
27
+ actionview (= 7.1.3.2)
28
+ activejob (= 7.1.3.2)
29
+ activesupport (= 7.1.3.2)
30
30
  mail (~> 2.5, >= 2.5.4)
31
31
  net-imap
32
32
  net-pop
33
33
  net-smtp
34
34
  rails-dom-testing (~> 2.2)
35
- actionpack (7.1.1)
36
- actionview (= 7.1.1)
37
- activesupport (= 7.1.1)
35
+ actionpack (7.1.3.2)
36
+ actionview (= 7.1.3.2)
37
+ activesupport (= 7.1.3.2)
38
38
  nokogiri (>= 1.8.5)
39
+ racc
39
40
  rack (>= 2.2.4)
40
41
  rack-session (>= 1.0.1)
41
42
  rack-test (>= 0.6.3)
42
43
  rails-dom-testing (~> 2.2)
43
44
  rails-html-sanitizer (~> 1.6)
44
- actiontext (7.1.1)
45
- actionpack (= 7.1.1)
46
- activerecord (= 7.1.1)
47
- activestorage (= 7.1.1)
48
- activesupport (= 7.1.1)
45
+ actiontext (7.1.3.2)
46
+ actionpack (= 7.1.3.2)
47
+ activerecord (= 7.1.3.2)
48
+ activestorage (= 7.1.3.2)
49
+ activesupport (= 7.1.3.2)
49
50
  globalid (>= 0.6.0)
50
51
  nokogiri (>= 1.8.5)
51
- actionview (7.1.1)
52
- activesupport (= 7.1.1)
52
+ actionview (7.1.3.2)
53
+ activesupport (= 7.1.3.2)
53
54
  builder (~> 3.1)
54
55
  erubi (~> 1.11)
55
56
  rails-dom-testing (~> 2.2)
56
57
  rails-html-sanitizer (~> 1.6)
57
- activejob (7.1.1)
58
- activesupport (= 7.1.1)
58
+ activejob (7.1.3.2)
59
+ activesupport (= 7.1.3.2)
59
60
  globalid (>= 0.3.6)
60
- activemodel (7.1.1)
61
- activesupport (= 7.1.1)
62
- activerecord (7.1.1)
63
- activemodel (= 7.1.1)
64
- activesupport (= 7.1.1)
61
+ activemodel (7.1.3.2)
62
+ activesupport (= 7.1.3.2)
63
+ activerecord (7.1.3.2)
64
+ activemodel (= 7.1.3.2)
65
+ activesupport (= 7.1.3.2)
65
66
  timeout (>= 0.4.0)
66
- activestorage (7.1.1)
67
- actionpack (= 7.1.1)
68
- activejob (= 7.1.1)
69
- activerecord (= 7.1.1)
70
- activesupport (= 7.1.1)
67
+ activestorage (7.1.3.2)
68
+ actionpack (= 7.1.3.2)
69
+ activejob (= 7.1.3.2)
70
+ activerecord (= 7.1.3.2)
71
+ activesupport (= 7.1.3.2)
71
72
  marcel (~> 1.0)
72
- activesupport (7.1.1)
73
+ activesupport (7.1.3.2)
73
74
  base64
74
75
  bigdecimal
75
76
  concurrent-ruby (~> 1.0, >= 1.0.2)
@@ -79,34 +80,33 @@ GEM
79
80
  minitest (>= 5.1)
80
81
  mutex_m
81
82
  tzinfo (~> 2.0)
82
- base64 (0.1.1)
83
- bigdecimal (3.1.4)
83
+ base64 (0.2.0)
84
+ bigdecimal (3.1.8)
84
85
  bindex (0.8.1)
85
- bootsnap (1.16.0)
86
+ bootsnap (1.18.3)
86
87
  msgpack (~> 1.2)
87
88
  builder (3.2.4)
88
- concurrent-ruby (1.2.2)
89
+ concurrent-ruby (1.2.3)
89
90
  connection_pool (2.4.1)
90
91
  crass (1.0.6)
91
- date (3.3.3)
92
- debug (1.8.0)
93
- irb (>= 1.5.0)
94
- reline (>= 0.3.1)
95
- drb (2.1.1)
96
- ruby2_keywords
92
+ date (3.3.4)
93
+ debug (1.9.2)
94
+ irb (~> 1.10)
95
+ reline (>= 0.3.8)
96
+ drb (2.2.1)
97
97
  erubi (1.12.0)
98
98
  globalid (1.2.1)
99
99
  activesupport (>= 6.1)
100
- i18n (1.14.1)
100
+ i18n (1.14.5)
101
101
  concurrent-ruby (~> 1.0)
102
- io-console (0.6.0)
103
- irb (1.8.3)
104
- rdoc
105
- reline (>= 0.3.8)
106
- jbuilder (2.11.5)
102
+ io-console (0.7.2)
103
+ irb (1.13.1)
104
+ rdoc (>= 4.0.0)
105
+ reline (>= 0.4.2)
106
+ jbuilder (2.12.0)
107
107
  actionview (>= 5.0.0)
108
108
  activesupport (>= 5.0.0)
109
- loofah (2.21.4)
109
+ loofah (2.22.0)
110
110
  crass (~> 1.0.2)
111
111
  nokogiri (>= 1.12.0)
112
112
  mail (2.8.1)
@@ -114,33 +114,33 @@ GEM
114
114
  net-imap
115
115
  net-pop
116
116
  net-smtp
117
- marcel (1.0.2)
117
+ marcel (1.0.4)
118
118
  mini_mime (1.1.5)
119
- minitest (5.20.0)
119
+ minitest (5.22.3)
120
120
  msgpack (1.7.2)
121
- mutex_m (0.1.2)
122
- net-imap (0.4.1)
121
+ mutex_m (0.2.0)
122
+ net-imap (0.4.11)
123
123
  date
124
124
  net-protocol
125
125
  net-pop (0.1.2)
126
126
  net-protocol
127
- net-protocol (0.2.1)
127
+ net-protocol (0.2.2)
128
128
  timeout
129
- net-smtp (0.4.0)
129
+ net-smtp (0.5.0)
130
130
  net-protocol
131
- nio4r (2.5.9)
132
- nokogiri (1.15.4-aarch64-linux)
131
+ nio4r (2.7.3)
132
+ nokogiri (1.16.4-aarch64-linux)
133
133
  racc (~> 1.4)
134
- nokogiri (1.15.4-arm64-darwin)
134
+ nokogiri (1.16.4-arm64-darwin)
135
135
  racc (~> 1.4)
136
- nokogiri (1.15.4-x86_64-linux)
136
+ nokogiri (1.16.4-x86_64-linux)
137
137
  racc (~> 1.4)
138
- psych (5.1.1.1)
138
+ psych (5.1.2)
139
139
  stringio
140
- puma (6.4.0)
140
+ puma (6.4.2)
141
141
  nio4r (~> 2.0)
142
- racc (1.7.1)
143
- rack (3.0.8)
142
+ racc (1.7.3)
143
+ rack (3.0.10)
144
144
  rack-session (2.0.0)
145
145
  rack (>= 3.0.0)
146
146
  rack-test (2.1.0)
@@ -148,20 +148,20 @@ GEM
148
148
  rackup (2.1.0)
149
149
  rack (>= 3)
150
150
  webrick (~> 1.8)
151
- rails (7.1.1)
152
- actioncable (= 7.1.1)
153
- actionmailbox (= 7.1.1)
154
- actionmailer (= 7.1.1)
155
- actionpack (= 7.1.1)
156
- actiontext (= 7.1.1)
157
- actionview (= 7.1.1)
158
- activejob (= 7.1.1)
159
- activemodel (= 7.1.1)
160
- activerecord (= 7.1.1)
161
- activestorage (= 7.1.1)
162
- activesupport (= 7.1.1)
151
+ rails (7.1.3.2)
152
+ actioncable (= 7.1.3.2)
153
+ actionmailbox (= 7.1.3.2)
154
+ actionmailer (= 7.1.3.2)
155
+ actionpack (= 7.1.3.2)
156
+ actiontext (= 7.1.3.2)
157
+ actionview (= 7.1.3.2)
158
+ activejob (= 7.1.3.2)
159
+ activemodel (= 7.1.3.2)
160
+ activerecord (= 7.1.3.2)
161
+ activestorage (= 7.1.3.2)
162
+ activesupport (= 7.1.3.2)
163
163
  bundler (>= 1.15.0)
164
- railties (= 7.1.1)
164
+ railties (= 7.1.3.2)
165
165
  rails-dom-testing (2.2.0)
166
166
  activesupport (>= 5.0.0)
167
167
  minitest
@@ -169,20 +169,19 @@ GEM
169
169
  rails-html-sanitizer (1.6.0)
170
170
  loofah (~> 2.21)
171
171
  nokogiri (~> 1.14)
172
- railties (7.1.1)
173
- actionpack (= 7.1.1)
174
- activesupport (= 7.1.1)
172
+ railties (7.1.3.2)
173
+ actionpack (= 7.1.3.2)
174
+ activesupport (= 7.1.3.2)
175
175
  irb
176
176
  rackup (>= 1.0.0)
177
177
  rake (>= 12.2)
178
178
  thor (~> 1.0, >= 1.2.2)
179
179
  zeitwerk (~> 2.6)
180
- rake (13.0.6)
181
- rdoc (6.5.0)
180
+ rake (13.2.1)
181
+ rdoc (6.6.3.1)
182
182
  psych (>= 4.0.0)
183
- reline (0.3.9)
183
+ reline (0.5.5)
184
184
  io-console (~> 0.5)
185
- ruby2_keywords (0.0.5)
186
185
  sprockets (4.2.1)
187
186
  concurrent-ruby (~> 1.0)
188
187
  rack (>= 2.2.4, < 4)
@@ -190,12 +189,12 @@ GEM
190
189
  actionpack (>= 5.2)
191
190
  activesupport (>= 5.2)
192
191
  sprockets (>= 3.0.0)
193
- sqlite3 (1.6.7-aarch64-linux)
194
- sqlite3 (1.6.7-arm64-darwin)
195
- sqlite3 (1.6.7-x86_64-linux)
196
- stringio (3.0.8)
197
- thor (1.3.0)
198
- timeout (0.4.0)
192
+ sqlite3 (1.7.3-aarch64-linux)
193
+ sqlite3 (1.7.3-arm64-darwin)
194
+ sqlite3 (1.7.3-x86_64-linux)
195
+ stringio (3.1.0)
196
+ thor (1.3.1)
197
+ timeout (0.4.1)
199
198
  tzinfo (2.0.6)
200
199
  concurrent-ruby (~> 1.0)
201
200
  web-console (4.2.1)
@@ -207,7 +206,7 @@ GEM
207
206
  websocket-driver (0.7.6)
208
207
  websocket-extensions (>= 0.1.0)
209
208
  websocket-extensions (0.1.5)
210
- zeitwerk (2.6.12)
209
+ zeitwerk (2.6.13)
211
210
 
212
211
  PLATFORMS
213
212
  aarch64-linux
@@ -0,0 +1,3 @@
1
+ class Gift < ApplicationRecord
2
+ scanning column_name: "name", change_user_column: "from_user_id"
3
+ end
@@ -0,0 +1,5 @@
1
+ class Post < ApplicationRecord
2
+ scanning column_name: "title"
3
+
4
+ belongs_to :user
5
+ end
@@ -1,5 +1,5 @@
1
1
  class User < ApplicationRecord
2
- scanning column_name: "role"
2
+ scanning column_name: "role", change_user_column: "id"
3
3
 
4
4
  enum :role, { normal: 0, admin: 1 }
5
5
  end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ class AddUserIdToScannings < ActiveRecord::Migration[7.1]
4
+ def self.up
5
+ add_column :scannings, :user_id, :integer
6
+
7
+ add_index :scannings, [:user_id], name: index_name
8
+ end
9
+
10
+ def self.down
11
+ remove_column :scannings, :user_id
12
+ remove_index :scannings, name: index_name
13
+ end
14
+
15
+ private
16
+
17
+ def index_name
18
+ 'user_index'
19
+ end
20
+ end
@@ -0,0 +1,11 @@
1
+ class CreatePosts < ActiveRecord::Migration[7.1]
2
+ def change
3
+ create_table :posts do |t|
4
+ t.string :title
5
+ t.text :body
6
+ t.references :user, null: false, foreign_key: true
7
+
8
+ t.timestamps
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ class CreateGifts < ActiveRecord::Migration[7.1]
2
+ def change
3
+ create_table :gifts do |t|
4
+ t.integer :from_user_id
5
+ t.integer :to_user_id
6
+ t.string :name
7
+
8
+ t.timestamps
9
+ end
10
+ end
11
+ end
@@ -10,7 +10,24 @@
10
10
  #
11
11
  # It's strongly recommended that you check this file into your version control system.
12
12
 
13
- ActiveRecord::Schema[7.1].define(version: 2023_10_19_151334) do
13
+ ActiveRecord::Schema[7.1].define(version: 2024_06_25_084542) do
14
+ create_table "gifts", force: :cascade do |t|
15
+ t.integer "from_user_id"
16
+ t.integer "to_user_id"
17
+ t.string "name"
18
+ t.datetime "created_at", null: false
19
+ t.datetime "updated_at", null: false
20
+ end
21
+
22
+ create_table "posts", force: :cascade do |t|
23
+ t.string "title"
24
+ t.text "body"
25
+ t.integer "user_id", null: false
26
+ t.datetime "created_at", null: false
27
+ t.datetime "updated_at", null: false
28
+ t.index ["user_id"], name: "index_posts_on_user_id"
29
+ end
30
+
14
31
  create_table "scannings", force: :cascade do |t|
15
32
  t.integer "scannable_id"
16
33
  t.string "scannable_type"
@@ -20,6 +37,8 @@ ActiveRecord::Schema[7.1].define(version: 2023_10_19_151334) do
20
37
  t.string "after_params"
21
38
  t.string "action"
22
39
  t.datetime "created_at"
40
+ t.integer "user_id"
41
+ t.index ["user_id"], name: "user_index"
23
42
  end
24
43
 
25
44
  create_table "users", force: :cascade do |t|
@@ -33,4 +52,6 @@ ActiveRecord::Schema[7.1].define(version: 2023_10_19_151334) do
33
52
  t.datetime "created_at", null: false
34
53
  t.datetime "updated_at", null: false
35
54
  end
55
+
56
+ add_foreign_key "posts", "users"
36
57
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: snapcher
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ryosk7
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-10-27 00:00:00.000000000 Z
11
+ date: 2024-06-25 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: |
14
14
  Snapcher is an ORM extension that logs changes to specific columns to your model.
@@ -31,15 +31,18 @@ files:
31
31
  - LICENSE.txt
32
32
  - README.md
33
33
  - Rakefile
34
- - lib/generators/snapcher/install/install_generator.rb
34
+ - lib/generators/snapcher/install_generator.rb
35
+ - lib/generators/snapcher/migration.rb
36
+ - lib/generators/snapcher/migration_helper.rb
37
+ - lib/generators/snapcher/templates/add_user_id_to_scannings.rb
35
38
  - lib/generators/snapcher/templates/install.rb
39
+ - lib/generators/snapcher/upgrade_generator.rb
36
40
  - lib/snapcher.rb
37
41
  - lib/snapcher/junker.rb
38
42
  - lib/snapcher/railtie.rb
39
43
  - lib/snapcher/scanning.rb
40
44
  - lib/snapcher/sweeper.rb
41
45
  - lib/snapcher/version.rb
42
- - logo/snapcher_logo.png
43
46
  - sample-app/.dockerignore
44
47
  - sample-app/.gitattributes
45
48
  - sample-app/.gitignore
@@ -58,6 +61,8 @@ files:
58
61
  - sample-app/app/jobs/application_job.rb
59
62
  - sample-app/app/models/application_record.rb
60
63
  - sample-app/app/models/concerns/.keep
64
+ - sample-app/app/models/gift.rb
65
+ - sample-app/app/models/post.rb
61
66
  - sample-app/app/models/user.rb
62
67
  - sample-app/app/views/layouts/application.html.erb
63
68
  - sample-app/bin/bundle
@@ -84,6 +89,9 @@ files:
84
89
  - sample-app/config/routes.rb
85
90
  - sample-app/db/migrate/20231019150803_create_users.rb
86
91
  - sample-app/db/migrate/20231019151334_install_snapcher.rb
92
+ - sample-app/db/migrate/20240509025320_add_user_id_to_scannings.rb
93
+ - sample-app/db/migrate/20240509080448_create_posts.rb
94
+ - sample-app/db/migrate/20240625084542_create_gifts.rb
87
95
  - sample-app/db/schema.rb
88
96
  - sample-app/db/seeds.rb
89
97
  - sample-app/lib/assets/.keep
Binary file