rails_sql_prettifier 7.0.5 → 7.0.7

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.
@@ -0,0 +1,273 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ rails_sql_prettifier (7.0.6)
5
+ activerecord (>= 7)
6
+ niceql (~> 0.6)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ actioncable (7.2.2.1)
12
+ actionpack (= 7.2.2.1)
13
+ activesupport (= 7.2.2.1)
14
+ nio4r (~> 2.0)
15
+ websocket-driver (>= 0.6.1)
16
+ zeitwerk (~> 2.6)
17
+ actionmailbox (7.2.2.1)
18
+ actionpack (= 7.2.2.1)
19
+ activejob (= 7.2.2.1)
20
+ activerecord (= 7.2.2.1)
21
+ activestorage (= 7.2.2.1)
22
+ activesupport (= 7.2.2.1)
23
+ mail (>= 2.8.0)
24
+ actionmailer (7.2.2.1)
25
+ actionpack (= 7.2.2.1)
26
+ actionview (= 7.2.2.1)
27
+ activejob (= 7.2.2.1)
28
+ activesupport (= 7.2.2.1)
29
+ mail (>= 2.8.0)
30
+ rails-dom-testing (~> 2.2)
31
+ actionpack (7.2.2.1)
32
+ actionview (= 7.2.2.1)
33
+ activesupport (= 7.2.2.1)
34
+ nokogiri (>= 1.8.5)
35
+ racc
36
+ rack (>= 2.2.4, < 3.2)
37
+ rack-session (>= 1.0.1)
38
+ rack-test (>= 0.6.3)
39
+ rails-dom-testing (~> 2.2)
40
+ rails-html-sanitizer (~> 1.6)
41
+ useragent (~> 0.16)
42
+ actiontext (7.2.2.1)
43
+ actionpack (= 7.2.2.1)
44
+ activerecord (= 7.2.2.1)
45
+ activestorage (= 7.2.2.1)
46
+ activesupport (= 7.2.2.1)
47
+ globalid (>= 0.6.0)
48
+ nokogiri (>= 1.8.5)
49
+ actionview (7.2.2.1)
50
+ activesupport (= 7.2.2.1)
51
+ builder (~> 3.1)
52
+ erubi (~> 1.11)
53
+ rails-dom-testing (~> 2.2)
54
+ rails-html-sanitizer (~> 1.6)
55
+ activejob (7.2.2.1)
56
+ activesupport (= 7.2.2.1)
57
+ globalid (>= 0.3.6)
58
+ activemodel (7.2.2.1)
59
+ activesupport (= 7.2.2.1)
60
+ activerecord (7.2.2.1)
61
+ activemodel (= 7.2.2.1)
62
+ activesupport (= 7.2.2.1)
63
+ timeout (>= 0.4.0)
64
+ activestorage (7.2.2.1)
65
+ actionpack (= 7.2.2.1)
66
+ activejob (= 7.2.2.1)
67
+ activerecord (= 7.2.2.1)
68
+ activesupport (= 7.2.2.1)
69
+ marcel (~> 1.0)
70
+ activesupport (7.2.2.1)
71
+ base64
72
+ benchmark (>= 0.3)
73
+ bigdecimal
74
+ concurrent-ruby (~> 1.0, >= 1.3.1)
75
+ connection_pool (>= 2.2.5)
76
+ drb
77
+ i18n (>= 1.6, < 2)
78
+ logger (>= 1.4.2)
79
+ minitest (>= 5.1)
80
+ securerandom (>= 0.3)
81
+ tzinfo (~> 2.0, >= 2.0.5)
82
+ appraisal (2.5.0)
83
+ bundler
84
+ rake
85
+ thor (>= 0.14.0)
86
+ ast (2.4.2)
87
+ awesome_print (1.9.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
+ coderay (1.1.3)
94
+ concurrent-ruby (1.3.5)
95
+ connection_pool (2.5.0)
96
+ crass (1.0.6)
97
+ date (3.4.1)
98
+ differ (0.1.2)
99
+ drb (2.2.1)
100
+ erubi (1.13.1)
101
+ globalid (1.2.1)
102
+ activesupport (>= 6.1)
103
+ i18n (1.14.7)
104
+ concurrent-ruby (~> 1.0)
105
+ io-console (0.8.0)
106
+ irb (1.15.1)
107
+ pp (>= 0.6.0)
108
+ rdoc (>= 4.0.0)
109
+ reline (>= 0.4.2)
110
+ json (2.10.1)
111
+ language_server-protocol (3.17.0.4)
112
+ lint_roller (1.1.0)
113
+ logger (1.6.6)
114
+ loofah (2.24.0)
115
+ crass (~> 1.0.2)
116
+ nokogiri (>= 1.12.0)
117
+ mail (2.8.1)
118
+ mini_mime (>= 0.1.1)
119
+ net-imap
120
+ net-pop
121
+ net-smtp
122
+ marcel (1.0.4)
123
+ method_source (1.1.0)
124
+ mini_mime (1.1.5)
125
+ minitest (5.25.4)
126
+ net-imap (0.5.6)
127
+ date
128
+ net-protocol
129
+ net-pop (0.1.2)
130
+ net-protocol
131
+ net-protocol (0.2.2)
132
+ timeout
133
+ net-smtp (0.5.1)
134
+ net-protocol
135
+ niceql (0.6.1)
136
+ nio4r (2.7.4)
137
+ nokogiri (1.18.3-aarch64-linux-gnu)
138
+ racc (~> 1.4)
139
+ nokogiri (1.18.3-aarch64-linux-musl)
140
+ racc (~> 1.4)
141
+ nokogiri (1.18.3-arm-linux-gnu)
142
+ racc (~> 1.4)
143
+ nokogiri (1.18.3-arm-linux-musl)
144
+ racc (~> 1.4)
145
+ nokogiri (1.18.3-arm64-darwin)
146
+ racc (~> 1.4)
147
+ nokogiri (1.18.3-x86_64-darwin)
148
+ racc (~> 1.4)
149
+ nokogiri (1.18.3-x86_64-linux-gnu)
150
+ racc (~> 1.4)
151
+ nokogiri (1.18.3-x86_64-linux-musl)
152
+ racc (~> 1.4)
153
+ parallel (1.26.3)
154
+ parser (3.3.7.1)
155
+ ast (~> 2.4.1)
156
+ racc
157
+ pg (1.5.9)
158
+ pp (0.6.2)
159
+ prettyprint
160
+ prettyprint (0.2.0)
161
+ pry (0.14.2)
162
+ coderay (~> 1.1)
163
+ method_source (~> 1.0)
164
+ pry-byebug (3.10.1)
165
+ byebug (~> 11.0)
166
+ pry (>= 0.13, < 0.15)
167
+ psych (5.2.3)
168
+ date
169
+ stringio
170
+ racc (1.8.1)
171
+ rack (3.1.10)
172
+ rack-session (2.1.0)
173
+ base64 (>= 0.1.0)
174
+ rack (>= 3.0.0)
175
+ rack-test (2.2.0)
176
+ rack (>= 1.3)
177
+ rackup (2.2.1)
178
+ rack (>= 3)
179
+ rails (7.2.2.1)
180
+ actioncable (= 7.2.2.1)
181
+ actionmailbox (= 7.2.2.1)
182
+ actionmailer (= 7.2.2.1)
183
+ actionpack (= 7.2.2.1)
184
+ actiontext (= 7.2.2.1)
185
+ actionview (= 7.2.2.1)
186
+ activejob (= 7.2.2.1)
187
+ activemodel (= 7.2.2.1)
188
+ activerecord (= 7.2.2.1)
189
+ activestorage (= 7.2.2.1)
190
+ activesupport (= 7.2.2.1)
191
+ bundler (>= 1.15.0)
192
+ railties (= 7.2.2.1)
193
+ rails-dom-testing (2.2.0)
194
+ activesupport (>= 5.0.0)
195
+ minitest
196
+ nokogiri (>= 1.6)
197
+ rails-html-sanitizer (1.6.2)
198
+ loofah (~> 2.21)
199
+ 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)
200
+ railties (7.2.2.1)
201
+ actionpack (= 7.2.2.1)
202
+ activesupport (= 7.2.2.1)
203
+ irb (~> 1.13)
204
+ rackup (>= 1.0.0)
205
+ rake (>= 12.2)
206
+ thor (~> 1.0, >= 1.2.2)
207
+ zeitwerk (~> 2.6)
208
+ rainbow (3.1.1)
209
+ rake (13.2.1)
210
+ rdoc (6.12.0)
211
+ psych (>= 4.0.0)
212
+ regexp_parser (2.10.0)
213
+ reline (0.6.0)
214
+ io-console (~> 0.5)
215
+ rubocop (1.72.2)
216
+ json (~> 2.3)
217
+ language_server-protocol (~> 3.17.0.2)
218
+ lint_roller (~> 1.1.0)
219
+ parallel (~> 1.10)
220
+ parser (>= 3.3.0.2)
221
+ rainbow (>= 2.2.2, < 4.0)
222
+ regexp_parser (>= 2.9.3, < 3.0)
223
+ rubocop-ast (>= 1.38.0, < 2.0)
224
+ ruby-progressbar (~> 1.7)
225
+ unicode-display_width (>= 2.4.0, < 4.0)
226
+ rubocop-ast (1.38.0)
227
+ parser (>= 3.3.1.0)
228
+ rubocop-shopify (2.15.1)
229
+ rubocop (~> 1.51)
230
+ ruby-progressbar (1.13.0)
231
+ securerandom (0.4.1)
232
+ stringio (3.1.5)
233
+ stubberry (0.3.0)
234
+ thor (1.3.2)
235
+ timeout (0.4.3)
236
+ tzinfo (2.0.6)
237
+ concurrent-ruby (~> 1.0)
238
+ unicode-display_width (3.1.4)
239
+ unicode-emoji (~> 4.0, >= 4.0.4)
240
+ unicode-emoji (4.0.4)
241
+ useragent (0.16.11)
242
+ websocket-driver (0.7.7)
243
+ base64
244
+ websocket-extensions (>= 0.1.0)
245
+ websocket-extensions (0.1.5)
246
+ zeitwerk (2.7.2)
247
+
248
+ PLATFORMS
249
+ aarch64-linux-gnu
250
+ aarch64-linux-musl
251
+ arm-linux-gnu
252
+ arm-linux-musl
253
+ arm64-darwin
254
+ x86_64-darwin
255
+ x86_64-linux-gnu
256
+ x86_64-linux-musl
257
+
258
+ DEPENDENCIES
259
+ appraisal
260
+ awesome_print
261
+ bundler (>= 1)
262
+ differ (~> 0.1)
263
+ minitest (~> 5.0)
264
+ pg (~> 1)
265
+ pry-byebug (~> 3.9)
266
+ rails (~> 7.1)
267
+ rails_sql_prettifier!
268
+ rake (>= 12.3.3)
269
+ rubocop-shopify
270
+ stubberry (~> 0.2)
271
+
272
+ BUNDLED WITH
273
+ 2.6.5
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rails", ">= 8"
6
+
7
+ gemspec path: "../"
@@ -0,0 +1,274 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ rails_sql_prettifier (7.0.6)
5
+ activerecord (>= 7)
6
+ niceql (~> 0.6)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ actioncable (8.0.1)
12
+ actionpack (= 8.0.1)
13
+ activesupport (= 8.0.1)
14
+ nio4r (~> 2.0)
15
+ websocket-driver (>= 0.6.1)
16
+ zeitwerk (~> 2.6)
17
+ actionmailbox (8.0.1)
18
+ actionpack (= 8.0.1)
19
+ activejob (= 8.0.1)
20
+ activerecord (= 8.0.1)
21
+ activestorage (= 8.0.1)
22
+ activesupport (= 8.0.1)
23
+ mail (>= 2.8.0)
24
+ actionmailer (8.0.1)
25
+ actionpack (= 8.0.1)
26
+ actionview (= 8.0.1)
27
+ activejob (= 8.0.1)
28
+ activesupport (= 8.0.1)
29
+ mail (>= 2.8.0)
30
+ rails-dom-testing (~> 2.2)
31
+ actionpack (8.0.1)
32
+ actionview (= 8.0.1)
33
+ activesupport (= 8.0.1)
34
+ nokogiri (>= 1.8.5)
35
+ rack (>= 2.2.4)
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 (8.0.1)
42
+ actionpack (= 8.0.1)
43
+ activerecord (= 8.0.1)
44
+ activestorage (= 8.0.1)
45
+ activesupport (= 8.0.1)
46
+ globalid (>= 0.6.0)
47
+ nokogiri (>= 1.8.5)
48
+ actionview (8.0.1)
49
+ activesupport (= 8.0.1)
50
+ builder (~> 3.1)
51
+ erubi (~> 1.11)
52
+ rails-dom-testing (~> 2.2)
53
+ rails-html-sanitizer (~> 1.6)
54
+ activejob (8.0.1)
55
+ activesupport (= 8.0.1)
56
+ globalid (>= 0.3.6)
57
+ activemodel (8.0.1)
58
+ activesupport (= 8.0.1)
59
+ activerecord (8.0.1)
60
+ activemodel (= 8.0.1)
61
+ activesupport (= 8.0.1)
62
+ timeout (>= 0.4.0)
63
+ activestorage (8.0.1)
64
+ actionpack (= 8.0.1)
65
+ activejob (= 8.0.1)
66
+ activerecord (= 8.0.1)
67
+ activesupport (= 8.0.1)
68
+ marcel (~> 1.0)
69
+ activesupport (8.0.1)
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
+ uri (>= 0.13.1)
82
+ appraisal (2.5.0)
83
+ bundler
84
+ rake
85
+ thor (>= 0.14.0)
86
+ ast (2.4.2)
87
+ awesome_print (1.9.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
+ coderay (1.1.3)
94
+ concurrent-ruby (1.3.5)
95
+ connection_pool (2.5.0)
96
+ crass (1.0.6)
97
+ date (3.4.1)
98
+ differ (0.1.2)
99
+ drb (2.2.1)
100
+ erubi (1.13.1)
101
+ globalid (1.2.1)
102
+ activesupport (>= 6.1)
103
+ i18n (1.14.7)
104
+ concurrent-ruby (~> 1.0)
105
+ io-console (0.8.0)
106
+ irb (1.15.1)
107
+ pp (>= 0.6.0)
108
+ rdoc (>= 4.0.0)
109
+ reline (>= 0.4.2)
110
+ json (2.10.1)
111
+ language_server-protocol (3.17.0.4)
112
+ lint_roller (1.1.0)
113
+ logger (1.6.6)
114
+ loofah (2.24.0)
115
+ crass (~> 1.0.2)
116
+ nokogiri (>= 1.12.0)
117
+ mail (2.8.1)
118
+ mini_mime (>= 0.1.1)
119
+ net-imap
120
+ net-pop
121
+ net-smtp
122
+ marcel (1.0.4)
123
+ method_source (1.1.0)
124
+ mini_mime (1.1.5)
125
+ minitest (5.25.4)
126
+ net-imap (0.5.6)
127
+ date
128
+ net-protocol
129
+ net-pop (0.1.2)
130
+ net-protocol
131
+ net-protocol (0.2.2)
132
+ timeout
133
+ net-smtp (0.5.1)
134
+ net-protocol
135
+ niceql (0.6.1)
136
+ nio4r (2.7.4)
137
+ nokogiri (1.18.3-aarch64-linux-gnu)
138
+ racc (~> 1.4)
139
+ nokogiri (1.18.3-aarch64-linux-musl)
140
+ racc (~> 1.4)
141
+ nokogiri (1.18.3-arm-linux-gnu)
142
+ racc (~> 1.4)
143
+ nokogiri (1.18.3-arm-linux-musl)
144
+ racc (~> 1.4)
145
+ nokogiri (1.18.3-arm64-darwin)
146
+ racc (~> 1.4)
147
+ nokogiri (1.18.3-x86_64-darwin)
148
+ racc (~> 1.4)
149
+ nokogiri (1.18.3-x86_64-linux-gnu)
150
+ racc (~> 1.4)
151
+ nokogiri (1.18.3-x86_64-linux-musl)
152
+ racc (~> 1.4)
153
+ parallel (1.26.3)
154
+ parser (3.3.7.1)
155
+ ast (~> 2.4.1)
156
+ racc
157
+ pg (1.5.9)
158
+ pp (0.6.2)
159
+ prettyprint
160
+ prettyprint (0.2.0)
161
+ pry (0.14.2)
162
+ coderay (~> 1.1)
163
+ method_source (~> 1.0)
164
+ pry-byebug (3.10.1)
165
+ byebug (~> 11.0)
166
+ pry (>= 0.13, < 0.15)
167
+ psych (5.2.3)
168
+ date
169
+ stringio
170
+ racc (1.8.1)
171
+ rack (3.1.10)
172
+ rack-session (2.1.0)
173
+ base64 (>= 0.1.0)
174
+ rack (>= 3.0.0)
175
+ rack-test (2.2.0)
176
+ rack (>= 1.3)
177
+ rackup (2.2.1)
178
+ rack (>= 3)
179
+ rails (8.0.1)
180
+ actioncable (= 8.0.1)
181
+ actionmailbox (= 8.0.1)
182
+ actionmailer (= 8.0.1)
183
+ actionpack (= 8.0.1)
184
+ actiontext (= 8.0.1)
185
+ actionview (= 8.0.1)
186
+ activejob (= 8.0.1)
187
+ activemodel (= 8.0.1)
188
+ activerecord (= 8.0.1)
189
+ activestorage (= 8.0.1)
190
+ activesupport (= 8.0.1)
191
+ bundler (>= 1.15.0)
192
+ railties (= 8.0.1)
193
+ rails-dom-testing (2.2.0)
194
+ activesupport (>= 5.0.0)
195
+ minitest
196
+ nokogiri (>= 1.6)
197
+ rails-html-sanitizer (1.6.2)
198
+ loofah (~> 2.21)
199
+ 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)
200
+ railties (8.0.1)
201
+ actionpack (= 8.0.1)
202
+ activesupport (= 8.0.1)
203
+ irb (~> 1.13)
204
+ rackup (>= 1.0.0)
205
+ rake (>= 12.2)
206
+ thor (~> 1.0, >= 1.2.2)
207
+ zeitwerk (~> 2.6)
208
+ rainbow (3.1.1)
209
+ rake (13.2.1)
210
+ rdoc (6.12.0)
211
+ psych (>= 4.0.0)
212
+ regexp_parser (2.10.0)
213
+ reline (0.6.0)
214
+ io-console (~> 0.5)
215
+ rubocop (1.72.2)
216
+ json (~> 2.3)
217
+ language_server-protocol (~> 3.17.0.2)
218
+ lint_roller (~> 1.1.0)
219
+ parallel (~> 1.10)
220
+ parser (>= 3.3.0.2)
221
+ rainbow (>= 2.2.2, < 4.0)
222
+ regexp_parser (>= 2.9.3, < 3.0)
223
+ rubocop-ast (>= 1.38.0, < 2.0)
224
+ ruby-progressbar (~> 1.7)
225
+ unicode-display_width (>= 2.4.0, < 4.0)
226
+ rubocop-ast (1.38.0)
227
+ parser (>= 3.3.1.0)
228
+ rubocop-shopify (2.15.1)
229
+ rubocop (~> 1.51)
230
+ ruby-progressbar (1.13.0)
231
+ securerandom (0.4.1)
232
+ stringio (3.1.5)
233
+ stubberry (0.3.0)
234
+ thor (1.3.2)
235
+ timeout (0.4.3)
236
+ tzinfo (2.0.6)
237
+ concurrent-ruby (~> 1.0)
238
+ unicode-display_width (3.1.4)
239
+ unicode-emoji (~> 4.0, >= 4.0.4)
240
+ unicode-emoji (4.0.4)
241
+ uri (1.0.2)
242
+ useragent (0.16.11)
243
+ websocket-driver (0.7.7)
244
+ base64
245
+ websocket-extensions (>= 0.1.0)
246
+ websocket-extensions (0.1.5)
247
+ zeitwerk (2.7.2)
248
+
249
+ PLATFORMS
250
+ aarch64-linux-gnu
251
+ aarch64-linux-musl
252
+ arm-linux-gnu
253
+ arm-linux-musl
254
+ arm64-darwin
255
+ x86_64-darwin
256
+ x86_64-linux-gnu
257
+ x86_64-linux-musl
258
+
259
+ DEPENDENCIES
260
+ appraisal
261
+ awesome_print
262
+ bundler (>= 1)
263
+ differ (~> 0.1)
264
+ minitest (~> 5.0)
265
+ pg (~> 1)
266
+ pry-byebug (~> 3.9)
267
+ rails (>= 8)
268
+ rails_sql_prettifier!
269
+ rake (>= 12.3.3)
270
+ rubocop-shopify
271
+ stubberry (~> 0.2)
272
+
273
+ BUNDLED WITH
274
+ 2.6.5
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Niceql
2
4
  module Generators
