edgestitch 0.2.0 → 0.4.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.
@@ -0,0 +1,268 @@
1
+ PATH
2
+ remote: ../../rubocop-powerhome
3
+ specs:
4
+ rubocop-powerhome (0.5.2)
5
+ rubocop (~> 1.52.0)
6
+ rubocop-performance
7
+ rubocop-rails
8
+ rubocop-rake
9
+ rubocop-rspec
10
+
11
+ PATH
12
+ remote: ..
13
+ specs:
14
+ edgestitch (0.4.0)
15
+
16
+ GEM
17
+ remote: https://rubygems.org/
18
+ specs:
19
+ actioncable (6.1.7.4)
20
+ actionpack (= 6.1.7.4)
21
+ activesupport (= 6.1.7.4)
22
+ nio4r (~> 2.0)
23
+ websocket-driver (>= 0.6.1)
24
+ actionmailbox (6.1.7.4)
25
+ actionpack (= 6.1.7.4)
26
+ activejob (= 6.1.7.4)
27
+ activerecord (= 6.1.7.4)
28
+ activestorage (= 6.1.7.4)
29
+ activesupport (= 6.1.7.4)
30
+ mail (>= 2.7.1)
31
+ actionmailer (6.1.7.4)
32
+ actionpack (= 6.1.7.4)
33
+ actionview (= 6.1.7.4)
34
+ activejob (= 6.1.7.4)
35
+ activesupport (= 6.1.7.4)
36
+ mail (~> 2.5, >= 2.5.4)
37
+ rails-dom-testing (~> 2.0)
38
+ actionpack (6.1.7.4)
39
+ actionview (= 6.1.7.4)
40
+ activesupport (= 6.1.7.4)
41
+ rack (~> 2.0, >= 2.0.9)
42
+ rack-test (>= 0.6.3)
43
+ rails-dom-testing (~> 2.0)
44
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
45
+ actiontext (6.1.7.4)
46
+ actionpack (= 6.1.7.4)
47
+ activerecord (= 6.1.7.4)
48
+ activestorage (= 6.1.7.4)
49
+ activesupport (= 6.1.7.4)
50
+ nokogiri (>= 1.8.5)
51
+ actionview (6.1.7.4)
52
+ activesupport (= 6.1.7.4)
53
+ builder (~> 3.1)
54
+ erubi (~> 1.4)
55
+ rails-dom-testing (~> 2.0)
56
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
57
+ activejob (6.1.7.4)
58
+ activesupport (= 6.1.7.4)
59
+ globalid (>= 0.3.6)
60
+ activemodel (6.1.7.4)
61
+ activesupport (= 6.1.7.4)
62
+ activerecord (6.1.7.4)
63
+ activemodel (= 6.1.7.4)
64
+ activesupport (= 6.1.7.4)
65
+ activestorage (6.1.7.4)
66
+ actionpack (= 6.1.7.4)
67
+ activejob (= 6.1.7.4)
68
+ activerecord (= 6.1.7.4)
69
+ activesupport (= 6.1.7.4)
70
+ marcel (~> 1.0)
71
+ mini_mime (>= 1.1.0)
72
+ activesupport (6.1.7.4)
73
+ concurrent-ruby (~> 1.0, >= 1.0.2)
74
+ i18n (>= 1.6, < 2)
75
+ minitest (>= 5.1)
76
+ tzinfo (~> 2.0)
77
+ zeitwerk (~> 2.3)
78
+ appraisal (2.4.1)
79
+ bundler
80
+ rake
81
+ thor (>= 0.14.0)
82
+ ast (2.4.2)
83
+ builder (3.2.4)
84
+ concurrent-ruby (1.2.2)
85
+ crass (1.0.6)
86
+ date (3.3.4)
87
+ diff-lcs (1.5.0)
88
+ docile (1.1.5)
89
+ erubi (1.12.0)
90
+ globalid (1.2.1)
91
+ activesupport (>= 6.1)
92
+ i18n (1.14.1)
93
+ concurrent-ruby (~> 1.0)
94
+ json (2.7.1)
95
+ license_finder (7.1.0)
96
+ bundler
97
+ rubyzip (>= 1, < 3)
98
+ thor (~> 1.2)
99
+ tomlrb (>= 1.3, < 2.1)
100
+ with_env (= 1.1.0)
101
+ xml-simple (~> 1.1.9)
102
+ loofah (2.22.0)
103
+ crass (~> 1.0.2)
104
+ nokogiri (>= 1.12.0)
105
+ mail (2.8.1)
106
+ mini_mime (>= 0.1.1)
107
+ net-imap
108
+ net-pop
109
+ net-smtp
110
+ marcel (1.0.2)
111
+ method_source (1.0.0)
112
+ mini_mime (1.1.5)
113
+ minitest (5.20.0)
114
+ mysql2 (0.5.5)
115
+ net-imap (0.4.9)
116
+ date
117
+ net-protocol
118
+ net-pop (0.1.2)
119
+ net-protocol
120
+ net-protocol (0.2.2)
121
+ timeout
122
+ net-smtp (0.4.0)
123
+ net-protocol
124
+ nio4r (2.7.0)
125
+ nokogiri (1.15.5-arm64-darwin)
126
+ racc (~> 1.4)
127
+ nokogiri (1.15.5-x86_64-linux)
128
+ racc (~> 1.4)
129
+ parallel (1.24.0)
130
+ parser (3.2.2.4)
131
+ ast (~> 2.4.1)
132
+ racc
133
+ racc (1.7.3)
134
+ rack (2.2.8)
135
+ rack-test (2.1.0)
136
+ rack (>= 1.3)
137
+ rails (6.1.7.4)
138
+ actioncable (= 6.1.7.4)
139
+ actionmailbox (= 6.1.7.4)
140
+ actionmailer (= 6.1.7.4)
141
+ actionpack (= 6.1.7.4)
142
+ actiontext (= 6.1.7.4)
143
+ actionview (= 6.1.7.4)
144
+ activejob (= 6.1.7.4)
145
+ activemodel (= 6.1.7.4)
146
+ activerecord (= 6.1.7.4)
147
+ activestorage (= 6.1.7.4)
148
+ activesupport (= 6.1.7.4)
149
+ bundler (>= 1.15.0)
150
+ railties (= 6.1.7.4)
151
+ sprockets-rails (>= 2.0.0)
152
+ rails-dom-testing (2.2.0)
153
+ activesupport (>= 5.0.0)
154
+ minitest
155
+ nokogiri (>= 1.6)
156
+ rails-html-sanitizer (1.6.0)
157
+ loofah (~> 2.21)
158
+ nokogiri (~> 1.14)
159
+ railties (6.1.7.4)
160
+ actionpack (= 6.1.7.4)
161
+ activesupport (= 6.1.7.4)
162
+ method_source
163
+ rake (>= 12.2)
164
+ thor (~> 1.0)
165
+ rainbow (3.1.1)
166
+ rake (13.1.0)
167
+ regexp_parser (2.8.3)
168
+ rexml (3.2.6)
169
+ rspec (3.12.0)
170
+ rspec-core (~> 3.12.0)
171
+ rspec-expectations (~> 3.12.0)
172
+ rspec-mocks (~> 3.12.0)
173
+ rspec-core (3.12.2)
174
+ rspec-support (~> 3.12.0)
175
+ rspec-expectations (3.12.3)
176
+ diff-lcs (>= 1.2.0, < 2.0)
177
+ rspec-support (~> 3.12.0)
178
+ rspec-mocks (3.12.6)
179
+ diff-lcs (>= 1.2.0, < 2.0)
180
+ rspec-support (~> 3.12.0)
181
+ rspec-rails (5.1.2)
182
+ actionpack (>= 5.2)
183
+ activesupport (>= 5.2)
184
+ railties (>= 5.2)
185
+ rspec-core (~> 3.10)
186
+ rspec-expectations (~> 3.10)
187
+ rspec-mocks (~> 3.10)
188
+ rspec-support (~> 3.10)
189
+ rspec-support (3.12.1)
190
+ rubocop (1.52.1)
191
+ json (~> 2.3)
192
+ parallel (~> 1.10)
193
+ parser (>= 3.2.2.3)
194
+ rainbow (>= 2.2.2, < 4.0)
195
+ regexp_parser (>= 1.8, < 3.0)
196
+ rexml (>= 3.2.5, < 4.0)
197
+ rubocop-ast (>= 1.28.0, < 2.0)
198
+ ruby-progressbar (~> 1.7)
199
+ unicode-display_width (>= 2.4.0, < 3.0)
200
+ rubocop-ast (1.30.0)
201
+ parser (>= 3.2.1.0)
202
+ rubocop-capybara (2.20.0)
203
+ rubocop (~> 1.41)
204
+ rubocop-factory_bot (2.24.0)
205
+ rubocop (~> 1.33)
206
+ rubocop-performance (1.20.1)
207
+ rubocop (>= 1.48.1, < 2.0)
208
+ rubocop-ast (>= 1.30.0, < 2.0)
209
+ rubocop-rails (2.23.1)
210
+ activesupport (>= 4.2.0)
211
+ rack (>= 1.1)
212
+ rubocop (>= 1.33.0, < 2.0)
213
+ rubocop-ast (>= 1.30.0, < 2.0)
214
+ rubocop-rake (0.6.0)
215
+ rubocop (~> 1.0)
216
+ rubocop-rspec (2.25.0)
217
+ rubocop (~> 1.40)
218
+ rubocop-capybara (~> 2.17)
219
+ rubocop-factory_bot (~> 2.22)
220
+ ruby-progressbar (1.13.0)
221
+ rubyzip (2.3.2)
222
+ simplecov (0.15.1)
223
+ docile (~> 1.1.0)
224
+ json (>= 1.8, < 3)
225
+ simplecov-html (~> 0.10.0)
226
+ simplecov-html (0.10.2)
227
+ sprockets (4.2.1)
228
+ concurrent-ruby (~> 1.0)
229
+ rack (>= 2.2.4, < 4)
230
+ sprockets-rails (3.4.2)
231
+ actionpack (>= 5.2)
232
+ activesupport (>= 5.2)
233
+ sprockets (>= 3.0.0)
234
+ thor (1.3.0)
235
+ timeout (0.4.1)
236
+ tomlrb (2.0.3)
237
+ tzinfo (2.0.6)
238
+ concurrent-ruby (~> 1.0)
239
+ unicode-display_width (2.5.0)
240
+ websocket-driver (0.7.6)
241
+ websocket-extensions (>= 0.1.0)
242
+ websocket-extensions (0.1.5)
243
+ with_env (1.1.0)
244
+ xml-simple (1.1.9)
245
+ rexml
246
+ yard (0.9.21)
247
+ zeitwerk (2.6.12)
248
+
249
+ PLATFORMS
250
+ arm64-darwin-22
251
+ x86_64-linux
252
+
253
+ DEPENDENCIES
254
+ appraisal (~> 2.4.1)
255
+ bundler (~> 2.1)
256
+ edgestitch!
257
+ license_finder (>= 7.0)
258
+ mysql2 (= 0.5.5)
259
+ rails (= 6.1.7.4)
260
+ rake (~> 13.0)
261
+ rspec (~> 3.0)
262
+ rspec-rails (~> 5.1.2)
263
+ rubocop-powerhome!
264
+ simplecov (= 0.15.1)
265
+ yard (= 0.9.21)
266
+
267
+ BUNDLED WITH
268
+ 2.3.26
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rubocop-powerhome", path: "../../rubocop-powerhome"
6
+ gem "rails", "7.0.6"
7
+
8
+ gemspec path: "../"
@@ -0,0 +1,267 @@
1
+ PATH
2
+ remote: ../../rubocop-powerhome
3
+ specs:
4
+ rubocop-powerhome (0.5.2)
5
+ rubocop (~> 1.52.0)
6
+ rubocop-performance
7
+ rubocop-rails
8
+ rubocop-rake
9
+ rubocop-rspec
10
+
11
+ PATH
12
+ remote: ..
13
+ specs:
14
+ edgestitch (0.4.0)
15
+
16
+ GEM
17
+ remote: https://rubygems.org/
18
+ specs:
19
+ actioncable (7.0.6)
20
+ actionpack (= 7.0.6)
21
+ activesupport (= 7.0.6)
22
+ nio4r (~> 2.0)
23
+ websocket-driver (>= 0.6.1)
24
+ actionmailbox (7.0.6)
25
+ actionpack (= 7.0.6)
26
+ activejob (= 7.0.6)
27
+ activerecord (= 7.0.6)
28
+ activestorage (= 7.0.6)
29
+ activesupport (= 7.0.6)
30
+ mail (>= 2.7.1)
31
+ net-imap
32
+ net-pop
33
+ net-smtp
34
+ actionmailer (7.0.6)
35
+ actionpack (= 7.0.6)
36
+ actionview (= 7.0.6)
37
+ activejob (= 7.0.6)
38
+ activesupport (= 7.0.6)
39
+ mail (~> 2.5, >= 2.5.4)
40
+ net-imap
41
+ net-pop
42
+ net-smtp
43
+ rails-dom-testing (~> 2.0)
44
+ actionpack (7.0.6)
45
+ actionview (= 7.0.6)
46
+ activesupport (= 7.0.6)
47
+ rack (~> 2.0, >= 2.2.4)
48
+ rack-test (>= 0.6.3)
49
+ rails-dom-testing (~> 2.0)
50
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
51
+ actiontext (7.0.6)
52
+ actionpack (= 7.0.6)
53
+ activerecord (= 7.0.6)
54
+ activestorage (= 7.0.6)
55
+ activesupport (= 7.0.6)
56
+ globalid (>= 0.6.0)
57
+ nokogiri (>= 1.8.5)
58
+ actionview (7.0.6)
59
+ activesupport (= 7.0.6)
60
+ builder (~> 3.1)
61
+ erubi (~> 1.4)
62
+ rails-dom-testing (~> 2.0)
63
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
64
+ activejob (7.0.6)
65
+ activesupport (= 7.0.6)
66
+ globalid (>= 0.3.6)
67
+ activemodel (7.0.6)
68
+ activesupport (= 7.0.6)
69
+ activerecord (7.0.6)
70
+ activemodel (= 7.0.6)
71
+ activesupport (= 7.0.6)
72
+ activestorage (7.0.6)
73
+ actionpack (= 7.0.6)
74
+ activejob (= 7.0.6)
75
+ activerecord (= 7.0.6)
76
+ activesupport (= 7.0.6)
77
+ marcel (~> 1.0)
78
+ mini_mime (>= 1.1.0)
79
+ activesupport (7.0.6)
80
+ concurrent-ruby (~> 1.0, >= 1.0.2)
81
+ i18n (>= 1.6, < 2)
82
+ minitest (>= 5.1)
83
+ tzinfo (~> 2.0)
84
+ appraisal (2.4.1)
85
+ bundler
86
+ rake
87
+ thor (>= 0.14.0)
88
+ ast (2.4.2)
89
+ builder (3.2.4)
90
+ concurrent-ruby (1.2.2)
91
+ crass (1.0.6)
92
+ date (3.3.4)
93
+ diff-lcs (1.5.0)
94
+ docile (1.1.5)
95
+ erubi (1.12.0)
96
+ globalid (1.2.1)
97
+ activesupport (>= 6.1)
98
+ i18n (1.14.1)
99
+ concurrent-ruby (~> 1.0)
100
+ json (2.7.1)
101
+ license_finder (7.1.0)
102
+ bundler
103
+ rubyzip (>= 1, < 3)
104
+ thor (~> 1.2)
105
+ tomlrb (>= 1.3, < 2.1)
106
+ with_env (= 1.1.0)
107
+ xml-simple (~> 1.1.9)
108
+ loofah (2.22.0)
109
+ crass (~> 1.0.2)
110
+ nokogiri (>= 1.12.0)
111
+ mail (2.8.1)
112
+ mini_mime (>= 0.1.1)
113
+ net-imap
114
+ net-pop
115
+ net-smtp
116
+ marcel (1.0.2)
117
+ method_source (1.0.0)
118
+ mini_mime (1.1.5)
119
+ minitest (5.20.0)
120
+ mysql2 (0.5.5)
121
+ net-imap (0.4.9)
122
+ date
123
+ net-protocol
124
+ net-pop (0.1.2)
125
+ net-protocol
126
+ net-protocol (0.2.2)
127
+ timeout
128
+ net-smtp (0.4.0)
129
+ net-protocol
130
+ nio4r (2.7.0)
131
+ nokogiri (1.15.5-arm64-darwin)
132
+ racc (~> 1.4)
133
+ nokogiri (1.15.5-x86_64-linux)
134
+ racc (~> 1.4)
135
+ parallel (1.24.0)
136
+ parser (3.2.2.4)
137
+ ast (~> 2.4.1)
138
+ racc
139
+ racc (1.7.3)
140
+ rack (2.2.8)
141
+ rack-test (2.1.0)
142
+ rack (>= 1.3)
143
+ rails (7.0.6)
144
+ actioncable (= 7.0.6)
145
+ actionmailbox (= 7.0.6)
146
+ actionmailer (= 7.0.6)
147
+ actionpack (= 7.0.6)
148
+ actiontext (= 7.0.6)
149
+ actionview (= 7.0.6)
150
+ activejob (= 7.0.6)
151
+ activemodel (= 7.0.6)
152
+ activerecord (= 7.0.6)
153
+ activestorage (= 7.0.6)
154
+ activesupport (= 7.0.6)
155
+ bundler (>= 1.15.0)
156
+ railties (= 7.0.6)
157
+ rails-dom-testing (2.2.0)
158
+ activesupport (>= 5.0.0)
159
+ minitest
160
+ nokogiri (>= 1.6)
161
+ rails-html-sanitizer (1.6.0)
162
+ loofah (~> 2.21)
163
+ nokogiri (~> 1.14)
164
+ railties (7.0.6)
165
+ actionpack (= 7.0.6)
166
+ activesupport (= 7.0.6)
167
+ method_source
168
+ rake (>= 12.2)
169
+ thor (~> 1.0)
170
+ zeitwerk (~> 2.5)
171
+ rainbow (3.1.1)
172
+ rake (13.1.0)
173
+ regexp_parser (2.8.3)
174
+ rexml (3.2.6)
175
+ rspec (3.12.0)
176
+ rspec-core (~> 3.12.0)
177
+ rspec-expectations (~> 3.12.0)
178
+ rspec-mocks (~> 3.12.0)
179
+ rspec-core (3.12.2)
180
+ rspec-support (~> 3.12.0)
181
+ rspec-expectations (3.12.3)
182
+ diff-lcs (>= 1.2.0, < 2.0)
183
+ rspec-support (~> 3.12.0)
184
+ rspec-mocks (3.12.6)
185
+ diff-lcs (>= 1.2.0, < 2.0)
186
+ rspec-support (~> 3.12.0)
187
+ rspec-rails (5.1.2)
188
+ actionpack (>= 5.2)
189
+ activesupport (>= 5.2)
190
+ railties (>= 5.2)
191
+ rspec-core (~> 3.10)
192
+ rspec-expectations (~> 3.10)
193
+ rspec-mocks (~> 3.10)
194
+ rspec-support (~> 3.10)
195
+ rspec-support (3.12.1)
196
+ rubocop (1.52.1)
197
+ json (~> 2.3)
198
+ parallel (~> 1.10)
199
+ parser (>= 3.2.2.3)
200
+ rainbow (>= 2.2.2, < 4.0)
201
+ regexp_parser (>= 1.8, < 3.0)
202
+ rexml (>= 3.2.5, < 4.0)
203
+ rubocop-ast (>= 1.28.0, < 2.0)
204
+ ruby-progressbar (~> 1.7)
205
+ unicode-display_width (>= 2.4.0, < 3.0)
206
+ rubocop-ast (1.30.0)
207
+ parser (>= 3.2.1.0)
208
+ rubocop-capybara (2.20.0)
209
+ rubocop (~> 1.41)
210
+ rubocop-factory_bot (2.24.0)
211
+ rubocop (~> 1.33)
212
+ rubocop-performance (1.20.1)
213
+ rubocop (>= 1.48.1, < 2.0)
214
+ rubocop-ast (>= 1.30.0, < 2.0)
215
+ rubocop-rails (2.23.1)
216
+ activesupport (>= 4.2.0)
217
+ rack (>= 1.1)
218
+ rubocop (>= 1.33.0, < 2.0)
219
+ rubocop-ast (>= 1.30.0, < 2.0)
220
+ rubocop-rake (0.6.0)
221
+ rubocop (~> 1.0)
222
+ rubocop-rspec (2.25.0)
223
+ rubocop (~> 1.40)
224
+ rubocop-capybara (~> 2.17)
225
+ rubocop-factory_bot (~> 2.22)
226
+ ruby-progressbar (1.13.0)
227
+ rubyzip (2.3.2)
228
+ simplecov (0.15.1)
229
+ docile (~> 1.1.0)
230
+ json (>= 1.8, < 3)
231
+ simplecov-html (~> 0.10.0)
232
+ simplecov-html (0.10.2)
233
+ thor (1.3.0)
234
+ timeout (0.4.1)
235
+ tomlrb (2.0.3)
236
+ tzinfo (2.0.6)
237
+ concurrent-ruby (~> 1.0)
238
+ unicode-display_width (2.5.0)
239
+ websocket-driver (0.7.6)
240
+ websocket-extensions (>= 0.1.0)
241
+ websocket-extensions (0.1.5)
242
+ with_env (1.1.0)
243
+ xml-simple (1.1.9)
244
+ rexml
245
+ yard (0.9.21)
246
+ zeitwerk (2.6.12)
247
+
248
+ PLATFORMS
249
+ arm64-darwin-22
250
+ x86_64-linux
251
+
252
+ DEPENDENCIES
253
+ appraisal (~> 2.4.1)
254
+ bundler (~> 2.1)
255
+ edgestitch!
256
+ license_finder (>= 7.0)
257
+ mysql2 (= 0.5.5)
258
+ rails (= 7.0.6)
259
+ rake (~> 13.0)
260
+ rspec (~> 3.0)
261
+ rspec-rails (~> 5.1.2)
262
+ rubocop-powerhome!
263
+ simplecov (= 0.15.1)
264
+ yard (= 0.9.21)
265
+
266
+ BUNDLED WITH
267
+ 2.3.26
@@ -2,7 +2,7 @@
2
2
 
