departure-next 6.7.1.pre.pre

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.
Files changed (65) hide show
  1. checksums.yaml +7 -0
  2. data/.codeclimate.yml +7 -0
  3. data/.github/workflows/test.yml +54 -0
  4. data/.gitignore +14 -0
  5. data/.pryrc +11 -0
  6. data/.rspec +2 -0
  7. data/.rubocop.yml +66 -0
  8. data/.rubocop_todo.yml +238 -0
  9. data/20250312235906_add_deleted_reason_to_newsfeed_activities.rb +5 -0
  10. data/Appraisals +15 -0
  11. data/CHANGELOG.md +224 -0
  12. data/CODE_OF_CONDUCT.md +50 -0
  13. data/Dockerfile +32 -0
  14. data/Gemfile +11 -0
  15. data/Gemfile.lock +206 -0
  16. data/LICENSE.txt +22 -0
  17. data/README.md +246 -0
  18. data/RELEASING.md +17 -0
  19. data/Rakefile +25 -0
  20. data/bin/console +14 -0
  21. data/bin/rails +24 -0
  22. data/bin/rspec +16 -0
  23. data/bin/setup +7 -0
  24. data/config.yml.erb +5 -0
  25. data/configuration.rb +16 -0
  26. data/departure-next.gemspec +34 -0
  27. data/docker-compose.yml +23 -0
  28. data/gemfiles/rails_6_1.gemfile +10 -0
  29. data/gemfiles/rails_6_1.gemfile.lock +243 -0
  30. data/gemfiles/rails_7_0.gemfile +10 -0
  31. data/gemfiles/rails_7_0.gemfile.lock +242 -0
  32. data/gemfiles/rails_7_1.gemfile +10 -0
  33. data/gemfiles/rails_7_1.gemfile.lock +274 -0
  34. data/gemfiles/rails_7_2.gemfile +10 -0
  35. data/gemfiles/rails_7_2.gemfile.lock +274 -0
  36. data/lib/active_record/connection_adapters/for_alter.rb +103 -0
  37. data/lib/active_record/connection_adapters/patch_connection_handling.rb +18 -0
  38. data/lib/active_record/connection_adapters/percona_adapter.rb +187 -0
  39. data/lib/active_record/connection_adapters/rails_7_2_departure_adapter.rb +218 -0
  40. data/lib/departure/alter_argument.rb +49 -0
  41. data/lib/departure/cli_generator.rb +84 -0
  42. data/lib/departure/command.rb +105 -0
  43. data/lib/departure/configuration.rb +21 -0
  44. data/lib/departure/connection_base.rb +11 -0
  45. data/lib/departure/connection_details.rb +121 -0
  46. data/lib/departure/dsn.rb +25 -0
  47. data/lib/departure/errors.rb +39 -0
  48. data/lib/departure/log_sanitizers/password_sanitizer.rb +22 -0
  49. data/lib/departure/logger.rb +42 -0
  50. data/lib/departure/logger_factory.rb +16 -0
  51. data/lib/departure/migration.rb +104 -0
  52. data/lib/departure/null_logger.rb +15 -0
  53. data/lib/departure/option.rb +75 -0
  54. data/lib/departure/rails_adapter.rb +97 -0
  55. data/lib/departure/railtie.rb +21 -0
  56. data/lib/departure/runner.rb +75 -0
  57. data/lib/departure/user_options.rb +44 -0
  58. data/lib/departure/version.rb +3 -0
  59. data/lib/departure.rb +40 -0
  60. data/lib/lhm/adapter.rb +107 -0
  61. data/lib/lhm/column_with_sql.rb +89 -0
  62. data/lib/lhm/column_with_type.rb +29 -0
  63. data/lib/lhm.rb +23 -0
  64. data/test_database.rb +76 -0
  65. metadata +282 -0