3
5
  class InstallGenerator < Rails::Generators::Base
@@ -5,10 +7,10 @@ module Niceql
5
7
  desc "Creates Niceql initializer for your application"
6
8
 
7
9
  def copy_initializer
8
- template "niceql_initializer.rb", "config/initializers/niceql.rb"
10
+ template("niceql_initializer.rb", "config/initializers/niceql.rb")
9
11
 
10
12
  puts "Install complete!"
11
13
  end
12
14
  end
13
15
  end
14
- end
16
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  Niceql.configure do |c|
2
4
  # You can adjust pg_adapter in production at your own risk!
3
5
  # If you need it in production use exec_niceql
@@ -3,12 +3,13 @@
3
3
  module RailsSQLPrettifier
4
4
  module AbstractAdapterLogPrettifier
5
5
  private
6
- def log( sql, *args, **kwargs, &block )
6
+
7
+ def log(sql, *args, **kwargs, &block)
7
8
  # \n need to be placed because AR log will start with action description + time info.
8
9
  # rescue sql - just to be sure Prettifier wouldn't break production
9
10
  formatted_sql = "\n" + Niceql::Prettifier.prettify_sql(sql) rescue sql
10
11
 
11
- super( formatted_sql, *args, **kwargs, &block )
12
+ super(formatted_sql, *args, **kwargs, &block)
12
13
  end
