temporal_tables 3.0.2 → 3.1.0
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 +4 -4
- data/.github/workflows/test.yml +11 -0
- data/gemfiles/Gemfile.8.0.mysql +19 -0
- data/gemfiles/Gemfile.8.0.mysql.lock +272 -0
- data/gemfiles/Gemfile.8.0.pg +19 -0
- data/gemfiles/Gemfile.8.0.pg.lock +271 -0
- data/lib/temporal_tables/version.rb +1 -1
- data/spec/basic_history_spec.rb +1 -1
- data/spec/spec_helper.rb +2 -10
- data/spec/support/database_helper.rb +47 -0
- data/spec/temporal_tables/temporal_adapter_spec.rb +13 -13
- data/temporal_tables.gemspec +1 -1
- metadata +11 -7
- data/spec/support/database.rb +0 -43
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 03524c2558f3262dfa0011d48fbc9c07cf0891dd5689e0ad96fa9c6ebfdc2dd3
|
|
4
|
+
data.tar.gz: e89c2eebb52a4d56e74d336a0886f869a25360d0d47db43289f133334cf4c2db
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a1975ca2912c3098b4c94501bed2b68ab5c803656f010da8deea2396e3a02a676edd947e80f50fe3865fb9dac6607e40773eec831bf0061b0413e48da5130b2b
|
|
7
|
+
data.tar.gz: d0b80aa344ef16d67ccf4a154a83121529087ca0a030c0e6f69a5abb11790bb1e5df56b061b45edfc0ad44742295698ff1651d5827398f053d1c888987a56f2c
|
data/.github/workflows/test.yml
CHANGED
|
@@ -63,11 +63,22 @@ jobs:
|
|
|
63
63
|
- "gemfiles/Gemfile.7.1.pg"
|
|
64
64
|
- "gemfiles/Gemfile.7.2.mysql"
|
|
65
65
|
- "gemfiles/Gemfile.7.2.pg"
|
|
66
|
+
- "gemfiles/Gemfile.8.0.mysql"
|
|
67
|
+
- "gemfiles/Gemfile.8.0.pg"
|
|
66
68
|
exclude:
|
|
67
69
|
- ruby: "3.0"
|
|
68
70
|
gemfile: "gemfiles/Gemfile.7.2.mysql"
|
|
69
71
|
- ruby: "3.0"
|
|
70
72
|
gemfile: "gemfiles/Gemfile.7.2.pg"
|
|
73
|
+
- ruby: "3.0"
|
|
74
|
+
gemfile: "gemfiles/Gemfile.8.0.mysql"
|
|
75
|
+
- ruby: "3.0"
|
|
76
|
+
gemfile: "gemfiles/Gemfile.8.0.pg"
|
|
77
|
+
- ruby: "3.1"
|
|
78
|
+
gemfile: "gemfiles/Gemfile.8.0.mysql"
|
|
79
|
+
- ruby: "3.1"
|
|
80
|
+
gemfile: "gemfiles/Gemfile.8.0.pg"
|
|
81
|
+
|
|
71
82
|
env:
|
|
72
83
|
BUNDLE_GEMFILE: ${{github.workspace}}/${{matrix.gemfile }}
|
|
73
84
|
steps:
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
source 'https://rubygems.org'
|
|
2
|
+
|
|
3
|
+
# Runtime dependencies
|
|
4
|
+
gem 'rails', '~> 8.0.0'
|
|
5
|
+
gem 'mysql2'
|
|
6
|
+
|
|
7
|
+
# Development dependencies
|
|
8
|
+
gem 'rspec', '~> 3.4'
|
|
9
|
+
gem 'rake'
|
|
10
|
+
gem 'byebug'
|
|
11
|
+
gem 'database_cleaner'
|
|
12
|
+
gem 'combustion'
|
|
13
|
+
gem 'gemika'
|
|
14
|
+
gem 'rubocop'
|
|
15
|
+
gem 'rubocop-rails'
|
|
16
|
+
gem 'rubocop-rspec'
|
|
17
|
+
|
|
18
|
+
# Gem under test
|
|
19
|
+
gem 'temporal_tables', :path => '..'
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: ..
|
|
3
|
+
specs:
|
|
4
|
+
temporal_tables (3.0.2)
|
|
5
|
+
rails (>= 6.1, < 8.1)
|
|
6
|
+
|
|
7
|
+
GEM
|
|
8
|
+
remote: https://rubygems.org/
|
|
9
|
+
specs:
|
|
10
|
+
actioncable (8.0.0)
|
|
11
|
+
actionpack (= 8.0.0)
|
|
12
|
+
activesupport (= 8.0.0)
|
|
13
|
+
nio4r (~> 2.0)
|
|
14
|
+
websocket-driver (>= 0.6.1)
|
|
15
|
+
zeitwerk (~> 2.6)
|
|
16
|
+
actionmailbox (8.0.0)
|
|
17
|
+
actionpack (= 8.0.0)
|
|
18
|
+
activejob (= 8.0.0)
|
|
19
|
+
activerecord (= 8.0.0)
|
|
20
|
+
activestorage (= 8.0.0)
|
|
21
|
+
activesupport (= 8.0.0)
|
|
22
|
+
mail (>= 2.8.0)
|
|
23
|
+
actionmailer (8.0.0)
|
|
24
|
+
actionpack (= 8.0.0)
|
|
25
|
+
actionview (= 8.0.0)
|
|
26
|
+
activejob (= 8.0.0)
|
|
27
|
+
activesupport (= 8.0.0)
|
|
28
|
+
mail (>= 2.8.0)
|
|
29
|
+
rails-dom-testing (~> 2.2)
|
|
30
|
+
actionpack (8.0.0)
|
|
31
|
+
actionview (= 8.0.0)
|
|
32
|
+
activesupport (= 8.0.0)
|
|
33
|
+
nokogiri (>= 1.8.5)
|
|
34
|
+
rack (>= 2.2.4)
|
|
35
|
+
rack-session (>= 1.0.1)
|
|
36
|
+
rack-test (>= 0.6.3)
|
|
37
|
+
rails-dom-testing (~> 2.2)
|
|
38
|
+
rails-html-sanitizer (~> 1.6)
|
|
39
|
+
useragent (~> 0.16)
|
|
40
|
+
actiontext (8.0.0)
|
|
41
|
+
actionpack (= 8.0.0)
|
|
42
|
+
activerecord (= 8.0.0)
|
|
43
|
+
activestorage (= 8.0.0)
|
|
44
|
+
activesupport (= 8.0.0)
|
|
45
|
+
globalid (>= 0.6.0)
|
|
46
|
+
nokogiri (>= 1.8.5)
|
|
47
|
+
actionview (8.0.0)
|
|
48
|
+
activesupport (= 8.0.0)
|
|
49
|
+
builder (~> 3.1)
|
|
50
|
+
erubi (~> 1.11)
|
|
51
|
+
rails-dom-testing (~> 2.2)
|
|
52
|
+
rails-html-sanitizer (~> 1.6)
|
|
53
|
+
activejob (8.0.0)
|
|
54
|
+
activesupport (= 8.0.0)
|
|
55
|
+
globalid (>= 0.3.6)
|
|
56
|
+
activemodel (8.0.0)
|
|
57
|
+
activesupport (= 8.0.0)
|
|
58
|
+
activerecord (8.0.0)
|
|
59
|
+
activemodel (= 8.0.0)
|
|
60
|
+
activesupport (= 8.0.0)
|
|
61
|
+
timeout (>= 0.4.0)
|
|
62
|
+
activestorage (8.0.0)
|
|
63
|
+
actionpack (= 8.0.0)
|
|
64
|
+
activejob (= 8.0.0)
|
|
65
|
+
activerecord (= 8.0.0)
|
|
66
|
+
activesupport (= 8.0.0)
|
|
67
|
+
marcel (~> 1.0)
|
|
68
|
+
activesupport (8.0.0)
|
|
69
|
+
base64
|
|
70
|
+
benchmark (>= 0.3)
|
|
71
|
+
bigdecimal
|
|
72
|
+
concurrent-ruby (~> 1.0, >= 1.3.1)
|
|
73
|
+
connection_pool (>= 2.2.5)
|
|
74
|
+
drb
|
|
75
|
+
i18n (>= 1.6, < 2)
|
|
76
|
+
logger (>= 1.4.2)
|
|
77
|
+
minitest (>= 5.1)
|
|
78
|
+
securerandom (>= 0.3)
|
|
79
|
+
tzinfo (~> 2.0, >= 2.0.5)
|
|
80
|
+
uri (>= 0.13.1)
|
|
81
|
+
ast (2.4.2)
|
|
82
|
+
base64 (0.2.0)
|
|
83
|
+
benchmark (0.4.0)
|
|
84
|
+
bigdecimal (3.1.8)
|
|
85
|
+
builder (3.3.0)
|
|
86
|
+
byebug (11.1.3)
|
|
87
|
+
combustion (1.5.0)
|
|
88
|
+
activesupport (>= 3.0.0)
|
|
89
|
+
railties (>= 3.0.0)
|
|
90
|
+
thor (>= 0.14.6)
|
|
91
|
+
concurrent-ruby (1.3.4)
|
|
92
|
+
connection_pool (2.4.1)
|
|
93
|
+
crass (1.0.6)
|
|
94
|
+
database_cleaner (2.1.0)
|
|
95
|
+
database_cleaner-active_record (>= 2, < 3)
|
|
96
|
+
database_cleaner-active_record (2.2.0)
|
|
97
|
+
activerecord (>= 5.a)
|
|
98
|
+
database_cleaner-core (~> 2.0.0)
|
|
99
|
+
database_cleaner-core (2.0.1)
|
|
100
|
+
date (3.4.0)
|
|
101
|
+
diff-lcs (1.5.1)
|
|
102
|
+
drb (2.2.1)
|
|
103
|
+
erubi (1.13.0)
|
|
104
|
+
gemika (0.8.3)
|
|
105
|
+
globalid (1.2.1)
|
|
106
|
+
activesupport (>= 6.1)
|
|
107
|
+
i18n (1.14.6)
|
|
108
|
+
concurrent-ruby (~> 1.0)
|
|
109
|
+
io-console (0.7.2)
|
|
110
|
+
irb (1.14.1)
|
|
111
|
+
rdoc (>= 4.0.0)
|
|
112
|
+
reline (>= 0.4.2)
|
|
113
|
+
json (2.8.2)
|
|
114
|
+
language_server-protocol (3.17.0.3)
|
|
115
|
+
logger (1.6.1)
|
|
116
|
+
loofah (2.23.1)
|
|
117
|
+
crass (~> 1.0.2)
|
|
118
|
+
nokogiri (>= 1.12.0)
|
|
119
|
+
mail (2.8.1)
|
|
120
|
+
mini_mime (>= 0.1.1)
|
|
121
|
+
net-imap
|
|
122
|
+
net-pop
|
|
123
|
+
net-smtp
|
|
124
|
+
marcel (1.0.4)
|
|
125
|
+
mini_mime (1.1.5)
|
|
126
|
+
minitest (5.25.2)
|
|
127
|
+
mysql2 (0.5.6)
|
|
128
|
+
net-imap (0.5.1)
|
|
129
|
+
date
|
|
130
|
+
net-protocol
|
|
131
|
+
net-pop (0.1.2)
|
|
132
|
+
net-protocol
|
|
133
|
+
net-protocol (0.2.2)
|
|
134
|
+
timeout
|
|
135
|
+
net-smtp (0.5.0)
|
|
136
|
+
net-protocol
|
|
137
|
+
nio4r (2.7.4)
|
|
138
|
+
nokogiri (1.16.7-aarch64-linux)
|
|
139
|
+
racc (~> 1.4)
|
|
140
|
+
nokogiri (1.16.7-arm-linux)
|
|
141
|
+
racc (~> 1.4)
|
|
142
|
+
nokogiri (1.16.7-arm64-darwin)
|
|
143
|
+
racc (~> 1.4)
|
|
144
|
+
nokogiri (1.16.7-x86-linux)
|
|
145
|
+
racc (~> 1.4)
|
|
146
|
+
nokogiri (1.16.7-x86_64-darwin)
|
|
147
|
+
racc (~> 1.4)
|
|
148
|
+
nokogiri (1.16.7-x86_64-linux)
|
|
149
|
+
racc (~> 1.4)
|
|
150
|
+
parallel (1.26.3)
|
|
151
|
+
parser (3.3.6.0)
|
|
152
|
+
ast (~> 2.4.1)
|
|
153
|
+
racc
|
|
154
|
+
psych (5.2.0)
|
|
155
|
+
stringio
|
|
156
|
+
racc (1.8.1)
|
|
157
|
+
rack (3.1.8)
|
|
158
|
+
rack-session (2.0.0)
|
|
159
|
+
rack (>= 3.0.0)
|
|
160
|
+
rack-test (2.1.0)
|
|
161
|
+
rack (>= 1.3)
|
|
162
|
+
rackup (2.2.1)
|
|
163
|
+
rack (>= 3)
|
|
164
|
+
rails (8.0.0)
|
|
165
|
+
actioncable (= 8.0.0)
|
|
166
|
+
actionmailbox (= 8.0.0)
|
|
167
|
+
actionmailer (= 8.0.0)
|
|
168
|
+
actionpack (= 8.0.0)
|
|
169
|
+
actiontext (= 8.0.0)
|
|
170
|
+
actionview (= 8.0.0)
|
|
171
|
+
activejob (= 8.0.0)
|
|
172
|
+
activemodel (= 8.0.0)
|
|
173
|
+
activerecord (= 8.0.0)
|
|
174
|
+
activestorage (= 8.0.0)
|
|
175
|
+
activesupport (= 8.0.0)
|
|
176
|
+
bundler (>= 1.15.0)
|
|
177
|
+
railties (= 8.0.0)
|
|
178
|
+
rails-dom-testing (2.2.0)
|
|
179
|
+
activesupport (>= 5.0.0)
|
|
180
|
+
minitest
|
|
181
|
+
nokogiri (>= 1.6)
|
|
182
|
+
rails-html-sanitizer (1.6.0)
|
|
183
|
+
loofah (~> 2.21)
|
|
184
|
+
nokogiri (~> 1.14)
|
|
185
|
+
railties (8.0.0)
|
|
186
|
+
actionpack (= 8.0.0)
|
|
187
|
+
activesupport (= 8.0.0)
|
|
188
|
+
irb (~> 1.13)
|
|
189
|
+
rackup (>= 1.0.0)
|
|
190
|
+
rake (>= 12.2)
|
|
191
|
+
thor (~> 1.0, >= 1.2.2)
|
|
192
|
+
zeitwerk (~> 2.6)
|
|
193
|
+
rainbow (3.1.1)
|
|
194
|
+
rake (13.2.1)
|
|
195
|
+
rdoc (6.8.1)
|
|
196
|
+
psych (>= 4.0.0)
|
|
197
|
+
regexp_parser (2.9.2)
|
|
198
|
+
reline (0.5.11)
|
|
199
|
+
io-console (~> 0.5)
|
|
200
|
+
rspec (3.13.0)
|
|
201
|
+
rspec-core (~> 3.13.0)
|
|
202
|
+
rspec-expectations (~> 3.13.0)
|
|
203
|
+
rspec-mocks (~> 3.13.0)
|
|
204
|
+
rspec-core (3.13.2)
|
|
205
|
+
rspec-support (~> 3.13.0)
|
|
206
|
+
rspec-expectations (3.13.3)
|
|
207
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
208
|
+
rspec-support (~> 3.13.0)
|
|
209
|
+
rspec-mocks (3.13.2)
|
|
210
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
211
|
+
rspec-support (~> 3.13.0)
|
|
212
|
+
rspec-support (3.13.1)
|
|
213
|
+
rubocop (1.69.0)
|
|
214
|
+
json (~> 2.3)
|
|
215
|
+
language_server-protocol (>= 3.17.0)
|
|
216
|
+
parallel (~> 1.10)
|
|
217
|
+
parser (>= 3.3.0.2)
|
|
218
|
+
rainbow (>= 2.2.2, < 4.0)
|
|
219
|
+
regexp_parser (>= 2.4, < 3.0)
|
|
220
|
+
rubocop-ast (>= 1.36.1, < 2.0)
|
|
221
|
+
ruby-progressbar (~> 1.7)
|
|
222
|
+
unicode-display_width (>= 2.4.0, < 4.0)
|
|
223
|
+
rubocop-ast (1.36.2)
|
|
224
|
+
parser (>= 3.3.1.0)
|
|
225
|
+
rubocop-rails (2.27.0)
|
|
226
|
+
activesupport (>= 4.2.0)
|
|
227
|
+
rack (>= 1.1)
|
|
228
|
+
rubocop (>= 1.52.0, < 2.0)
|
|
229
|
+
rubocop-ast (>= 1.31.1, < 2.0)
|
|
230
|
+
rubocop-rspec (3.2.0)
|
|
231
|
+
rubocop (~> 1.61)
|
|
232
|
+
ruby-progressbar (1.13.0)
|
|
233
|
+
securerandom (0.3.2)
|
|
234
|
+
stringio (3.1.2)
|
|
235
|
+
thor (1.3.2)
|
|
236
|
+
timeout (0.4.2)
|
|
237
|
+
tzinfo (2.0.6)
|
|
238
|
+
concurrent-ruby (~> 1.0)
|
|
239
|
+
unicode-display_width (3.1.2)
|
|
240
|
+
unicode-emoji (~> 4.0, >= 4.0.4)
|
|
241
|
+
unicode-emoji (4.0.4)
|
|
242
|
+
uri (1.0.2)
|
|
243
|
+
useragent (0.16.10)
|
|
244
|
+
websocket-driver (0.7.6)
|
|
245
|
+
websocket-extensions (>= 0.1.0)
|
|
246
|
+
websocket-extensions (0.1.5)
|
|
247
|
+
zeitwerk (2.7.1)
|
|
248
|
+
|
|
249
|
+
PLATFORMS
|
|
250
|
+
aarch64-linux
|
|
251
|
+
arm-linux
|
|
252
|
+
arm64-darwin
|
|
253
|
+
x86-linux
|
|
254
|
+
x86_64-darwin
|
|
255
|
+
x86_64-linux
|
|
256
|
+
|
|
257
|
+
DEPENDENCIES
|
|
258
|
+
byebug
|
|
259
|
+
combustion
|
|
260
|
+
database_cleaner
|
|
261
|
+
gemika
|
|
262
|
+
mysql2
|
|
263
|
+
rails (~> 8.0.0)
|
|
264
|
+
rake
|
|
265
|
+
rspec (~> 3.4)
|
|
266
|
+
rubocop
|
|
267
|
+
rubocop-rails
|
|
268
|
+
rubocop-rspec
|
|
269
|
+
temporal_tables!
|
|
270
|
+
|
|
271
|
+
BUNDLED WITH
|
|
272
|
+
2.5.23
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
source 'https://rubygems.org'
|
|
2
|
+
|
|
3
|
+
# Runtime dependencies
|
|
4
|
+
gem 'rails', '~> 7.2.0'
|
|
5
|
+
gem 'pg', '>= 0.18', '< 2.0'
|
|
6
|
+
|
|
7
|
+
# Development dependencies
|
|
8
|
+
gem 'rspec', '~> 3.4'
|
|
9
|
+
gem 'rake'
|
|
10
|
+
gem 'byebug'
|
|
11
|
+
gem 'database_cleaner'
|
|
12
|
+
gem 'combustion'
|
|
13
|
+
gem 'gemika'
|
|
14
|
+
gem 'rubocop'
|
|
15
|
+
gem 'rubocop-rails'
|
|
16
|
+
gem 'rubocop-rspec'
|
|
17
|
+
|
|
18
|
+
# Gem under test
|
|
19
|
+
gem 'temporal_tables', :path => '..'
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: ..
|
|
3
|
+
specs:
|
|
4
|
+
temporal_tables (3.0.2)
|
|
5
|
+
rails (>= 6.1, < 8.1)
|
|
6
|
+
|
|
7
|
+
GEM
|
|
8
|
+
remote: https://rubygems.org/
|
|
9
|
+
specs:
|
|
10
|
+
actioncable (7.2.2)
|
|
11
|
+
actionpack (= 7.2.2)
|
|
12
|
+
activesupport (= 7.2.2)
|
|
13
|
+
nio4r (~> 2.0)
|
|
14
|
+
websocket-driver (>= 0.6.1)
|
|
15
|
+
zeitwerk (~> 2.6)
|
|
16
|
+
actionmailbox (7.2.2)
|
|
17
|
+
actionpack (= 7.2.2)
|
|
18
|
+
activejob (= 7.2.2)
|
|
19
|
+
activerecord (= 7.2.2)
|
|
20
|
+
activestorage (= 7.2.2)
|
|
21
|
+
activesupport (= 7.2.2)
|
|
22
|
+
mail (>= 2.8.0)
|
|
23
|
+
actionmailer (7.2.2)
|
|
24
|
+
actionpack (= 7.2.2)
|
|
25
|
+
actionview (= 7.2.2)
|
|
26
|
+
activejob (= 7.2.2)
|
|
27
|
+
activesupport (= 7.2.2)
|
|
28
|
+
mail (>= 2.8.0)
|
|
29
|
+
rails-dom-testing (~> 2.2)
|
|
30
|
+
actionpack (7.2.2)
|
|
31
|
+
actionview (= 7.2.2)
|
|
32
|
+
activesupport (= 7.2.2)
|
|
33
|
+
nokogiri (>= 1.8.5)
|
|
34
|
+
racc
|
|
35
|
+
rack (>= 2.2.4, < 3.2)
|
|
36
|
+
rack-session (>= 1.0.1)
|
|
37
|
+
rack-test (>= 0.6.3)
|
|
38
|
+
rails-dom-testing (~> 2.2)
|
|
39
|
+
rails-html-sanitizer (~> 1.6)
|
|
40
|
+
useragent (~> 0.16)
|
|
41
|
+
actiontext (7.2.2)
|
|
42
|
+
actionpack (= 7.2.2)
|
|
43
|
+
activerecord (= 7.2.2)
|
|
44
|
+
activestorage (= 7.2.2)
|
|
45
|
+
activesupport (= 7.2.2)
|
|
46
|
+
globalid (>= 0.6.0)
|
|
47
|
+
nokogiri (>= 1.8.5)
|
|
48
|
+
actionview (7.2.2)
|
|
49
|
+
activesupport (= 7.2.2)
|
|
50
|
+
builder (~> 3.1)
|
|
51
|
+
erubi (~> 1.11)
|
|
52
|
+
rails-dom-testing (~> 2.2)
|
|
53
|
+
rails-html-sanitizer (~> 1.6)
|
|
54
|
+
activejob (7.2.2)
|
|
55
|
+
activesupport (= 7.2.2)
|
|
56
|
+
globalid (>= 0.3.6)
|
|
57
|
+
activemodel (7.2.2)
|
|
58
|
+
activesupport (= 7.2.2)
|
|
59
|
+
activerecord (7.2.2)
|
|
60
|
+
activemodel (= 7.2.2)
|
|
61
|
+
activesupport (= 7.2.2)
|
|
62
|
+
timeout (>= 0.4.0)
|
|
63
|
+
activestorage (7.2.2)
|
|
64
|
+
actionpack (= 7.2.2)
|
|
65
|
+
activejob (= 7.2.2)
|
|
66
|
+
activerecord (= 7.2.2)
|
|
67
|
+
activesupport (= 7.2.2)
|
|
68
|
+
marcel (~> 1.0)
|
|
69
|
+
activesupport (7.2.2)
|
|
70
|
+
base64
|
|
71
|
+
benchmark (>= 0.3)
|
|
72
|
+
bigdecimal
|
|
73
|
+
concurrent-ruby (~> 1.0, >= 1.3.1)
|
|
74
|
+
connection_pool (>= 2.2.5)
|
|
75
|
+
drb
|
|
76
|
+
i18n (>= 1.6, < 2)
|
|
77
|
+
logger (>= 1.4.2)
|
|
78
|
+
minitest (>= 5.1)
|
|
79
|
+
securerandom (>= 0.3)
|
|
80
|
+
tzinfo (~> 2.0, >= 2.0.5)
|
|
81
|
+
ast (2.4.2)
|
|
82
|
+
base64 (0.2.0)
|
|
83
|
+
benchmark (0.4.0)
|
|
84
|
+
bigdecimal (3.1.8)
|
|
85
|
+
builder (3.3.0)
|
|
86
|
+
byebug (11.1.3)
|
|
87
|
+
combustion (1.5.0)
|
|
88
|
+
activesupport (>= 3.0.0)
|
|
89
|
+
railties (>= 3.0.0)
|
|
90
|
+
thor (>= 0.14.6)
|
|
91
|
+
concurrent-ruby (1.3.4)
|
|
92
|
+
connection_pool (2.4.1)
|
|
93
|
+
crass (1.0.6)
|
|
94
|
+
database_cleaner (2.1.0)
|
|
95
|
+
database_cleaner-active_record (>= 2, < 3)
|
|
96
|
+
database_cleaner-active_record (2.2.0)
|
|
97
|
+
activerecord (>= 5.a)
|
|
98
|
+
database_cleaner-core (~> 2.0.0)
|
|
99
|
+
database_cleaner-core (2.0.1)
|
|
100
|
+
date (3.4.0)
|
|
101
|
+
diff-lcs (1.5.1)
|
|
102
|
+
drb (2.2.1)
|
|
103
|
+
erubi (1.13.0)
|
|
104
|
+
gemika (0.8.3)
|
|
105
|
+
globalid (1.2.1)
|
|
106
|
+
activesupport (>= 6.1)
|
|
107
|
+
i18n (1.14.6)
|
|
108
|
+
concurrent-ruby (~> 1.0)
|
|
109
|
+
io-console (0.7.2)
|
|
110
|
+
irb (1.14.1)
|
|
111
|
+
rdoc (>= 4.0.0)
|
|
112
|
+
reline (>= 0.4.2)
|
|
113
|
+
json (2.8.2)
|
|
114
|
+
language_server-protocol (3.17.0.3)
|
|
115
|
+
logger (1.6.1)
|
|
116
|
+
loofah (2.23.1)
|
|
117
|
+
crass (~> 1.0.2)
|
|
118
|
+
nokogiri (>= 1.12.0)
|
|
119
|
+
mail (2.8.1)
|
|
120
|
+
mini_mime (>= 0.1.1)
|
|
121
|
+
net-imap
|
|
122
|
+
net-pop
|
|
123
|
+
net-smtp
|
|
124
|
+
marcel (1.0.4)
|
|
125
|
+
mini_mime (1.1.5)
|
|
126
|
+
minitest (5.25.2)
|
|
127
|
+
net-imap (0.5.1)
|
|
128
|
+
date
|
|
129
|
+
net-protocol
|
|
130
|
+
net-pop (0.1.2)
|
|
131
|
+
net-protocol
|
|
132
|
+
net-protocol (0.2.2)
|
|
133
|
+
timeout
|
|
134
|
+
net-smtp (0.5.0)
|
|
135
|
+
net-protocol
|
|
136
|
+
nio4r (2.7.4)
|
|
137
|
+
nokogiri (1.16.7-aarch64-linux)
|
|
138
|
+
racc (~> 1.4)
|
|
139
|
+
nokogiri (1.16.7-arm-linux)
|
|
140
|
+
racc (~> 1.4)
|
|
141
|
+
nokogiri (1.16.7-arm64-darwin)
|
|
142
|
+
racc (~> 1.4)
|
|
143
|
+
nokogiri (1.16.7-x86-linux)
|
|
144
|
+
racc (~> 1.4)
|
|
145
|
+
nokogiri (1.16.7-x86_64-darwin)
|
|
146
|
+
racc (~> 1.4)
|
|
147
|
+
nokogiri (1.16.7-x86_64-linux)
|
|
148
|
+
racc (~> 1.4)
|
|
149
|
+
parallel (1.26.3)
|
|
150
|
+
parser (3.3.6.0)
|
|
151
|
+
ast (~> 2.4.1)
|
|
152
|
+
racc
|
|
153
|
+
pg (1.5.9)
|
|
154
|
+
psych (5.2.0)
|
|
155
|
+
stringio
|
|
156
|
+
racc (1.8.1)
|
|
157
|
+
rack (3.1.8)
|
|
158
|
+
rack-session (2.0.0)
|
|
159
|
+
rack (>= 3.0.0)
|
|
160
|
+
rack-test (2.1.0)
|
|
161
|
+
rack (>= 1.3)
|
|
162
|
+
rackup (2.2.1)
|
|
163
|
+
rack (>= 3)
|
|
164
|
+
rails (7.2.2)
|
|
165
|
+
actioncable (= 7.2.2)
|
|
166
|
+
actionmailbox (= 7.2.2)
|
|
167
|
+
actionmailer (= 7.2.2)
|
|
168
|
+
actionpack (= 7.2.2)
|
|
169
|
+
actiontext (= 7.2.2)
|
|
170
|
+
actionview (= 7.2.2)
|
|
171
|
+
activejob (= 7.2.2)
|
|
172
|
+
activemodel (= 7.2.2)
|
|
173
|
+
activerecord (= 7.2.2)
|
|
174
|
+
activestorage (= 7.2.2)
|
|
175
|
+
activesupport (= 7.2.2)
|
|
176
|
+
bundler (>= 1.15.0)
|
|
177
|
+
railties (= 7.2.2)
|
|
178
|
+
rails-dom-testing (2.2.0)
|
|
179
|
+
activesupport (>= 5.0.0)
|
|
180
|
+
minitest
|
|
181
|
+
nokogiri (>= 1.6)
|
|
182
|
+
rails-html-sanitizer (1.6.0)
|
|
183
|
+
loofah (~> 2.21)
|
|
184
|
+
nokogiri (~> 1.14)
|
|
185
|
+
railties (7.2.2)
|
|
186
|
+
actionpack (= 7.2.2)
|
|
187
|
+
activesupport (= 7.2.2)
|
|
188
|
+
irb (~> 1.13)
|
|
189
|
+
rackup (>= 1.0.0)
|
|
190
|
+
rake (>= 12.2)
|
|
191
|
+
thor (~> 1.0, >= 1.2.2)
|
|
192
|
+
zeitwerk (~> 2.6)
|
|
193
|
+
rainbow (3.1.1)
|
|
194
|
+
rake (13.2.1)
|
|
195
|
+
rdoc (6.8.1)
|
|
196
|
+
psych (>= 4.0.0)
|
|
197
|
+
regexp_parser (2.9.2)
|
|
198
|
+
reline (0.5.11)
|
|
199
|
+
io-console (~> 0.5)
|
|
200
|
+
rspec (3.13.0)
|
|
201
|
+
rspec-core (~> 3.13.0)
|
|
202
|
+
rspec-expectations (~> 3.13.0)
|
|
203
|
+
rspec-mocks (~> 3.13.0)
|
|
204
|
+
rspec-core (3.13.2)
|
|
205
|
+
rspec-support (~> 3.13.0)
|
|
206
|
+
rspec-expectations (3.13.3)
|
|
207
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
208
|
+
rspec-support (~> 3.13.0)
|
|
209
|
+
rspec-mocks (3.13.2)
|
|
210
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
211
|
+
rspec-support (~> 3.13.0)
|
|
212
|
+
rspec-support (3.13.1)
|
|
213
|
+
rubocop (1.69.0)
|
|
214
|
+
json (~> 2.3)
|
|
215
|
+
language_server-protocol (>= 3.17.0)
|
|
216
|
+
parallel (~> 1.10)
|
|
217
|
+
parser (>= 3.3.0.2)
|
|
218
|
+
rainbow (>= 2.2.2, < 4.0)
|
|
219
|
+
regexp_parser (>= 2.4, < 3.0)
|
|
220
|
+
rubocop-ast (>= 1.36.1, < 2.0)
|
|
221
|
+
ruby-progressbar (~> 1.7)
|
|
222
|
+
unicode-display_width (>= 2.4.0, < 4.0)
|
|
223
|
+
rubocop-ast (1.36.2)
|
|
224
|
+
parser (>= 3.3.1.0)
|
|
225
|
+
rubocop-rails (2.27.0)
|
|
226
|
+
activesupport (>= 4.2.0)
|
|
227
|
+
rack (>= 1.1)
|
|
228
|
+
rubocop (>= 1.52.0, < 2.0)
|
|
229
|
+
rubocop-ast (>= 1.31.1, < 2.0)
|
|
230
|
+
rubocop-rspec (3.2.0)
|
|
231
|
+
rubocop (~> 1.61)
|
|
232
|
+
ruby-progressbar (1.13.0)
|
|
233
|
+
securerandom (0.3.2)
|
|
234
|
+
stringio (3.1.2)
|
|
235
|
+
thor (1.3.2)
|
|
236
|
+
timeout (0.4.2)
|
|
237
|
+
tzinfo (2.0.6)
|
|
238
|
+
concurrent-ruby (~> 1.0)
|
|
239
|
+
unicode-display_width (3.1.2)
|
|
240
|
+
unicode-emoji (~> 4.0, >= 4.0.4)
|
|
241
|
+
unicode-emoji (4.0.4)
|
|
242
|
+
useragent (0.16.10)
|
|
243
|
+
websocket-driver (0.7.6)
|
|
244
|
+
websocket-extensions (>= 0.1.0)
|
|
245
|
+
websocket-extensions (0.1.5)
|
|
246
|
+
zeitwerk (2.7.1)
|
|
247
|
+
|
|
248
|
+
PLATFORMS
|
|
249
|
+
aarch64-linux
|
|
250
|
+
arm-linux
|
|
251
|
+
arm64-darwin
|
|
252
|
+
x86-linux
|
|
253
|
+
x86_64-darwin
|
|
254
|
+
x86_64-linux
|
|
255
|
+
|
|
256
|
+
DEPENDENCIES
|
|
257
|
+
byebug
|
|
258
|
+
combustion
|
|
259
|
+
database_cleaner
|
|
260
|
+
gemika
|
|
261
|
+
pg (>= 0.18, < 2.0)
|
|
262
|
+
rails (~> 7.2.0)
|
|
263
|
+
rake
|
|
264
|
+
rspec (~> 3.4)
|
|
265
|
+
rubocop
|
|
266
|
+
rubocop-rails
|
|
267
|
+
rubocop-rspec
|
|
268
|
+
temporal_tables!
|
|
269
|
+
|
|
270
|
+
BUNDLED WITH
|
|
271
|
+
2.5.23
|
data/spec/basic_history_spec.rb
CHANGED
|
@@ -207,7 +207,7 @@ describe Person do
|
|
|
207
207
|
end
|
|
208
208
|
end
|
|
209
209
|
|
|
210
|
-
if TemporalTables::
|
|
210
|
+
if TemporalTables::DatabaseHelper.adapter_name != 'mysql'
|
|
211
211
|
describe 'when changing a creature with an array column' do
|
|
212
212
|
let!(:cat) { Cat.create name: 'Mr. Mittens', nicknames: %w[Blacky Kitty] }
|
|
213
213
|
|
data/spec/spec_helper.rb
CHANGED
|
@@ -9,17 +9,9 @@ Dir["#{File.dirname(__FILE__)}/support/*.rb"].sort.each { |f| require f }
|
|
|
9
9
|
READ_DATABASE_CONFIG_LOCATION = 'spec/internal/config/database.ci.yml'
|
|
10
10
|
WRITE_DATABASE_CONFIG_LOCATION = 'spec/internal/config/database.yml'
|
|
11
11
|
|
|
12
|
-
def adapter_name
|
|
13
|
-
if Gemika::Env.gem?('mysql2')
|
|
14
|
-
'mysql'
|
|
15
|
-
else
|
|
16
|
-
'postgresql'
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
|
|
20
12
|
def database_config_from_gems(file_location)
|
|
21
13
|
config = YAML.load_file(file_location)
|
|
22
|
-
data = config.slice(adapter_name)
|
|
14
|
+
data = config.slice(TemporalTables::DatabaseHelper.adapter_name)
|
|
23
15
|
{ Rails.env.to_s => data }
|
|
24
16
|
end
|
|
25
17
|
|
|
@@ -31,7 +23,7 @@ File.write(
|
|
|
31
23
|
database_config_from_gems(READ_DATABASE_CONFIG_LOCATION).to_yaml
|
|
32
24
|
)
|
|
33
25
|
|
|
34
|
-
Rails.env = adapter_name
|
|
26
|
+
Rails.env = TemporalTables::DatabaseHelper.adapter_name
|
|
35
27
|
database = Gemika::Database.new
|
|
36
28
|
database.connect
|
|
37
29
|
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module TemporalTables
|
|
4
|
+
module DatabaseHelper
|
|
5
|
+
def self.adapter_name
|
|
6
|
+
if Gemika::Env.gem?('pg')
|
|
7
|
+
'postgresql'
|
|
8
|
+
elsif Gemika::Env.gem?('mysql2')
|
|
9
|
+
'mysql'
|
|
10
|
+
else
|
|
11
|
+
raise 'Cannot determine adapter'
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def self.table_exists?(name)
|
|
16
|
+
ActiveRecord::Base.connection.table_exists?(name)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def self.function_exists?(name)
|
|
20
|
+
case adapter_name
|
|
21
|
+
when 'postgresql'
|
|
22
|
+
begin
|
|
23
|
+
ActiveRecord::Base.connection.execute("select(pg_get_functiondef('#{name}'::regprocedure))").present?
|
|
24
|
+
rescue ActiveRecord::StatementInvalid
|
|
25
|
+
false
|
|
26
|
+
end
|
|
27
|
+
when 'mysql' then raise NotImplementedError
|
|
28
|
+
else raise "Unknown adapter #{adapter_name}"
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def self.trigger_exists?(name) # rubocop:disable Metrics/MethodLength
|
|
33
|
+
case adapter_name
|
|
34
|
+
when 'postgresql'
|
|
35
|
+
ActiveRecord::Base.connection.execute(
|
|
36
|
+
"select (pg_get_triggerdef(oid)) FROM pg_trigger WHERE tgname = '#{name}'"
|
|
37
|
+
).first.present?
|
|
38
|
+
when 'mysql'
|
|
39
|
+
ActiveRecord::Base.connection.execute(
|
|
40
|
+
'SHOW TRIGGERS FROM temporal_tables_test'
|
|
41
|
+
).find { |row| row.first == name }.present?
|
|
42
|
+
else
|
|
43
|
+
raise "Unknown adapter #{adapter_name}"
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
@@ -5,28 +5,28 @@ require 'spec_helper'
|
|
|
5
5
|
describe TemporalTables::TemporalAdapter do
|
|
6
6
|
describe '#remove_temporal_table' do
|
|
7
7
|
it 'correctly removes history table, functions and triggers' do
|
|
8
|
-
skip 'mysql has no functions' if adapter_name == 'mysql'
|
|
8
|
+
skip 'mysql has no functions' if TemporalTables::DatabaseHelper.adapter_name == 'mysql'
|
|
9
9
|
|
|
10
10
|
expect do
|
|
11
11
|
ActiveRecord::Schema.define { remove_temporal_table :people }
|
|
12
|
-
end.to change { table_exists?('people_h') }.from(true).to(false)
|
|
13
|
-
.and change { function_exists?('people_ai()') }.from(true).to(false)
|
|
14
|
-
.and change { function_exists?('people_au()') }.from(true).to(false)
|
|
15
|
-
.and change { function_exists?('people_ad()') }.from(true).to(false)
|
|
16
|
-
.and change { trigger_exists?('people_ai') }.from(true).to(false)
|
|
17
|
-
.and change { trigger_exists?('people_au') }.from(true).to(false)
|
|
18
|
-
.and change { trigger_exists?('people_ad') }.from(true).to(false)
|
|
12
|
+
end.to change { TemporalTables::DatabaseHelper.table_exists?('people_h') }.from(true).to(false)
|
|
13
|
+
.and change { TemporalTables::DatabaseHelper.function_exists?('people_ai()') }.from(true).to(false)
|
|
14
|
+
.and change { TemporalTables::DatabaseHelper.function_exists?('people_au()') }.from(true).to(false)
|
|
15
|
+
.and change { TemporalTables::DatabaseHelper.function_exists?('people_ad()') }.from(true).to(false)
|
|
16
|
+
.and change { TemporalTables::DatabaseHelper.trigger_exists?('people_ai') }.from(true).to(false)
|
|
17
|
+
.and change { TemporalTables::DatabaseHelper.trigger_exists?('people_au') }.from(true).to(false)
|
|
18
|
+
.and change { TemporalTables::DatabaseHelper.trigger_exists?('people_ad') }.from(true).to(false)
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
it 'correctly removes history table and triggers' do
|
|
22
|
-
skip 'other adapters than mysql have functions, too' if adapter_name != 'mysql'
|
|
22
|
+
skip 'other adapters than mysql have functions, too' if TemporalTables::DatabaseHelper.adapter_name != 'mysql'
|
|
23
23
|
|
|
24
24
|
expect do
|
|
25
25
|
ActiveRecord::Schema.define { remove_temporal_table :people }
|
|
26
|
-
end.to change { table_exists?('people_h') }.from(true).to(false)
|
|
27
|
-
.and change { trigger_exists?('people_ai') }.from(true).to(false)
|
|
28
|
-
.and change { trigger_exists?('people_au') }.from(true).to(false)
|
|
29
|
-
.and change { trigger_exists?('people_ad') }.from(true).to(false)
|
|
26
|
+
end.to change { TemporalTables::DatabaseHelper.table_exists?('people_h') }.from(true).to(false)
|
|
27
|
+
.and change { TemporalTables::DatabaseHelper.trigger_exists?('people_ai') }.from(true).to(false)
|
|
28
|
+
.and change { TemporalTables::DatabaseHelper.trigger_exists?('people_au') }.from(true).to(false)
|
|
29
|
+
.and change { TemporalTables::DatabaseHelper.trigger_exists?('people_ad') }.from(true).to(false)
|
|
30
30
|
end
|
|
31
31
|
end
|
|
32
32
|
end
|
data/temporal_tables.gemspec
CHANGED
|
@@ -24,7 +24,7 @@ Gem::Specification.new do |gem|
|
|
|
24
24
|
gem.required_ruby_version = '>= 3.0.0'
|
|
25
25
|
gem.metadata = { 'rubygems_mfa_required' => 'true' }
|
|
26
26
|
|
|
27
|
-
gem.add_dependency 'rails', '>= 6.1', '<
|
|
27
|
+
gem.add_dependency 'rails', '>= 6.1', '< 8.1'
|
|
28
28
|
gem.add_development_dependency 'combustion', '~> 1'
|
|
29
29
|
gem.add_development_dependency 'database_cleaner'
|
|
30
30
|
gem.add_development_dependency 'gemika', '~> 0.8'
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: temporal_tables
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.0
|
|
4
|
+
version: 3.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Brent Kroeker
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2025-10-29 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|
|
@@ -19,7 +19,7 @@ dependencies:
|
|
|
19
19
|
version: '6.1'
|
|
20
20
|
- - "<"
|
|
21
21
|
- !ruby/object:Gem::Version
|
|
22
|
-
version: '
|
|
22
|
+
version: '8.1'
|
|
23
23
|
type: :runtime
|
|
24
24
|
prerelease: false
|
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -29,7 +29,7 @@ dependencies:
|
|
|
29
29
|
version: '6.1'
|
|
30
30
|
- - "<"
|
|
31
31
|
- !ruby/object:Gem::Version
|
|
32
|
-
version: '
|
|
32
|
+
version: '8.1'
|
|
33
33
|
- !ruby/object:Gem::Dependency
|
|
34
34
|
name: combustion
|
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -205,6 +205,10 @@ files:
|
|
|
205
205
|
- gemfiles/Gemfile.7.2.mysql.lock
|
|
206
206
|
- gemfiles/Gemfile.7.2.pg
|
|
207
207
|
- gemfiles/Gemfile.7.2.pg.lock
|
|
208
|
+
- gemfiles/Gemfile.8.0.mysql
|
|
209
|
+
- gemfiles/Gemfile.8.0.mysql.lock
|
|
210
|
+
- gemfiles/Gemfile.8.0.pg
|
|
211
|
+
- gemfiles/Gemfile.8.0.pg.lock
|
|
208
212
|
- lib/temporal_tables.rb
|
|
209
213
|
- lib/temporal_tables/arel_table.rb
|
|
210
214
|
- lib/temporal_tables/association_extensions.rb
|
|
@@ -239,7 +243,7 @@ files:
|
|
|
239
243
|
- spec/internal/log/.gitignore
|
|
240
244
|
- spec/internal/public/favicon.ico
|
|
241
245
|
- spec/spec_helper.rb
|
|
242
|
-
- spec/support/
|
|
246
|
+
- spec/support/database_helper.rb
|
|
243
247
|
- spec/temporal_tables/temporal_adapter_spec.rb
|
|
244
248
|
- temporal_tables.gemspec
|
|
245
249
|
homepage: ''
|
|
@@ -261,7 +265,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
261
265
|
- !ruby/object:Gem::Version
|
|
262
266
|
version: '0'
|
|
263
267
|
requirements: []
|
|
264
|
-
rubygems_version: 3.5.
|
|
268
|
+
rubygems_version: 3.5.22
|
|
265
269
|
signing_key:
|
|
266
270
|
specification_version: 4
|
|
267
271
|
summary: Tracks all history of changes to a table automatically in a history table.
|
|
@@ -286,5 +290,5 @@ test_files:
|
|
|
286
290
|
- spec/internal/log/.gitignore
|
|
287
291
|
- spec/internal/public/favicon.ico
|
|
288
292
|
- spec/spec_helper.rb
|
|
289
|
-
- spec/support/
|
|
293
|
+
- spec/support/database_helper.rb
|
|
290
294
|
- spec/temporal_tables/temporal_adapter_spec.rb
|
data/spec/support/database.rb
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
def adapter_name
|
|
4
|
-
if Gemika::Env.gem?('pg')
|
|
5
|
-
'postgresql'
|
|
6
|
-
elsif Gemika::Env.gem?('mysql2')
|
|
7
|
-
'mysql'
|
|
8
|
-
else
|
|
9
|
-
raise 'Cannot determine adapter'
|
|
10
|
-
end
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
def table_exists?(name)
|
|
14
|
-
ActiveRecord::Base.connection.table_exists?(name)
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
def function_exists?(name)
|
|
18
|
-
case adapter_name
|
|
19
|
-
when 'postgresql'
|
|
20
|
-
begin
|
|
21
|
-
ActiveRecord::Base.connection.execute("select(pg_get_functiondef('#{name}'::regprocedure))").present?
|
|
22
|
-
rescue ActiveRecord::StatementInvalid
|
|
23
|
-
false
|
|
24
|
-
end
|
|
25
|
-
when 'mysql' then raise NotImplementedError
|
|
26
|
-
else raise "Unknown adapter #{adapter_name}"
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
def trigger_exists?(name) # rubocop:disable Metrics/MethodLength
|
|
31
|
-
case adapter_name
|
|
32
|
-
when 'postgresql'
|
|
33
|
-
ActiveRecord::Base.connection.execute(
|
|
34
|
-
"select (pg_get_triggerdef(oid)) FROM pg_trigger WHERE tgname = '#{name}'"
|
|
35
|
-
).first.present?
|
|
36
|
-
when 'mysql'
|
|
37
|
-
ActiveRecord::Base.connection.execute(
|
|
38
|
-
'SHOW TRIGGERS FROM temporal_tables_test'
|
|
39
|
-
).find { |row| row.first == name }.present?
|
|
40
|
-
else
|
|
41
|
-
raise "Unknown adapter #{adapter_name}"
|
|
42
|
-
end
|
|
43
|
-
end
|