@@ -0,0 +1,274 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ departure (6.7.0)
5
+ activerecord (>= 6.0.0, < 7.3.0, != 7.0.0)
6
+ mysql2 (>= 0.4.0, < 0.6.0)
7
+ railties (>= 6.0.0, < 7.3.0, != 7.0.0)
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ actioncable (7.1.3)
13
+ actionpack (= 7.1.3)
14
+ activesupport (= 7.1.3)
15
+ nio4r (~> 2.0)
16
+ websocket-driver (>= 0.6.1)
17
+ zeitwerk (~> 2.6)
18
+ actionmailbox (7.1.3)
19
+ actionpack (= 7.1.3)
20
+ activejob (= 7.1.3)
21
+ activerecord (= 7.1.3)
22
+ activestorage (= 7.1.3)
23
+ activesupport (= 7.1.3)
24
+ mail (>= 2.7.1)
25
+ net-imap
26
+ net-pop
27
+ net-smtp
28
+ actionmailer (7.1.3)
29
+ actionpack (= 7.1.3)
30
+ actionview (= 7.1.3)
31
+ activejob (= 7.1.3)
32
+ activesupport (= 7.1.3)
33
+ mail (~> 2.5, >= 2.5.4)
34
+ net-imap
35
+ net-pop
36
+ net-smtp
37
+ rails-dom-testing (~> 2.2)
38
+ actionpack (7.1.3)
39
+ actionview (= 7.1.3)
40
+ activesupport (= 7.1.3)
41
+ nokogiri (>= 1.8.5)
42
+ racc
43
+ rack (>= 2.2.4)
44
+ rack-session (>= 1.0.1)
45
+ rack-test (>= 0.6.3)
46
+ rails-dom-testing (~> 2.2)
47
+ rails-html-sanitizer (~> 1.6)
48
+ actiontext (7.1.3)
49
+ actionpack (= 7.1.3)
50
+ activerecord (= 7.1.3)
51
+ activestorage (= 7.1.3)
52
+ activesupport (= 7.1.3)
53
+ globalid (>= 0.6.0)
54
+ nokogiri (>= 1.8.5)
55
+ actionview (7.1.3)
56
+ activesupport (= 7.1.3)
57
+ builder (~> 3.1)
58
+ erubi (~> 1.11)
59
+ rails-dom-testing (~> 2.2)
60
+ rails-html-sanitizer (~> 1.6)
61
+ activejob (7.1.3)
62
+ activesupport (= 7.1.3)
63
+ globalid (>= 0.3.6)
64
+ activemodel (7.1.3)
65
+ activesupport (= 7.1.3)
66
+ activerecord (7.1.3)
67
+ activemodel (= 7.1.3)
68
+ activesupport (= 7.1.3)
69
+ timeout (>= 0.4.0)
70
+ activestorage (7.1.3)
71
+ actionpack (= 7.1.3)
72
+ activejob (= 7.1.3)
73
+ activerecord (= 7.1.3)
74
+ activesupport (= 7.1.3)
75
+ marcel (~> 1.0)
76
+ activesupport (7.1.3)
77
+ base64
78
+ bigdecimal
79
+ concurrent-ruby (~> 1.0, >= 1.0.2)
80
+ connection_pool (>= 2.2.5)
81
+ drb
82
+ i18n (>= 1.6, < 2)
83
+ minitest (>= 5.1)
84
+ mutex_m
85
+ tzinfo (~> 2.0)
86
+ appraisal (2.4.1)
87
+ bundler
88
+ rake
89
+ thor (>= 0.14.0)
90
+ ast (2.4.2)
91
+ base64 (0.2.0)
92
+ bigdecimal (3.1.8)
93
+ builder (3.3.0)
94
+ byebug (11.1.3)
95
+ climate_control (0.0.4)
96
+ activesupport (>= 3.0)
97
+ codeclimate-test-reporter (1.0.9)
98
+ simplecov (<= 0.13)
99
+ coderay (1.1.3)
100
+ concurrent-ruby (1.3.3)
101
+ connection_pool (2.4.1)
102
+ crass (1.0.6)
103
+ date (3.3.4)
104
+ diff-lcs (1.5.1)
105
+ docile (1.1.5)
106
+ drb (2.2.1)
107
+ erubi (1.13.0)
108
+ globalid (1.2.1)
109
+ activesupport (>= 6.1)
110
+ i18n (1.14.5)
111
+ concurrent-ruby (~> 1.0)
112
+ io-console (0.7.2)
113
+ irb (1.14.0)
114
+ rdoc (>= 4.0.0)
115
+ reline (>= 0.4.2)
116
+ json (2.7.2)
117
+ language_server-protocol (3.17.0.3)
118
+ loofah (2.22.0)
119
+ crass (~> 1.0.2)
120
+ nokogiri (>= 1.12.0)
121
+ mail (2.8.1)
122
+ mini_mime (>= 0.1.1)
123
+ net-imap
124
+ net-pop
125
+ net-smtp
126
+ marcel (1.0.4)
127
+ method_source (1.1.0)
128
+ mini_mime (1.1.5)
129
+ minitest (5.24.1)
130
+ mutex_m (0.2.0)
131
+ mysql2 (0.5.6)
132
+ net-imap (0.4.12)
133
+ date
134
+ net-protocol
135
+ net-pop (0.1.2)
136
+ net-protocol
137
+ net-protocol (0.2.2)
138
+ timeout
139
+ net-smtp (0.5.0)
140
+ net-protocol
141
+ nio4r (2.7.3)
142
+ nokogiri (1.18.3-arm64-darwin)
143
+ racc (~> 1.4)
144
+ nokogiri (1.18.3-x86_64-linux-gnu)
145
+ racc (~> 1.4)
146
+ parallel (1.25.1)
147
+ parser (3.3.3.0)
148
+ ast (~> 2.4.1)
149
+ racc
150
+ pry (0.14.2)
151
+ coderay (~> 1.1)
152
+ method_source (~> 1.0)
153
+ pry-byebug (3.10.1)
154
+ byebug (~> 11.0)
155
+ pry (>= 0.13, < 0.15)
156
+ psych (5.1.2)
157
+ stringio
158
+ racc (1.8.0)
159
+ rack (3.0.10)
160
+ rack-session (2.0.0)
161
+ rack (>= 3.0.0)
162
+ rack-test (2.1.0)
163
+ rack (>= 1.3)
164
+ rackup (2.1.0)
165
+ rack (>= 3)
166
+ webrick (~> 1.8)
167
+ rails (7.1.3)
168
+ actioncable (= 7.1.3)
169
+ actionmailbox (= 7.1.3)
170
+ actionmailer (= 7.1.3)
171
+ actionpack (= 7.1.3)
172
+ actiontext (= 7.1.3)
173
+ actionview (= 7.1.3)
174
+ activejob (= 7.1.3)
175
+ activemodel (= 7.1.3)
176
+ activerecord (= 7.1.3)
177
+ activestorage (= 7.1.3)
178
+ activesupport (= 7.1.3)
179
+ bundler (>= 1.15.0)
180
+ railties (= 7.1.3)
181
+ rails-dom-testing (2.2.0)
182
+ activesupport (>= 5.0.0)
183
+ minitest
184
+ nokogiri (>= 1.6)
185
+ rails-html-sanitizer (1.6.0)
186
+ loofah (~> 2.21)
187
+ nokogiri (~> 1.14)
188
+ railties (7.1.3)
189
+ actionpack (= 7.1.3)
190
+ activesupport (= 7.1.3)
191
+ irb
192
+ rackup (>= 1.0.0)
193
+ rake (>= 12.2)
194
+ thor (~> 1.0, >= 1.2.2)
195
+ zeitwerk (~> 2.6)
196
+ rainbow (3.1.1)
197
+ rake (13.2.1)
198
+ rdoc (6.7.0)
199
+ psych (>= 4.0.0)
200
+ regexp_parser (2.9.2)
201
+ reline (0.5.9)
202
+ io-console (~> 0.5)
203
+ rexml (3.3.0)
204
+ strscan
205
+ rspec (3.13.0)
206
+ rspec-core (~> 3.13.0)
207
+ rspec-expectations (~> 3.13.0)
208
+ rspec-mocks (~> 3.13.0)
209
+ rspec-core (3.13.0)
210
+ rspec-support (~> 3.13.0)
211
+ rspec-expectations (3.13.1)
212
+ diff-lcs (>= 1.2.0, < 2.0)
213
+ rspec-support (~> 3.13.0)
214
+ rspec-its (1.3.0)
215
+ rspec-core (>= 3.0.0)
216
+ rspec-expectations (>= 3.0.0)
217
+ rspec-mocks (3.13.1)
218
+ diff-lcs (>= 1.2.0, < 2.0)
219
+ rspec-support (~> 3.13.0)
220
+ rspec-support (3.13.1)
221
+ rubocop (1.60.2)
222
+ json (~> 2.3)
223
+ language_server-protocol (>= 3.17.0)
224
+ parallel (~> 1.10)
225
+ parser (>= 3.3.0.2)
226
+ rainbow (>= 2.2.2, < 4.0)
227
+ regexp_parser (>= 1.8, < 3.0)
228
+ rexml (>= 3.2.5, < 4.0)
229
+ rubocop-ast (>= 1.30.0, < 2.0)
230
+ ruby-progressbar (~> 1.7)
231
+ unicode-display_width (>= 2.4.0, < 3.0)
232
+ rubocop-ast (1.31.3)
233
+ parser (>= 3.3.1.0)
234
+ rubocop-performance (1.20.2)
235
+ rubocop (>= 1.48.1, < 2.0)
236
+ rubocop-ast (>= 1.30.0, < 2.0)
237
+ ruby-progressbar (1.13.0)
238
+ simplecov (0.13.0)
239
+ docile (~> 1.1.0)
240
+ json (>= 1.8, < 3)
241
+ simplecov-html (~> 0.10.0)
242
+ simplecov-html (0.10.2)
243
+ stringio (3.1.1)
244
+ strscan (3.1.0)
245
+ thor (1.3.1)
246
+ timeout (0.4.1)
247
+ tzinfo (2.0.6)
248
+ concurrent-ruby (~> 1.0)
249
+ unicode-display_width (2.5.0)
250
+ webrick (1.8.1)
251
+ websocket-driver (0.7.6)
252
+ websocket-extensions (>= 0.1.0)
253
+ websocket-extensions (0.1.5)
254
+ zeitwerk (2.6.16)
255
+
256
+ PLATFORMS
257
+ arm64-darwin-23
258
+ x86_64-linux
259
+
260
+ DEPENDENCIES
261
+ appraisal (~> 2.4.1)
262
+ climate_control (~> 0.0.3)
263
+ codeclimate-test-reporter (~> 1.0.3)
264
+ departure!
265
+ pry-byebug
266
+ rails (= 7.1.3)
267
+ rake (>= 10.0)
268
+ rspec (~> 3.4, >= 3.4.0)
269
+ rspec-its (~> 1.2)
270
+ rubocop (~> 1.60.2)
271
+ rubocop-performance (~> 1.20.2)
272
+
273
+ BUNDLED WITH
274
+ 2.4.22
@@ -0,0 +1,10 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ gem 'codeclimate-test-reporter', '~> 1.0.3', group: :test, require: nil
6
+ gem 'rails', '7.2.2.1'
7
+ gem 'rubocop', '~> 1.60.2', require: false
8
+ gem 'rubocop-performance', '~> 1.20.2', require: false
9
+
10
+ gemspec path: '../'
@@ -0,0 +1,274 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ departure (6.7.0)
5
+ activerecord (>= 6.0.0, < 7.3.0, != 7.0.0)
6
+ mysql2 (>= 0.4.0, < 0.6.0)
7
+ railties (>= 6.0.0, < 7.3.0, != 7.0.0)
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ actioncable (7.2.2.1)
13
+ actionpack (= 7.2.2.1)
14
+ activesupport (= 7.2.2.1)
15
+ nio4r (~> 2.0)
16
+ websocket-driver (>= 0.6.1)
17
+ zeitwerk (~> 2.6)
18
+ actionmailbox (7.2.2.1)
19
+ actionpack (= 7.2.2.1)
20
+ activejob (= 7.2.2.1)
21
+ activerecord (= 7.2.2.1)
22
+ activestorage (= 7.2.2.1)
23
+ activesupport (= 7.2.2.1)
24
+ mail (>= 2.8.0)
25
+ actionmailer (7.2.2.1)
26
+ actionpack (= 7.2.2.1)
27
+ actionview (= 7.2.2.1)
28
+ activejob (= 7.2.2.1)
29
+ activesupport (= 7.2.2.1)
30
+ mail (>= 2.8.0)
31
+ rails-dom-testing (~> 2.2)
32
+ actionpack (7.2.2.1)
33
+ actionview (= 7.2.2.1)
34
+ activesupport (= 7.2.2.1)
35
+ nokogiri (>= 1.8.5)
36
+ racc
37
+ rack (>= 2.2.4, < 3.2)
38
+ rack-session (>= 1.0.1)
39
+ rack-test (>= 0.6.3)
40
+ rails-dom-testing (~> 2.2)
41
+ rails-html-sanitizer (~> 1.6)
42
+ useragent (~> 0.16)
43
+ actiontext (7.2.2.1)
44
+ actionpack (= 7.2.2.1)
45
+ activerecord (= 7.2.2.1)
46
+ activestorage (= 7.2.2.1)
47
+ activesupport (= 7.2.2.1)
48
+ globalid (>= 0.6.0)
49
+ nokogiri (>= 1.8.5)
50
+ actionview (7.2.2.1)
51
+ activesupport (= 7.2.2.1)
52
+ builder (~> 3.1)
53
+ erubi (~> 1.11)
54
+ rails-dom-testing (~> 2.2)
55
+ rails-html-sanitizer (~> 1.6)
56
+ activejob (7.2.2.1)
57
+ activesupport (= 7.2.2.1)
58
+ globalid (>= 0.3.6)
59
+ activemodel (7.2.2.1)
60
+ activesupport (= 7.2.2.1)
61
+ activerecord (7.2.2.1)
62
+ activemodel (= 7.2.2.1)
63
+ activesupport (= 7.2.2.1)
64
+ timeout (>= 0.4.0)
65
+ activestorage (7.2.2.1)
66
+ actionpack (= 7.2.2.1)
67
+ activejob (= 7.2.2.1)
68
+ activerecord (= 7.2.2.1)
69
+ activesupport (= 7.2.2.1)
70
+ marcel (~> 1.0)
71
+ activesupport (7.2.2.1)
72
+ base64
73
+ benchmark (>= 0.3)
74
+ bigdecimal
75
+ concurrent-ruby (~> 1.0, >= 1.3.1)
76
+ connection_pool (>= 2.2.5)
77
+ drb
78
+ i18n (>= 1.6, < 2)
79
+ logger (>= 1.4.2)
80
+ minitest (>= 5.1)
81
+ securerandom (>= 0.3)
82
+ tzinfo (~> 2.0, >= 2.0.5)
83
+ appraisal (2.4.1)
84
+ bundler
85
+ rake
86
+ thor (>= 0.14.0)
87
+ ast (2.4.2)
88
+ base64 (0.2.0)
89
+ benchmark (0.4.0)
90
+ bigdecimal (3.1.9)
91
+ builder (3.3.0)
92
+ byebug (11.1.3)
93
+ climate_control (0.0.4)
94
+ activesupport (>= 3.0)
95
+ codeclimate-test-reporter (1.0.9)
96
+ simplecov (<= 0.13)
97
+ coderay (1.1.3)
98
+ concurrent-ruby (1.3.5)
99
+ connection_pool (2.5.0)
100
+ crass (1.0.6)
101
+ date (3.4.1)
102
+ diff-lcs (1.6.0)
103
+ docile (1.1.5)
104
+ drb (2.2.1)
105
+ erubi (1.13.1)
106
+ globalid (1.2.1)
107
+ activesupport (>= 6.1)
108
+ i18n (1.14.7)
109
+ concurrent-ruby (~> 1.0)
110
+ io-console (0.8.0)
111
+ irb (1.15.1)
112
+ pp (>= 0.6.0)
113
+ rdoc (>= 4.0.0)
114
+ reline (>= 0.4.2)
115
+ json (2.10.1)
116
+ language_server-protocol (3.17.0.4)
117
+ logger (1.6.6)
118
+ loofah (2.24.0)
119
+ crass (~> 1.0.2)
120
+ nokogiri (>= 1.12.0)
121
+ mail (2.8.1)
122
+ mini_mime (>= 0.1.1)
123
+ net-imap
124
+ net-pop
125
+ net-smtp
126
+ marcel (1.0.4)
127
+ method_source (1.1.0)
128
+ mini_mime (1.1.5)
129
+ minitest (5.25.4)
130
+ mysql2 (0.5.6)
131
+ net-imap (0.5.6)
132
+ date
133
+ net-protocol
134
+ net-pop (0.1.2)
135
+ net-protocol
136
+ net-protocol (0.2.2)
137
+ timeout
138
+ net-smtp (0.5.1)
139
+ net-protocol
140
+ nio4r (2.7.4)
141
+ nokogiri (1.18.3-x86_64-linux-gnu)
142
+ racc (~> 1.4)
143
+ parallel (1.26.3)
144
+ parser (3.3.7.1)
145
+ ast (~> 2.4.1)
146
+ racc
147
+ pp (0.6.2)
148
+ prettyprint
149
+ prettyprint (0.2.0)
150
+ pry (0.14.2)
151
+ coderay (~> 1.1)
152
+ method_source (~> 1.0)
153
+ pry-byebug (3.10.1)
154
+ byebug (~> 11.0)
155
+ pry (>= 0.13, < 0.15)
156
+ psych (5.2.3)
157
+ date
158
+ stringio
159
+ racc (1.8.1)
160
+ rack (3.1.11)
161
+ rack-session (2.1.0)
162
+ base64 (>= 0.1.0)
163
+ rack (>= 3.0.0)
164
+ rack-test (2.2.0)
165
+ rack (>= 1.3)
166
+ rackup (2.2.1)
167
+ rack (>= 3)
168
+ rails (7.2.2.1)
169
+ actioncable (= 7.2.2.1)
170
+ actionmailbox (= 7.2.2.1)
171
+ actionmailer (= 7.2.2.1)
172
+ actionpack (= 7.2.2.1)
173
+ actiontext (= 7.2.2.1)
174
+ actionview (= 7.2.2.1)
175
+ activejob (= 7.2.2.1)
176
+ activemodel (= 7.2.2.1)
177
+ activerecord (= 7.2.2.1)
178
+ activestorage (= 7.2.2.1)
179
+ activesupport (= 7.2.2.1)
180
+ bundler (>= 1.15.0)
181
+ railties (= 7.2.2.1)
182
+ rails-dom-testing (2.2.0)
183
+ activesupport (>= 5.0.0)
184
+ minitest
185
+ nokogiri (>= 1.6)
186
+ rails-html-sanitizer (1.6.2)
187
+ loofah (~> 2.21)
188
+ nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
189
+ railties (7.2.2.1)
190
+ actionpack (= 7.2.2.1)
191
+ activesupport (= 7.2.2.1)
192
+ irb (~> 1.13)
193
+ rackup (>= 1.0.0)
194
+ rake (>= 12.2)
195
+ thor (~> 1.0, >= 1.2.2)
196
+ zeitwerk (~> 2.6)
197
+ rainbow (3.1.1)
198
+ rake (13.2.1)
199
+ rdoc (6.12.0)
200
+ psych (>= 4.0.0)
201
+ regexp_parser (2.10.0)
202
+ reline (0.6.0)
203
+ io-console (~> 0.5)
204
+ rexml (3.4.1)
205
+ rspec (3.13.0)
206
+ rspec-core (~> 3.13.0)
207
+ rspec-expectations (~> 3.13.0)
208
+ rspec-mocks (~> 3.13.0)
209
+ rspec-core (3.13.3)
210
+ rspec-support (~> 3.13.0)
211
+ rspec-expectations (3.13.3)
212
+ diff-lcs (>= 1.2.0, < 2.0)
213
+ rspec-support (~> 3.13.0)
214
+ rspec-its (1.3.1)
215
+ rspec-core (>= 3.0.0)
216
+ rspec-expectations (>= 3.0.0)
217
+ rspec-mocks (3.13.2)
218
+ diff-lcs (>= 1.2.0, < 2.0)
219
+ rspec-support (~> 3.13.0)
220
+ rspec-support (3.13.2)
221
+ rubocop (1.60.2)
222
+ json (~> 2.3)
223
+ language_server-protocol (>= 3.17.0)
224
+ parallel (~> 1.10)
225
+ parser (>= 3.3.0.2)
226
+ rainbow (>= 2.2.2, < 4.0)
227
+ regexp_parser (>= 1.8, < 3.0)
228
+ rexml (>= 3.2.5, < 4.0)
229
+ rubocop-ast (>= 1.30.0, < 2.0)
230
+ ruby-progressbar (~> 1.7)
231
+ unicode-display_width (>= 2.4.0, < 3.0)
232
+ rubocop-ast (1.38.1)
233
+ parser (>= 3.3.1.0)
234
+ rubocop-performance (1.20.2)
235
+ rubocop (>= 1.48.1, < 2.0)
236
+ rubocop-ast (>= 1.30.0, < 2.0)
237
+ ruby-progressbar (1.13.0)
238
+ securerandom (0.4.1)
239
+ simplecov (0.13.0)
240
+ docile (~> 1.1.0)
241
+ json (>= 1.8, < 3)
242
+ simplecov-html (~> 0.10.0)
243
+ simplecov-html (0.10.2)
244
+ stringio (3.1.5)
245
+ thor (1.3.2)
246
+ timeout (0.4.3)
247
+ tzinfo (2.0.6)
248
+ concurrent-ruby (~> 1.0)
249
+ unicode-display_width (2.6.0)
250
+ useragent (0.16.11)
251
+ websocket-driver (0.7.7)
252
+ base64
253
+ websocket-extensions (>= 0.1.0)
254
+ websocket-extensions (0.1.5)
255
+ zeitwerk (2.6.18)
256
+
257
+ PLATFORMS
258
+ x86_64-linux
259
+
260
+ DEPENDENCIES
261
+ appraisal (~> 2.4.1)
262
+ climate_control (~> 0.0.3)
263
+ codeclimate-test-reporter (~> 1.0.3)
264
+ departure!
265
+ pry-byebug
266
+ rails (= 7.2.2.1)
267
+ rake (>= 10.0)
268
+ rspec (~> 3.4, >= 3.4.0)
269
+ rspec-its (~> 1.2)
270
+ rubocop (~> 1.60.2)
271
+ rubocop-performance (~> 1.20.2)
272
+
273
+ BUNDLED WITH
274
+ 2.4.22
@@ -0,0 +1,103 @@
1
+ require 'active_record/connection_adapters/mysql/schema_statements'
2
+
3
+ module ForAlterStatements
4
+ class << self
5
+ def included(_)
6
+ STDERR.puts 'Including for_alter statements'
7
+ end
8
+ end
9
+
10
+ def bulk_change_table(table_name, operations) #:nodoc:
11
+ sqls = operations.flat_map do |command, args|
12
+ table = args.shift
13
+ arguments = args
14
+
15
+ method = :"#{command}_for_alter"
16
+
17
+ raise "Unknown method called : #{method}(#{arguments.inspect})" unless respond_to?(method, true)
18
+ public_send(method, table, *arguments)
19
+ end.join(', ')
20
+
21
+ execute("ALTER TABLE #{quote_table_name(table_name)} #{sqls}")
22
+ end
23
+
24
+ def change_column_for_alter(table_name, column_name, type, options = {})
25
+ column = column_for(table_name, column_name)
26
+ type ||= column.sql_type
27
+
28
+ options = {
29
+ default: column.default,
30
+ null: column.null,
31
+ comment: column.comment
32
+ }.merge(options)
33
+
34
+ td = create_table_definition(table_name)
35
+ cd = td.new_column_definition(column.name, type, **options)
36
+ schema_creation.accept(ActiveRecord::ConnectionAdapters::ChangeColumnDefinition.new(cd, column.name))
37
+ end
38
+
39
+ def rename_column_for_alter(table_name, column_name, new_column_name)
40
+ column = column_for(table_name, column_name)
41
+ options = {
42
+ default: column.default,
43
+ null: column.null,
44
+ auto_increment: column.auto_increment?
45
+ }
46
+
47
+ columns_sql = "SHOW COLUMNS FROM #{quote_table_name(table_name)} LIKE #{quote(column_name)}"
48
+ current_type = exec_query(columns_sql, 'SCHEMA').first['Type']
49
+ td = create_table_definition(table_name)
50
+ cd = td.new_column_definition(new_column_name, current_type, **options)
51
+ schema_creation.accept(ActiveRecord::ConnectionAdapters::ChangeColumnDefinition.new(cd, column.name))
52
+ end
53
+
54
+ def add_index_for_alter(table_name, column_name, options = {})
55
+ if ActiveRecord::VERSION::STRING >= '6.1'
56
+ index_definition, = add_index_options(table_name, column_name, **options)
57
+
58
+ "ADD #{schema_creation.accept(index_definition)}"
59
+ else
60
+ index_name, index_type, index_columns, _,
61
+ index_algorithm, index_using = add_index_options(table_name, column_name, **options)
62
+ index_algorithm[0, 0] = ', ' if index_algorithm.present?
63
+
64
+ "ADD #{index_type} INDEX #{quote_column_name(index_name)} #{index_using} (#{index_columns})#{index_algorithm}"
65
+ end
66
+ end
67
+
68
+ def remove_index_for_alter(table_name, column_name = nil, **options)
69
+ index_name =
70
+ if ActiveRecord::VERSION::STRING >= '6.1'
71
+ index_name_for_remove(table_name, column_name, options)
72
+ else
73
+ options = [column_name, options] if column_name
74
+ index_name_for_remove(table_name, options)
75
+ end
76
+ "DROP INDEX #{quote_column_name(index_name)}"
77
+ end
78
+
79
+ def add_timestamps_for_alter(table_name, options = {})
80
+ [
81
+ add_column_for_alter(table_name, :created_at, :datetime, options),
82
+ add_column_for_alter(table_name, :updated_at, :datetime, options)
83
+ ]
84
+ end
85
+
86
+ def remove_timestamps_for_alter(table_name, _options = {})
87
+ [remove_column_for_alter(table_name, :updated_at), remove_column_for_alter(table_name, :created_at)]
88
+ end
89
+
90
+ def add_column_for_alter(table_name, column_name, type, options = {})
91
+ td = create_table_definition(table_name)
92
+ cd = td.new_column_definition(column_name, type, **options)
93
+ schema_creation.accept(ActiveRecord::ConnectionAdapters::AddColumnDefinition.new(cd))
94
+ end
95
+
96
+ def remove_column_for_alter(_table_name, column_name, _type = nil, _options = {})
97
+ "DROP COLUMN #{quote_column_name(column_name)}"
98
+ end
99
+
100
+ def remove_columns_for_alter(table_name, *column_names, **options)
101
+ column_names.map { |column_name| remove_column_for_alter(table_name, column_name) }
102
+ end
103
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'active_record/connection_handling'
4
+
5
+ module ActiveRecord
6
+ module ConnectionHandling
7
+ # Establishes a connection to the database that's used by all Active
8
+ # Record objects.
9
+ def percona_connection(config)
10
+ if config[:username].nil?
11
+ config = config.dup if config.frozen?
12
+ config[:username] = 'root'
13
+ end
14
+
15
+ Departure::RailsAdapter.for_current.create_connection_adapter(**config)
16
+ end
17
+ end
18
+ end