13
14
  end
14
- end
15
+ end
@@ -1,12 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsSQLPrettifier
4
-
5
4
  module ArExtentions
6
5
  def exec_niceql(reraise = false)
7
- connection.execute( to_niceql )
8
- rescue => e
9
- puts Niceql::Prettifier.prettify_pg_err( e.message, to_niceql )
6
+ connection.execute(to_niceql)
7
+ rescue StandardError => e
8
+ puts Niceql::Prettifier.prettify_pg_err(e.message, to_niceql)
10
9
  raise if reraise
11
10
  end
12
11
 
@@ -14,8 +13,8 @@ module RailsSQLPrettifier
14
13
  Niceql::Prettifier.prettify_sql(to_sql, false)
15
14
  end
16
15
 
17
- def niceql( colorize = true )
18
- puts Niceql::Prettifier.prettify_sql( to_sql, colorize )
16
+ def niceql(colorize = true)
17
+ puts Niceql::Prettifier.prettify_sql(to_sql, colorize)
19
18
  end
20
19
  end
21
20
  end
@@ -6,15 +6,15 @@ module RailsSQLPrettifier
6
6
 
7
7
  included do
8
8
  attr_accessor :pg_adapter_with_nicesql,
9
- :prettify_active_record_log_output,
10
- :prettify_pg_errors
9
+ :prettify_active_record_log_output,
10
+ :prettify_pg_errors
11
11
 