3
3
  require "open3"
4
4
 
5
- require_relative "./structure_constraint_order_munger"
5
+ require_relative "structure_constraint_order_munger"
6
6
 
7
7
  module Edgestitch
8
8
  module Mysql
@@ -11,6 +11,8 @@ module Edgestitch
11
11
  # Wrapper for the mysqldump tool to dump specific tables and migration data
12
12
  #
13
13
  class Dump
14
+ # @private
15
+ #
14
16
  # Sanitizes a DDL code with some opinionated preferences:
15
17
  # * Constraints starting with `_fk` will start with `fk`
16
18
  # * Clear empty lines (with empty spaces even)
@@ -18,7 +20,7 @@ module Edgestitch
18
20
  #
19
21
  # @param sql [String] the DDL code to sanitize
20
22
  # @return String the same DDL sanitized
21
- def self.sanitize_sql(sql)
23
+ def self.sanitize_create_table(sql)
22
24
  comment_instructions_regex = %r{^/\*![0-9]{5}\s+[^;]+;\s*$}
23
25
 
24
26
  cleanups = sql.gsub(/\s+AUTO_INCREMENT=\d+/, "")
@@ -29,6 +31,24 @@ module Edgestitch
29
31
  ::Edgestitch::Mysql::StructureConstraintOrderMunger.munge(cleanups)
