ridgepole 2.0.1 → 2.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +2 -0
- data/CHANGELOG.md +132 -120
- data/README.md +27 -24
- data/bin/ridgepole +8 -6
- data/gemfiles/activerecord_7.0.gemfile +1 -1
- data/lib/ridgepole/cli/config.rb +7 -14
- data/lib/ridgepole/client.rb +1 -1
- data/lib/ridgepole/delta.rb +13 -13
- data/lib/ridgepole/diff.rb +8 -6
- data/lib/ridgepole/dsl_parser.rb +1 -1
- data/lib/ridgepole/version.rb +1 -1
- data/ridgepole.gemspec +3 -2
- metadata +21 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2e28849a4ffd0e89057ec0aca0d8144a7c627f6947efe49a0c0ebcb3a5bf8d91
|
4
|
+
data.tar.gz: cff35f1be11654d25a0aa954d2d1af85ee8b7c5aa649ce2425227637ca340b10
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 893204d453f9d96468e6a43e5843d5c1f8b2407f3b14bc4572836022ca240b4eaf3f8a39163ee2dcd753168640bce8b721fde35da5a713ce7941056c2e71a747
|
7
|
+
data.tar.gz: 33366d9df07035e062ad42a534292200076358c60242c17f14c05d6ba63c98443e35cf15ab21af097feb303e8257efc10f253c89c379daf0264a17a3b56d8bb8
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -2,311 +2,323 @@
|
|
2
2
|
|
3
3
|
## 2.0
|
4
4
|
|
5
|
+
### 2.0.2 (2024/04/21)
|
6
|
+
|
7
|
+
- Add `--drop-table-only` option [pull#477](https://github.com/ridgepole/ridgepole/pull/477)
|
8
|
+
|
9
|
+
### 2.0.2 (2024/02/25)
|
10
|
+
|
11
|
+
- Fix bug that cannot include single quote in table comment [pull#467](https://github.com/ridgepole/ridgepole/pull/467)
|
12
|
+
|
13
|
+
### 2.0.1 (2023/11/22)
|
14
|
+
|
15
|
+
- Fix renamed_from bug [pull#453](https://github.com/ridgepole/ridgepole/pull/453)
|
16
|
+
|
5
17
|
### 2.0.1 (2023/11/22)
|
6
18
|
|
7
|
-
|
19
|
+
- Fix renamed_from bug [pull#453](https://github.com/ridgepole/ridgepole/pull/453)
|
8
20
|
|
9
21
|
### 2.0.0 (2023/11/10)
|
10
22
|
|
11
|
-
|
23
|
+
- Bump up version.
|
12
24
|
|
13
25
|
### 2.0.0.beta2 (2023/10/26)
|
14
26
|
|
15
|
-
|
16
|
-
|
27
|
+
- Support Rails 7.1 [pull#447](https://github.com/ridgepole/ridgepole/pull/447)
|
28
|
+
- Drop Rails 6.0 support [pull#440](https://github.com/ridgepole/ridgepole/pull/440)
|
17
29
|
|
18
30
|
### 2.0.0.beta (2023/10/22)
|
19
31
|
|
20
|
-
|
21
|
-
|
32
|
+
- Support Rails 7.1 [pull#441](https://github.com/ridgepole/ridgepole/pull/441)
|
33
|
+
- Drop Rails 6.0 support [pull#440](https://github.com/ridgepole/ridgepole/pull/440)
|
22
34
|
|
23
35
|
## 1.2
|
24
36
|
|
25
37
|
### 1.2.1 (2023/07/29)
|
26
38
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
39
|
+
- Support `t.enum` [pull#405](https://github.com/ridgepole/ridgepole/pull/405)
|
40
|
+
- Fix timestamps with index behavior [pull#428](https://github.com/ridgepole/ridgepole/pull/428)
|
41
|
+
- Fix broken `DEFAULT CURRENT_TIMESTAMP` spec [pull#420](https://github.com/ridgepole/ridgepole/pull/420)
|
42
|
+
- Add Ruby 3.2 to CI matrix [pull#419](https://github.com/ridgepole/ridgepole/pull/419)
|
31
43
|
|
32
44
|
### 1.2.0 (2022/09/24)
|
33
45
|
|
34
|
-
|
35
|
-
|
36
|
-
|
46
|
+
- Updated supported column types [pull#399](https://github.com/ridgepole/ridgepole/pull/399) [pull#400](https://github.com/ridgepole/ridgepole/pull/400)
|
47
|
+
- Support check constraint [pull#393](https://github.com/ridgepole/ridgepole/pull/393) [pull#397](https://github.com/ridgepole/ridgepole/pull/397)
|
48
|
+
- Drop suport Rails 5.x [pull#395](https://github.com/ridgepole/ridgepole/pull/395)
|
37
49
|
|
38
50
|
## 1.1
|
39
51
|
|
40
52
|
### 1.1.0 (2022/06/18)
|
41
53
|
|
42
|
-
|
54
|
+
- Revert partitioning support [pull#392](https://github.com/ridgepole/ridgepole/pull/392)
|
43
55
|
|
44
56
|
## 1.0
|
45
57
|
|
46
58
|
### 1.0.7 (2022/06/09)
|
47
59
|
|
48
|
-
|
60
|
+
- Normalize list partition values for PostgreSQL [pull#389](https://github.com/ridgepole/ridgepole/pull/389)
|
49
61
|
|
50
62
|
### 1.0.6 (2022/06/06)
|
51
63
|
|
52
|
-
|
64
|
+
- Support Hash partition for PostgreSQL [pull#387](https://github.com/ridgepole/ridgepole/pull/387)
|
53
65
|
|
54
66
|
### 1.0.5 (2022/06/05)
|
55
67
|
|
56
|
-
|
68
|
+
- Support DEFAULT partition for PostgreSQL [pull#386](https://github.com/ridgepole/ridgepole/pull/386)
|
57
69
|
|
58
70
|
### 1.0.4 (2022/03/28)
|
59
71
|
|
60
|
-
|
72
|
+
- Add warning for generated column [pull#382](https://github.com/ridgepole/ridgepole/pull/382)
|
61
73
|
|
62
74
|
### 1.0.3 (2022/02/12)
|
63
75
|
|
64
|
-
|
76
|
+
- Support Rails 7.0.2 [pull#380](https://github.com/ridgepole/ridgepole/pull/380)
|
65
77
|
|
66
78
|
### 1.0.2 (2022/02/06)
|
67
79
|
|
68
|
-
|
69
|
-
|
80
|
+
- Add support for partitioning ([pull#374](https://github.com/ridgepole/ridgepole/pull/374))
|
81
|
+
- Suppress warning of table option differences ([pull#378](https://github.com/ridgepole/ridgepole/pull/378))
|
70
82
|
|
71
83
|
### 1.0.1 (2022/01/15)
|
72
84
|
|
73
|
-
|
74
|
-
|
75
|
-
|
85
|
+
- Fix code for RuboCop 1.24.1
|
86
|
+
- Fix PostgreSQL spec for Rails 7.0
|
87
|
+
- Update ERBh gem (for development)
|
76
88
|
|
77
89
|
### 1.0.0 (2021/12/19)
|
78
90
|
|
79
|
-
|
80
|
-
|
91
|
+
- Support Rails 7.0
|
92
|
+
- `--skip-drop-table` by default ([pull#363](https://github.com/ridgepole/ridgepole/pull/363))
|
81
93
|
|
82
94
|
## 0.9
|
83
95
|
|
84
96
|
### 0.9.6
|
85
97
|
|
86
|
-
|
98
|
+
- Fix malformed error ([pull#362](https://github.com/ridgepole/ridgepole/pull/362))
|
87
99
|
|
88
100
|
### 0.9.5
|
89
101
|
|
90
|
-
|
102
|
+
- Call `super` in `disable_table_options.rb` ([pull#357](https://github.com/ridgepole/ridgepole/pull/357))
|
91
103
|
|
92
104
|
### 0.9.4
|
93
105
|
|
94
|
-
|
106
|
+
- Fix `--alter-extra` option for unique index ([pull#356](https://github.com/ridgepole/ridgepole/pull/356))
|
95
107
|
|
96
108
|
### 0.9.3
|
97
109
|
|
98
|
-
|
110
|
+
- Fix `limit` option for `t.integer` ([pull#354](https://github.com/ridgepole/ridgepole/pull/354))
|
99
111
|
|
100
112
|
### 0.9.2
|
101
113
|
|
102
|
-
|
114
|
+
- Support `t.column index option` ([pull#353](https://github.com/ridgepole/ridgepole/pull/353))
|
103
115
|
|
104
116
|
### 0.9.1
|
105
117
|
|
106
|
-
|
118
|
+
- Support `t.foreign_key` ([pull#348](https://github.com/ridgepole/ridgepole/pull/348))
|
107
119
|
|
108
120
|
### 0.9.0
|
109
121
|
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
122
|
+
- Remove `--mysql-use-alter` option ([pull#330](https://github.com/ridgepole/ridgepole/pull/330))
|
123
|
+
- Add `--table-hash-options` option ([pull#331](https://github.com/ridgepole/ridgepole/pull/331))
|
124
|
+
- Support Rails 6.1 ([pull#323](https://github.com/ridgepole/ridgepole/pull/323))
|
125
|
+
- Disable Rails 5.0 support ([pull#335](https://github.com/ridgepole/ridgepole/pull/335))
|
126
|
+
- Fix PK AUTO_INCREMENT change bug ([pull#334](https://github.com/ridgepole/ridgepole/pull/334))
|
115
127
|
|
116
128
|
## 0.8
|
117
129
|
|
118
130
|
### 0.8.13
|
119
131
|
|
120
|
-
|
132
|
+
- Support `serial` and `bigserial` column types ([pull#321](https://github.com/ridgepole/ridgepole/pull/321))
|
121
133
|
|
122
134
|
### 0.8.12
|
123
135
|
|
124
|
-
|
136
|
+
- Pluralize column specified by `references` ([pull#317](https://github.com/ridgepole/ridgepole/pull/317))
|
125
137
|
|
126
138
|
### 0.8.11
|
127
139
|
|
128
|
-
|
129
|
-
|
140
|
+
- Fix FK index check support multiple PK ([pull#315](https://github.com/ridgepole/ridgepole/pull/315))
|
141
|
+
- Support t.reference() foreign_key option ([pull#316](https://github.com/ridgepole/ridgepole/pull/316))
|
130
142
|
|
131
143
|
### 0.8.10
|
132
144
|
|
133
|
-
|
145
|
+
- Raise an error if an InnoDB column has a foreign key but no index ([pull#310](https://github.com/ridgepole/ridgepole/pull/310))
|
134
146
|
|
135
147
|
### 0.8.9
|
136
148
|
|
137
|
-
|
138
|
-
|
149
|
+
- Fix unexpected differences on text types and blob types on Rails 6 ([pull#306](https://github.com/ridgepole/ridgepole/pull/306))
|
150
|
+
- Fix unexpected warning when a foreign key is added on the primary key ([pull#307](https://github.com/ridgepole/ridgepole/pull/307))
|
139
151
|
|
140
152
|
### 0.8.8
|
141
153
|
|
142
|
-
|
154
|
+
- Fix keyword arguments warnings in Ruby 2.7 ([pull#303](https://github.com/ridgepole/ridgepole/pull/303))
|
143
155
|
|
144
156
|
### 0.8.7
|
145
157
|
|
146
|
-
|
158
|
+
- Support `require_relative` ([pull#298](https://github.com/ridgepole/ridgepole/pull/298))
|
147
159
|
|
148
160
|
### 0.8.6
|
149
161
|
|
150
|
-
|
162
|
+
- Support multiple databases feature ([pull#297](https://github.com/ridgepole/ridgepole/pull/297))
|
151
163
|
|
152
164
|
### 0.8.5
|
153
165
|
|
154
|
-
|
166
|
+
- Improve warning message on table options ([pull#291](https://github.com/ridgepole/ridgepole/pull/291))
|
155
167
|
|
156
168
|
### 0.8.4
|
157
169
|
|
158
|
-
|
170
|
+
- Display a warning if an InnoDB table doesn't have any indexes on a column where it has a foreign key ([pull#290](https://github.com/ridgepole/ridgepole/pull/290))
|
159
171
|
|
160
172
|
### 0.8.3
|
161
173
|
|
162
|
-
|
174
|
+
- Fix "topological sort failed" error ([pull#287](https://github.com/ridgepole/ridgepole/pull/287))
|
163
175
|
|
164
176
|
### 0.8.2
|
165
177
|
|
166
|
-
|
178
|
+
- Support `postgres://` schema ([pull#285](https://github.com/ridgepole/ridgepole/pull/285))
|
167
179
|
|
168
180
|
### 0.8.1
|
169
181
|
|
170
|
-
|
182
|
+
- Drop tables in an order considering foreign key constraints ([pull#284](https://github.com/ridgepole/ridgepole/pull/284))
|
171
183
|
|
172
184
|
### 0.8.0
|
173
185
|
|
174
|
-
|
186
|
+
- Support Rails 6.0
|
175
187
|
|
176
188
|
## 0.7
|
177
189
|
|
178
190
|
### 0.7.8
|
179
191
|
|
180
|
-
|
192
|
+
- Fix for `add_foreign_key(..., column: ,,,)` ([pull#278](https://github.com/ridgepole/ridgepole/pull/278))
|
181
193
|
|
182
194
|
### 0.7.7
|
183
195
|
|
184
|
-
|
196
|
+
- Support URI query string ([pull#273](https://github.com/ridgepole/ridgepole/pull/273))
|
185
197
|
|
186
198
|
### 0.7.6
|
187
199
|
|
188
|
-
|
189
|
-
|
200
|
+
- Fix database url check ([pull#266](https://github.com/ridgepole/ridgepole/pull/266))
|
201
|
+
- Add ignore option ([pull#267](https://github.com/ridgepole/ridgepole/pull/267))
|
190
202
|
|
191
203
|
### 0.7.5
|
192
204
|
|
193
|
-
|
194
|
-
|
195
|
-
|
205
|
+
- Fix polymorphic options ([pull#263](https://github.com/ridgepole/ridgepole/pull/263))
|
206
|
+
- Fix `--mysql-use-alter` option ([pull#246](https://github.com/ridgepole/ridgepole/pull/264))
|
207
|
+
- Fix Database URI parsing ([pull#265](https://github.com/ridgepole/ridgepole/pull/265))
|
196
208
|
|
197
209
|
### 0.7.4
|
198
210
|
|
199
|
-
|
211
|
+
- Fix `add_foreign_key` options ([issue#250](https://github.com/ridgepole/ridgepole/issues/250))
|
200
212
|
|
201
213
|
### 0.7.3
|
202
214
|
|
203
|
-
|
204
|
-
|
205
|
-
|
215
|
+
- Add `--mysql-change-table-comment option` ([pull#166](https://github.com/ridgepole/ridgepole/pull/166))
|
216
|
+
- Refactoring with RuboCop
|
217
|
+
- Support primary key adding/dropping ([issue#246](https://github.com/ridgepole/ridgepole/issues/246))
|
206
218
|
|
207
219
|
### 0.7.2
|
208
220
|
|
209
|
-
|
221
|
+
- Support Rails 5.2
|
210
222
|
|
211
223
|
### 0.7.1
|
212
224
|
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
225
|
+
- Remove `--reverse` option
|
226
|
+
- Add `--allow-pk-change` option
|
227
|
+
- Add `--create-table-with-index` option
|
228
|
+
- Add `--mysql-dump-auto-increment` option (`rails >= 5.1`)
|
217
229
|
|
218
230
|
### 0.7.0
|
219
231
|
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
232
|
+
- Remove Rails 4.x support
|
233
|
+
- Add Rails 5.1 support
|
234
|
+
- Remove `--enable-mysql-awesome` option
|
235
|
+
- Add `--skip-drop-table` option
|
236
|
+
- Support foreign key without name
|
237
|
+
- Support MySQL JSON Type and Generated Columns
|
238
|
+
- Add `--mysql-change-table-options` option
|
239
|
+
- Pass config from env
|
240
|
+
- Fix change fk order
|
241
|
+
- Add `--check-relation-type` option
|
242
|
+
- Add `--skip-column-comment-change` option
|
243
|
+
- Add `--default-bigint-limit` option
|
244
|
+
- Add `--ignore-table-comment` option
|
233
245
|
|
234
246
|
## 0.6
|
235
247
|
|
236
248
|
### 0.6.6
|
237
249
|
|
238
|
-
|
239
|
-
|
240
|
-
|
250
|
+
- Use `t.column` for migration ([pull#114](https://github.com/ridgepole/ridgepole/pull/114))
|
251
|
+
- Support DATABASE_URL format ([pull#118](https://github.com/ridgepole/ridgepole/pull/118))
|
252
|
+
- Add Ruby2.4 CI ([pull#119](https://github.com/ridgepole/ridgepole/pull/119))
|
241
253
|
|
242
254
|
### 0.6.5
|
243
255
|
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
256
|
+
- Fix rails version `'>= 4.2', '< 6'`
|
257
|
+
- Support new types ([pull#84](https://github.com/ridgepole/ridgepole/pull/84))
|
258
|
+
- Support `default: -> { ... }` ([pull#85](https://github.com/ridgepole/ridgepole/pull/85))
|
259
|
+
- Support DDL Comment (Rails5 only)
|
260
|
+
- Output schema diff when pass `--verbose`
|
261
|
+
- Support composite primary key (Rails5 only / [pull#97](https://github.com/ridgepole/ridgepole/pull/97))
|
250
262
|
|
251
263
|
### 0.6.4
|
252
264
|
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
265
|
+
- Execute sql using external script ([pull#56](https://github.com/ridgepole/ridgepole/pull/56))
|
266
|
+
- Add `--mysql-use-alter` option
|
267
|
+
- Add `--alter-extra` option
|
268
|
+
- Add `--dump-with-default-fk-name` option
|
269
|
+
- Support `t.index` ([pull#64](https://github.com/ridgepole/ridgepole/pull/64))
|
270
|
+
- Remove migration_comments
|
271
|
+
- Fix foreign key apply order
|
260
272
|
|
261
273
|
### 0.6.3
|
262
274
|
|
263
|
-
|
264
|
-
|
265
|
-
|
275
|
+
- Fix `default` option ([pull#48](https://github.com/ridgepole/ridgepole/pull/48))
|
276
|
+
- Add `--enable-migration-comments` option ([pull#50](https://github.com/ridgepole/ridgepole/pull/50))
|
277
|
+
- Disable `rename_table_indexes`
|
266
278
|
|
267
279
|
### 0.6.1
|
268
280
|
|
269
|
-
|
281
|
+
- Support [PostgreSQL columns](https://github.com/winebarrel/rails/blob/v4.2.1/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb#L79)
|
270
282
|
|
271
283
|
### 0.6.0
|
272
284
|
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
285
|
+
- Fix rails version `~> 4.2.1`
|
286
|
+
- Disable following libraries support:
|
287
|
+
- activerecord-mysql-unsigned
|
288
|
+
- migration_comments
|
289
|
+
- foreigner
|
290
|
+
- Disable sqlite support
|
291
|
+
- Add PostgreSQL test
|
292
|
+
- Remove `--mysql-awesome-unsigned-pk` option
|
281
293
|
|
282
294
|
## 0.5
|
283
295
|
|
284
296
|
### 0.5.2
|
285
297
|
|
286
|
-
|
287
|
-
|
288
|
-
|
298
|
+
- Add `--enable-mysql-awesome` option ([activerecord-mysql-awesome](https://github.com/kamipo/activerecord-mysql-awesome) is required `>= 0.0.3`)
|
299
|
+
- It is not possible to enable both `--enable-mysql-awesome` and `--enable-migration-comments`, `--enable-mysql-awesome` and `--enable-mysql-unsigned`, `--enable-mysql-awesome` and `--enable-mysql-pkdump`
|
300
|
+
- Fix foreigner version `<= 1.7.1`
|
289
301
|
|
290
302
|
### 0.5.1
|
291
303
|
|
292
|
-
|
293
|
-
|
304
|
+
- Add `--enable-migration-comments` option ([migration_comments](https://github.com/pinnymz/migration_comments) is required)
|
305
|
+
- Fix rails version `< 4.2.0`
|
294
306
|
|
295
307
|
### 0.5.0
|
296
308
|
|
297
|
-
|
309
|
+
- Fix `activerecord-mysql-unsigned` version: `~> 0.3.1`
|
298
310
|
|
299
311
|
## 0.4
|
300
312
|
|
301
313
|
### 0.4.12
|
302
314
|
|
303
|
-
|
315
|
+
- Fix `activerecord-mysql-unsigned` version: `~> 0.2.0`
|
304
316
|
|
305
317
|
### 0.4.11
|
306
318
|
|
307
|
-
|
319
|
+
- Add `--enable-mysql-pkdump` option.
|
308
320
|
|
309
321
|
### 0.4.8
|
310
322
|
|
311
|
-
|
312
|
-
|
323
|
+
- `activerecord-mysql-unsigned` is now optional. Please pass `--enable-mysql-unsigned` after you install [activerecord-mysql-unsigned](https://github.com/waka/activerecord-mysql-unsigned) if you want to use.
|
324
|
+
- Please pass `--enable-foreigner` after you install [foreigner](https://github.com/matthuhiggins/foreigner) if you want to use the foreign key.
|
data/README.md
CHANGED
@@ -9,28 +9,28 @@ It defines DB schema using [Rails DSL](http://guides.rubyonrails.org/migrations.
|
|
9
9
|
[![Build Status](https://github.com/ridgepole/ridgepole/workflows/test/badge.svg?branch=1.2)](https://github.com/ridgepole/ridgepole/actions)
|
10
10
|
[![Coverage Status](https://coveralls.io/repos/github/ridgepole/ridgepole/badge.svg?branch=1.2)](https://coveralls.io/github/ridgepole/ridgepole?branch=1.2)
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
*
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
*
|
19
|
-
*
|
20
|
-
*
|
21
|
-
|
22
|
-
|
23
|
-
*
|
24
|
-
|
25
|
-
* ActiveRecord 6.1
|
26
|
-
|
27
|
-
|
28
|
-
*
|
29
|
-
|
30
|
-
|
31
|
-
*
|
32
|
-
|
33
|
-
|
12
|
+
> [!note]
|
13
|
+
> * ridgepole v2.0.0
|
14
|
+
> * Support Trilogy (cf. https://github.com/ridgepole/ridgepole/pull/447)
|
15
|
+
> * Support Rails 7.1 (cf. https://github.com/ridgepole/ridgepole/pull/441)
|
16
|
+
> * Drop support AcriveRecord 6.0 (cf. https://github.com/ridgepole/ridgepole/pull/440)
|
17
|
+
> * Drop support ActiveRecord 5.x in ridgepole v1.2.0.
|
18
|
+
> * Partitioning is no longer supported in ridgepole v1.1.0.
|
19
|
+
> * ActiveRecord 7.x has some incompatible changes. If you get unintended differences in `datetime` columns consider changing `precision`:
|
20
|
+
> * Add `precision: nil` for columns that previously had no `precision` specified (cf. https://github.com/ridgepole/ridgepole/issues/381)
|
21
|
+
> * Remove `precision: 6` from columns that previously had `precision: 6` specified explicitly (cf. https://github.com/ridgepole/ridgepole/issues/406)
|
22
|
+
> * For ActiveRecord 7.x series, please use AcriveRecord 7.0.2 or higher / Ridgepole 1.0.3 or higher.
|
23
|
+
> * cf. https://github.com/ridgepole/ridgepole/pull/380
|
24
|
+
> * ActiveRecord 6.1 is supported in ridgepole v0.9, but the ActiveRecord dump has been changed, so there is a difference between ActiveRecord 5.x/6.0 format.
|
25
|
+
> * **If you use ActiveRecord 6.1, please modify Schemafile format**.
|
26
|
+
> * cf. https://github.com/ridgepole/ridgepole/pull/323
|
27
|
+
> * `DROP TABLE` is skipped by default in v1.0 and later versions.
|
28
|
+
> * If you want to `DROP TABLE`, please pass `--drop-table`.
|
29
|
+
> * cf. https://github.com/ridgepole/ridgepole/pull/363
|
30
|
+
> * In Rails 7.0, the output of dumper is different from Rails 6.
|
31
|
+
> * cf. https://github.com/rails/rails/issues/43909
|
32
|
+
> * cf. https://github.com/rails/rails/commit/c2a6f618d22cca4d9b7be7fa7652e7aac509350c#diff-55f41513f027a3d219629f475f03c2d1105ca55c5093d691e1b3dc4710c6cc0b
|
33
|
+
> * SQLite does not support.
|
34
34
|
|
35
35
|
## Installation
|
36
36
|
|
@@ -82,13 +82,14 @@ Usage: ridgepole [options]
|
|
82
82
|
--dump-with-default-fk-name
|
83
83
|
--index-removed-drop-column
|
84
84
|
--drop-table
|
85
|
+
--drop-table-only
|
85
86
|
--mysql-change-table-options
|
86
87
|
--mysql-change-table-comment
|
87
88
|
--check-relation-type DEF_PK
|
88
89
|
--ignore-table-comment
|
89
90
|
--skip-column-comment-change
|
90
|
-
--create-table-with-index
|
91
91
|
--allow-pk-change
|
92
|
+
--create-table-with-index
|
92
93
|
--mysql-dump-auto-increment
|
93
94
|
-r, --require LIBS
|
94
95
|
--log-file LOG_FILE
|
@@ -96,6 +97,7 @@ Usage: ridgepole [options]
|
|
96
97
|
--debug
|
97
98
|
--[no-]color
|
98
99
|
-v, --version
|
100
|
+
-h, --help
|
99
101
|
```
|
100
102
|
|
101
103
|
## Usage
|
@@ -337,7 +339,8 @@ bundle exec appraisal activerecord-7.0 rake
|
|
337
339
|
# MYSQL80=1 bundle exec appraisal activerecord-7.0 rake
|
338
340
|
```
|
339
341
|
|
340
|
-
|
342
|
+
> [!note]
|
343
|
+
> mysql-client/postgresql-client is required for testing.
|
341
344
|
|
342
345
|
## Demo
|
343
346
|
|
data/bin/ridgepole
CHANGED
@@ -86,8 +86,7 @@ ARGV.options do |opt|
|
|
86
86
|
opt.on('', '--dry-run') { options[:dry_run] = true }
|
87
87
|
opt.on('', '--table-options OPTIONS') { |v| options[:table_options] = v }
|
88
88
|
opt.on('', '--table-hash-options OPTIONS') do |v|
|
89
|
-
|
90
|
-
hash = YAML.safe_load(v).deep_symbolize_keys
|
89
|
+
hash = YAML.safe_load(v, symbolize_names: true)
|
91
90
|
|
92
91
|
case hash[:id]
|
93
92
|
when String
|
@@ -137,6 +136,7 @@ ARGV.options do |opt|
|
|
137
136
|
opt.on('', '--dump-with-default-fk-name') { options[:dump_with_default_fk_name] = true }
|
138
137
|
opt.on('', '--index-removed-drop-column') { options[:index_removed_drop_column] = true }
|
139
138
|
opt.on('', '--drop-table') { options[:force_drop_table] = true }
|
139
|
+
opt.on('', '--drop-table-only') { options[:drop_table_only] = true }
|
140
140
|
opt.on('', '--mysql-change-table-options') { options[:mysql_change_table_options] = true }
|
141
141
|
opt.on('', '--mysql-change-table-comment') { options[:mysql_change_table_comment] = true }
|
142
142
|
opt.on('', '--check-relation-type DEF_PK') { |v| options[:check_relation_type] = v }
|
@@ -155,10 +155,14 @@ ARGV.options do |opt|
|
|
155
155
|
opt.on('', '--debug') { options[:debug] = true }
|
156
156
|
opt.on('', '--[no-]color') { |v| options[:color] = v }
|
157
157
|
|
158
|
-
opt.
|
158
|
+
opt.on_tail('-v', '--version') do
|
159
159
|
puts opt.ver
|
160
160
|
exit
|
161
161
|
end
|
162
|
+
opt.on_tail('-h', '--help') do
|
163
|
+
puts opt
|
164
|
+
exit
|
165
|
+
end
|
162
166
|
|
163
167
|
opt.parse!
|
164
168
|
|
@@ -261,15 +265,13 @@ begin
|
|
261
265
|
else
|
262
266
|
File.open(diff_file)
|
263
267
|
end
|
264
|
-
|
268
|
+
else
|
265
269
|
YAML.safe_load(
|
266
270
|
diff_file,
|
267
271
|
permitted_classes: [],
|
268
272
|
permitted_symbols: [],
|
269
273
|
aliases: true
|
270
274
|
)
|
271
|
-
else
|
272
|
-
YAML.safe_load(diff_file, [], [], true)
|
273
275
|
end
|
274
276
|
end
|
275
277
|
|
data/lib/ridgepole/cli/config.rb
CHANGED
@@ -13,15 +13,13 @@ module Ridgepole
|
|
13
13
|
parse_config_file(config)
|
14
14
|
elsif (expanded = File.expand_path(config)) && File.exist?(expanded)
|
15
15
|
parse_config_file(expanded)
|
16
|
-
|
16
|
+
else
|
17
17
|
YAML.safe_load(
|
18
18
|
ERB.new(config).result,
|
19
19
|
permitted_classes: [],
|
20
20
|
permitted_symbols: [],
|
21
21
|
aliases: true
|
22
22
|
)
|
23
|
-
else
|
24
|
-
YAML.safe_load(ERB.new(config).result, [], [], true)
|
25
23
|
end
|
26
24
|
|
27
25
|
parsed_config = parse_database_url(config) unless parsed_config.is_a?(Hash)
|
@@ -39,17 +37,12 @@ module Ridgepole
|
|
39
37
|
|
40
38
|
def parse_config_file(path)
|
41
39
|
yaml = ERB.new(File.read(path)).result
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
aliases: true
|
49
|
-
)
|
50
|
-
else
|
51
|
-
YAML.safe_load(yaml, [], [], true)
|
52
|
-
end
|
40
|
+
YAML.safe_load(
|
41
|
+
yaml,
|
42
|
+
permitted_classes: [],
|
43
|
+
permitted_symbols: [],
|
44
|
+
aliases: true
|
45
|
+
)
|
53
46
|
end
|
54
47
|
|
55
48
|
def parse_database_url(config)
|
data/lib/ridgepole/client.rb
CHANGED
@@ -29,7 +29,7 @@ module Ridgepole
|
|
29
29
|
|
30
30
|
logger.verbose_info('# Parse DSL')
|
31
31
|
expected_definition, expected_execute = @parser.parse(dsl, opts)
|
32
|
-
expected_definition.
|
32
|
+
expected_definition.each_value do |definition|
|
33
33
|
merge_table_options(definition)
|
34
34
|
end
|
35
35
|
logger.verbose_info('# Load tables')
|
data/lib/ridgepole/delta.rb
CHANGED
@@ -250,19 +250,19 @@ create_table(#{table_name.inspect}, #{inspect_options_include_default_proc(optio
|
|
250
250
|
end
|
251
251
|
|
252
252
|
unless (check_constraints = attrs[:check_constraints] || {}).empty?
|
253
|
-
check_constraints.
|
253
|
+
check_constraints.each_value do |check_constraint_attrs|
|
254
254
|
append_add_check_constraint(table_name, check_constraint_attrs, buf, true)
|
255
255
|
end
|
256
256
|
end
|
257
257
|
|
258
258
|
unless (exclusion_constraints = attrs[:exclusion_constraints] || {}).empty?
|
259
|
-
exclusion_constraints.
|
259
|
+
exclusion_constraints.each_value do |exclusion_constraint_attrs|
|
260
260
|
append_add_exclusion_constraint(table_name, exclusion_constraint_attrs, buf, true)
|
261
261
|
end
|
262
262
|
end
|
263
263
|
|
264
264
|
unless (unique_constraints = attrs[:unique_constraints] || {}).empty?
|
265
|
-
unique_constraints.
|
265
|
+
unique_constraints.each_value do |unique_constraint_attrs|
|
266
266
|
append_add_unique_constraint(table_name, unique_constraint_attrs, buf, true)
|
267
267
|
end
|
268
268
|
end
|
@@ -280,7 +280,7 @@ end
|
|
280
280
|
end
|
281
281
|
|
282
282
|
unless (foreign_keys = attrs[:foreign_keys] || {}).empty?
|
283
|
-
foreign_keys.
|
283
|
+
foreign_keys.each_value do |foreign_key_attrs|
|
284
284
|
append_add_foreign_key(table_name, foreign_key_attrs, post_buf_for_fk, @options)
|
285
285
|
end
|
286
286
|
end
|
@@ -308,7 +308,7 @@ drop_table(#{table_name.inspect})
|
|
308
308
|
def append_change_table_options(table_name, table_options, buf)
|
309
309
|
# XXX: MySQL only
|
310
310
|
buf.puts(<<-RUBY)
|
311
|
-
execute "ALTER TABLE #{ActiveRecord::Base.connection.quote_table_name(table_name)} #{table_options}"
|
311
|
+
execute "ALTER TABLE #{ActiveRecord::Base.connection.quote_table_name(table_name)} #{table_options.dump[1..-2]}"
|
312
312
|
RUBY
|
313
313
|
|
314
314
|
buf.puts
|
@@ -506,11 +506,11 @@ remove_index(#{table_name.inspect}, #{target})
|
|
506
506
|
end
|
507
507
|
|
508
508
|
def append_change_foreign_keys(table_name, delta, pre_buf_for_fk, post_buf_for_fk, options)
|
509
|
-
(delta[:delete] || {}).
|
509
|
+
(delta[:delete] || {}).each_value do |attrs|
|
510
510
|
append_remove_foreign_key(table_name, attrs, pre_buf_for_fk, options)
|
511
511
|
end
|
512
512
|
|
513
|
-
(delta[:add] || {}).
|
513
|
+
(delta[:add] || {}).each_value do |attrs|
|
514
514
|
append_add_foreign_key(table_name, attrs, post_buf_for_fk, options)
|
515
515
|
end
|
516
516
|
end
|
@@ -540,11 +540,11 @@ remove_foreign_key(#{table_name.inspect}, #{target})
|
|
540
540
|
end
|
541
541
|
|
542
542
|
def append_change_check_constraints(table_name, delta, buf)
|
543
|
-
(delta[:delete] || {}).
|
543
|
+
(delta[:delete] || {}).each_value do |attrs|
|
544
544
|
append_remove_check_constraint(table_name, attrs, buf)
|
545
545
|
end
|
546
546
|
|
547
|
-
(delta[:add] || {}).
|
547
|
+
(delta[:add] || {}).each_value do |attrs|
|
548
548
|
append_add_check_constraint(table_name, attrs, buf)
|
549
549
|
end
|
550
550
|
end
|
@@ -574,11 +574,11 @@ remove_check_constraint(#{table_name.inspect}, #{expression.inspect}, **#{attrs_
|
|
574
574
|
end
|
575
575
|
|
576
576
|
def append_change_exclusion_constraints(table_name, delta, buf)
|
577
|
-
(delta[:delete] || {}).
|
577
|
+
(delta[:delete] || {}).each_value do |attrs|
|
578
578
|
append_remove_exclusion_constraint(table_name, attrs, buf)
|
579
579
|
end
|
580
580
|
|
581
|
-
(delta[:add] || {}).
|
581
|
+
(delta[:add] || {}).each_value do |attrs|
|
582
582
|
append_add_exclusion_constraint(table_name, attrs, buf)
|
583
583
|
end
|
584
584
|
end
|
@@ -608,11 +608,11 @@ remove_exclusion_constraint(#{table_name.inspect}, #{expression.inspect}, **#{at
|
|
608
608
|
end
|
609
609
|
|
610
610
|
def append_change_unique_constraints(table_name, delta, buf)
|
611
|
-
(delta[:delete] || {}).
|
611
|
+
(delta[:delete] || {}).each_value do |attrs|
|
612
612
|
append_remove_unique_constraint(table_name, attrs, buf)
|
613
613
|
end
|
614
614
|
|
615
|
-
(delta[:add] || {}).
|
615
|
+
(delta[:add] || {}).each_value do |attrs|
|
616
616
|
append_add_unique_constraint(table_name, attrs, buf)
|
617
617
|
end
|
618
618
|
end
|
data/lib/ridgepole/diff.rb
CHANGED
@@ -28,12 +28,14 @@ module Ridgepole
|
|
28
28
|
if (from_attrs = from.delete(table_name))
|
29
29
|
@logger.verbose_info("# #{table_name}")
|
30
30
|
|
31
|
-
unless
|
32
|
-
|
33
|
-
|
31
|
+
unless @options[:drop_table_only]
|
32
|
+
unless (attrs_delta = diff_inspect(from_attrs, to_attrs)).empty?
|
33
|
+
@logger.verbose_info(attrs_delta)
|
34
|
+
end
|
34
35
|
|
35
|
-
|
36
|
-
|
36
|
+
scan_change(table_name, from_attrs, to_attrs, delta)
|
37
|
+
end
|
38
|
+
elsif !@options[:drop_table_only]
|
37
39
|
delta[:add] ||= {}
|
38
40
|
delta[:add][table_name] = to_attrs
|
39
41
|
end
|
@@ -41,7 +43,7 @@ module Ridgepole
|
|
41
43
|
|
42
44
|
scan_relation_info(relation_info)
|
43
45
|
|
44
|
-
if !@options[:merge] && @options[:force_drop_table]
|
46
|
+
if !@options[:merge] && (@options[:force_drop_table] || @options[:drop_table_only])
|
45
47
|
from.each do |table_name, from_attrs|
|
46
48
|
next unless target?(table_name)
|
47
49
|
|
data/lib/ridgepole/dsl_parser.rb
CHANGED
@@ -34,7 +34,7 @@ module Ridgepole
|
|
34
34
|
return unless attrs[:foreign_keys]
|
35
35
|
return unless attrs[:options][:options]&.include?('ENGINE=InnoDB')
|
36
36
|
|
37
|
-
attrs[:foreign_keys].
|
37
|
+
attrs[:foreign_keys].each_value do |foreign_key_attrs|
|
38
38
|
fk_index = foreign_key_attrs[:options][:column] || "#{foreign_key_attrs[:to_table].singularize}_id"
|
39
39
|
next if attrs[:indices]&.any? { |_k, v| v[:column_name].first == fk_index }
|
40
40
|
# NOTE: For composite primary keys, the first column of the primary key is used as the foreign key index
|
data/lib/ridgepole/version.rb
CHANGED
data/ridgepole.gemspec
CHANGED
@@ -28,6 +28,7 @@ Gem::Specification.new do |spec|
|
|
28
28
|
spec.add_dependency 'diffy'
|
29
29
|
|
30
30
|
spec.add_development_dependency 'appraisal', '>= 2.2.0'
|
31
|
+
spec.add_development_dependency 'bigdecimal'
|
31
32
|
spec.add_development_dependency 'bundler'
|
32
33
|
spec.add_development_dependency 'erbh', '>= 0.2.1'
|
33
34
|
spec.add_development_dependency 'hash_modern_inspect', '>= 0.1.1'
|
@@ -36,9 +37,9 @@ Gem::Specification.new do |spec|
|
|
36
37
|
spec.add_development_dependency 'pg'
|
37
38
|
spec.add_development_dependency 'rake'
|
38
39
|
spec.add_development_dependency 'rspec', '>= 3.0.0'
|
39
|
-
spec.add_development_dependency 'rspec-match_fuzzy', '>= 0.
|
40
|
+
spec.add_development_dependency 'rspec-match_fuzzy', '>= 0.2.0'
|
40
41
|
spec.add_development_dependency 'rspec-match_ruby', '>= 0.1.3'
|
41
|
-
spec.add_development_dependency 'rubocop', '1.
|
42
|
+
spec.add_development_dependency 'rubocop', '1.63.1'
|
42
43
|
spec.add_development_dependency 'rubocop-rake', '>= 0.5.1'
|
43
44
|
spec.add_development_dependency 'rubocop-rspec', '>= 2.1.0'
|
44
45
|
spec.add_development_dependency 'simplecov'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ridgepole
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Genki Sugawara
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-04-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -58,6 +58,20 @@ dependencies:
|
|
58
58
|
- - ">="
|
59
59
|
- !ruby/object:Gem::Version
|
60
60
|
version: 2.2.0
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: bigdecimal
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '0'
|
68
|
+
type: :development
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '0'
|
61
75
|
- !ruby/object:Gem::Dependency
|
62
76
|
name: bundler
|
63
77
|
requirement: !ruby/object:Gem::Requirement
|
@@ -176,14 +190,14 @@ dependencies:
|
|
176
190
|
requirements:
|
177
191
|
- - ">="
|
178
192
|
- !ruby/object:Gem::Version
|
179
|
-
version: 0.
|
193
|
+
version: 0.2.0
|
180
194
|
type: :development
|
181
195
|
prerelease: false
|
182
196
|
version_requirements: !ruby/object:Gem::Requirement
|
183
197
|
requirements:
|
184
198
|
- - ">="
|
185
199
|
- !ruby/object:Gem::Version
|
186
|
-
version: 0.
|
200
|
+
version: 0.2.0
|
187
201
|
- !ruby/object:Gem::Dependency
|
188
202
|
name: rspec-match_ruby
|
189
203
|
requirement: !ruby/object:Gem::Requirement
|
@@ -204,14 +218,14 @@ dependencies:
|
|
204
218
|
requirements:
|
205
219
|
- - '='
|
206
220
|
- !ruby/object:Gem::Version
|
207
|
-
version: 1.
|
221
|
+
version: 1.63.1
|
208
222
|
type: :development
|
209
223
|
prerelease: false
|
210
224
|
version_requirements: !ruby/object:Gem::Requirement
|
211
225
|
requirements:
|
212
226
|
- - '='
|
213
227
|
- !ruby/object:Gem::Version
|
214
|
-
version: 1.
|
228
|
+
version: 1.63.1
|
215
229
|
- !ruby/object:Gem::Dependency
|
216
230
|
name: rubocop-rake
|
217
231
|
requirement: !ruby/object:Gem::Requirement
|
@@ -348,7 +362,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
348
362
|
- !ruby/object:Gem::Version
|
349
363
|
version: '0'
|
350
364
|
requirements: []
|
351
|
-
rubygems_version: 3.
|
365
|
+
rubygems_version: 3.5.1
|
352
366
|
signing_key:
|
353
367
|
specification_version: 4
|
354
368
|
summary: Ridgepole is a tool to manage DB schema.
|