12
12
  # we need to use a prepend otherwise it's not preceding Niceql.configure in a lookup chain
13
13
  Niceql.singleton_class.prepend(Configure)
14
14
  end
15
15
 
16
16
  def ar_using_pg_adapter?
17
- ActiveRecord::Base.connection_db_config.adapter == 'postgresql'
17
+ ActiveRecord::Base.connection_db_config.adapter == "postgresql"
18
18
  end
19
19
 
20
20
  def initialize
@@ -29,16 +29,19 @@ module RailsSQLPrettifier
29
29
  super
30
30
 
31
31
  if config.pg_adapter_with_nicesql &&
32
- defined?(::ActiveRecord::ConnectionAdapters::PostgreSQLAdapter) && !protected_env?
32
+ defined?(::ActiveRecord::ConnectionAdapters::PostgreSQLAdapter) && !protected_env?
33
33
 
34
34
  ::ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.include(PostgresAdapterNiceQL)
35
35
  end
36
36
 
37
- ::ActiveRecord::ConnectionAdapters::AbstractAdapter.prepend(AbstractAdapterLogPrettifier) if config.prettify_active_record_log_output
37
+ if config.prettify_active_record_log_output
38
+ ::ActiveRecord::ConnectionAdapters::AbstractAdapter.prepend(AbstractAdapterLogPrettifier)
39
+ end
38
40
 