30
32
  end
31
33
 
34
+ # @private
35
+ #
36
+ # Sanitizes a DML code to insert migration timestamps with opinionated preferences:
37
+ # * One timestamp per line
38
+ # * Except for the first line, they all start with a comma
39
+ # * Semicolomn is in a separate line from the last one
40
+ #
41
+ # The above preferences come from the idea of minimizing merge conflicts, or make
42
+ # them easily handled by git automatically
43
+ #
44
+ # @param sql [String] the DML code to sanitize
45
+ # @return String the same DML sanitized
46
+ def self.sanitize_migration_timestamps(sql)
47
+ sql.gsub("VALUES ", "VALUES\n")
48
+ .gsub(",", "\n,")
49
+ .gsub(";", "\n;")
50
+ end
51
+
32
52
  #
33
53
  # @param config [ActiveRecord::DatabaseConfigurations::DatabaseConfig] rails database configuration
34
54
  def initialize(config)
@@ -49,8 +69,8 @@ module Edgestitch
49
69
  def export_tables(tables)
50
70
  return if tables.empty?
51
71
 
52
- self.class.sanitize_sql(
53
- execute("--compact", "--skip-lock-tables", "--single-transaction", "--no-data", "--set-gtid-purged=OFF",
72
+ self.class.sanitize_create_table(
73
+ execute("--compact", "--skip-lock-tables", "--no-data", "--set-gtid-purged=OFF",
54
74
  "--column-statistics=0", *tables)
55
75
  )
56
76
  end
@@ -65,13 +85,13 @@ module Edgestitch
65
85
  # @return String the INSERT statements.
66
86
  def export_migrations(migrations)
67
87
  migrations.in_groups_of(50, false).map do |versions|
68
- execute(
69
- "--compact", "--skip-lock-tables", "--single-transaction", "--set-gtid-purged=OFF",
88
+ self.class.sanitize_migration_timestamps execute(
89
+ "--compact", "--skip-lock-tables", "--set-gtid-purged=OFF",
70
90
  "--no-create-info", "--column-statistics=0",
71
91
  "schema_migrations",
72
92
  "-w", "version IN (#{versions.join(',')})"
73
93
  )
74
- end.join.gsub(/VALUES /, "VALUES\n").gsub(/,/, ",\n")
94
+ end.join
75
95
  end
76
96
 
77
97
  private
@@ -31,9 +31,11 @@ module Edgestitch
31
31
  # - db:schema:load
32
32
  #
33
33
  # @param namespace [String] namespace where the task will run [default: db:stitch]
34
+ # @param enhance_rails [Boolean] whether edgestitch should enhance the above tasks or not [default: true]
34
35
  # @return [Rake::Task]
35
- def define_stitch(namespace = "db:stitch")
36
- enhance(namespace, "db:prepare", "db:structure:load", "db:schema:load")
36
+ def define_stitch(namespace = "db:stitch", enhance_rails: true)
37
+ enhance(namespace, "db:prepare", "db:structure:load", "db:schema:load") if enhance_rails
38
+
37
39
  desc "Create structure.sql for an app based on all loaded engines' structure-self.sql"
38
40
  task namespace => [:environment] do |_task, _args|
39
41
  ActiveRecord::Base.configurations.configs_for(env_name: Rails.env).each do |db_config|
@@ -56,10 +58,13 @@ module Edgestitch
56
58
  # @param engine [Class<Rails::Engine>] target class of the task
57
59
  # @param namespace [String] the namespace where the target will be generated [default: db:stitch]
58
60
  # @param name [String] the name of the task within the given namespace [default: engine.engine_name]
61
+ # @param enhance_rails [Boolean] whether edgestitch should enhance the above tasks or not [default: true]
59
62
  # @return [Rake::Task]
60
- def define_engine(engine, namespace: "db:stitch", name: engine.engine_name)
61
- enhance("#{namespace}:#{name}", "db:structure:dump", "app:db:structure:dump", "db:schema:dump",
62
- "app:db:schema:dump")
63
+ def define_engine(engine, namespace: "db:stitch", name: engine.engine_name, enhance_rails: true) # rubocop:disable Metrics/MethodLength
64
+ if enhance_rails
65
+ enhance("#{namespace}:#{name}", "db:structure:dump", "app:db:structure:dump", "db:schema:dump",
66
+ "app:db:schema:dump")
67
+ end
63
68
 
64
69
  desc "Create structure-self.sql for an engine"
65
70
  task "#{namespace}:#{name}" => [:environment] do |_, _args|
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Edgestitch
4
- VERSION = "0.2.0"
4
+ VERSION = "0.4.0"
5
5
  end