39
- ::ActiveRecord::StatementInvalid.include(NiceqlError) if config.prettify_pg_errors && config.ar_using_pg_adapter?
41
+ if config.prettify_pg_errors && config.ar_using_pg_adapter?
42
+ ::ActiveRecord::StatementInvalid.include(NiceqlError)
43
+ end
40
44
  end
41
45
  end
42
46
  end
43
-
44
47
  end
@@ -1,10 +1,11 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module RailsSQLPrettifier
3
4
  module NiceqlError
4
5
  def to_s
5
6
  # older rails version do not provide sql as a standalone query, instead they
6
7
  # deliver joined message, and try(:sql) will set prettify_err with nil in that case
7
- Niceql.config.prettify_pg_errors ? Niceql::Prettifier.prettify_err(super, try(:sql) ) : super
8
+ Niceql.config.prettify_pg_errors ? Niceql::Prettifier.prettify_err(super, try(:sql)) : super
8
9
  end
9
10
  end
10
11
  end
@@ -4,7 +4,7 @@ module RailsSQLPrettifier
4
4
  module PostgresAdapterNiceQL
5
5
  def exec_query(sql, *args, **kwargs, &block)
6
6
  # replacing sql with prettified sql, that's all
7
- super( Niceql::Prettifier.prettify_sql(sql, false), *args, **kwargs, &block )
7
+ super(Niceql::Prettifier.prettify_sql(sql, false), *args, **kwargs, &block)
8
8
  end
9
9
  end
10
10
  end
@@ -1,10 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsSQLPrettifier
4
-
5
4
  module ProtectedEnv
6
5
  def protected_env?
7
- ActiveRecord::Base.connection.migration_context.protected_environment? ||
6
+ migration_context = ActiveRecord::Base.connection.try(:migration_context) ||
7
+ ActiveRecord::Base.connection.try(:pool)&.migration_context # rails 7.2+
8
+
9
+ migration_context&.protected_environment? ||
8
10
  defined?(Rails) && !(Rails.env.test? || Rails.env.development?)
9
11
  end
10
12
  end