ridgepole 2.0.0 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +2 -0
- data/CHANGELOG.md +131 -119
- data/README.md +23 -22
- data/bin/ridgepole +5 -1
- data/gemfiles/activerecord_7.0.gemfile +1 -1
- data/lib/ridgepole/client.rb +1 -1
- data/lib/ridgepole/delta.rb +24 -14
- 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: 212f7ac739d81f903fa7df88232f8e17e28b953628d03f9cd9a7c59baa037162
|
|
4
|
+
data.tar.gz: d61273f751c642076ee08849439b0505f97de16c86426a8f5c8e950a1a661f17
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e4c098c3eb46ba9d00147ec8dc4f2d494ae5a306e30dbce9cb38bc519d5726b1fe514846e7253b3870ed7b7ad4cb23a0e3e338f3755ad98dc6918f1faf25d88b
|
|
7
|
+
data.tar.gz: 7b18857bdc397b49a31e136032ac38160c369da235af669a442d93d5685ba5aade0fc549a711da3e0654503b669d6d1c70be1789152bbabf4e67ecf9b16974da
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
|
@@ -2,307 +2,319 @@
|
|
|
2
2
|
|
|
3
3
|
## 2.0
|
|
4
4
|
|
|
5
|
+
### 2.0.2 (2024/02/25)
|
|
6
|
+
|
|
7
|
+
- Fix bug that cannot include single quote in table comment [pull#467](https://github.com/ridgepole/ridgepole/pull/467)
|
|
8
|
+
|
|
9
|
+
### 2.0.1 (2023/11/22)
|
|
10
|
+
|
|
11
|
+
- Fix renamed_from bug [pull#453](https://github.com/ridgepole/ridgepole/pull/453)
|
|
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.0 (2023/11/10)
|
|
6
18
|
|
|
7
|
-
|
|
19
|
+
- Bump up version.
|
|
8
20
|
|
|
9
21
|
### 2.0.0.beta2 (2023/10/26)
|
|
10
22
|
|
|
11
|
-
|
|
12
|
-
|
|
23
|
+
- Support Rails 7.1 [pull#447](https://github.com/ridgepole/ridgepole/pull/447)
|
|
24
|
+
- Drop Rails 6.0 support [pull#440](https://github.com/ridgepole/ridgepole/pull/440)
|
|
13
25
|
|
|
14
26
|
### 2.0.0.beta (2023/10/22)
|
|
15
27
|
|
|
16
|
-
|
|
17
|
-
|
|
28
|
+
- Support Rails 7.1 [pull#441](https://github.com/ridgepole/ridgepole/pull/441)
|
|
29
|
+
- Drop Rails 6.0 support [pull#440](https://github.com/ridgepole/ridgepole/pull/440)
|
|
18
30
|
|
|
19
31
|
## 1.2
|
|
20
32
|
|
|
21
33
|
### 1.2.1 (2023/07/29)
|
|
22
34
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
35
|
+
- Support `t.enum` [pull#405](https://github.com/ridgepole/ridgepole/pull/405)
|
|
36
|
+
- Fix timestamps with index behavior [pull#428](https://github.com/ridgepole/ridgepole/pull/428)
|
|
37
|
+
- Fix broken `DEFAULT CURRENT_TIMESTAMP` spec [pull#420](https://github.com/ridgepole/ridgepole/pull/420)
|
|
38
|
+
- Add Ruby 3.2 to CI matrix [pull#419](https://github.com/ridgepole/ridgepole/pull/419)
|
|
27
39
|
|
|
28
40
|
### 1.2.0 (2022/09/24)
|
|
29
41
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
42
|
+
- Updated supported column types [pull#399](https://github.com/ridgepole/ridgepole/pull/399) [pull#400](https://github.com/ridgepole/ridgepole/pull/400)
|
|
43
|
+
- Support check constraint [pull#393](https://github.com/ridgepole/ridgepole/pull/393) [pull#397](https://github.com/ridgepole/ridgepole/pull/397)
|
|
44
|
+
- Drop suport Rails 5.x [pull#395](https://github.com/ridgepole/ridgepole/pull/395)
|
|
33
45
|
|
|
34
46
|
## 1.1
|
|
35
47
|
|
|
36
48
|
### 1.1.0 (2022/06/18)
|
|
37
49
|
|
|
38
|
-
|
|
50
|
+
- Revert partitioning support [pull#392](https://github.com/ridgepole/ridgepole/pull/392)
|
|
39
51
|
|
|
40
52
|
## 1.0
|
|
41
53
|
|
|
42
54
|
### 1.0.7 (2022/06/09)
|
|
43
55
|
|
|
44
|
-
|
|
56
|
+
- Normalize list partition values for PostgreSQL [pull#389](https://github.com/ridgepole/ridgepole/pull/389)
|
|
45
57
|
|
|
46
58
|
### 1.0.6 (2022/06/06)
|
|
47
59
|
|
|
48
|
-
|
|
60
|
+
- Support Hash partition for PostgreSQL [pull#387](https://github.com/ridgepole/ridgepole/pull/387)
|
|
49
61
|
|
|
50
62
|
### 1.0.5 (2022/06/05)
|
|
51
63
|
|
|
52
|
-
|
|
64
|
+
- Support DEFAULT partition for PostgreSQL [pull#386](https://github.com/ridgepole/ridgepole/pull/386)
|
|
53
65
|
|
|
54
66
|
### 1.0.4 (2022/03/28)
|
|
55
67
|
|
|
56
|
-
|
|
68
|
+
- Add warning for generated column [pull#382](https://github.com/ridgepole/ridgepole/pull/382)
|
|
57
69
|
|
|
58
70
|
### 1.0.3 (2022/02/12)
|
|
59
71
|
|
|
60
|
-
|
|
72
|
+
- Support Rails 7.0.2 [pull#380](https://github.com/ridgepole/ridgepole/pull/380)
|
|
61
73
|
|
|
62
74
|
### 1.0.2 (2022/02/06)
|
|
63
75
|
|
|
64
|
-
|
|
65
|
-
|
|
76
|
+
- Add support for partitioning ([pull#374](https://github.com/ridgepole/ridgepole/pull/374))
|
|
77
|
+
- Suppress warning of table option differences ([pull#378](https://github.com/ridgepole/ridgepole/pull/378))
|
|
66
78
|
|
|
67
79
|
### 1.0.1 (2022/01/15)
|
|
68
80
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
81
|
+
- Fix code for RuboCop 1.24.1
|
|
82
|
+
- Fix PostgreSQL spec for Rails 7.0
|
|
83
|
+
- Update ERBh gem (for development)
|
|
72
84
|
|
|
73
85
|
### 1.0.0 (2021/12/19)
|
|
74
86
|
|
|
75
|
-
|
|
76
|
-
|
|
87
|
+
- Support Rails 7.0
|
|
88
|
+
- `--skip-drop-table` by default ([pull#363](https://github.com/ridgepole/ridgepole/pull/363))
|
|
77
89
|
|
|
78
90
|
## 0.9
|
|
79
91
|
|
|
80
92
|
### 0.9.6
|
|
81
93
|
|
|
82
|
-
|
|
94
|
+
- Fix malformed error ([pull#362](https://github.com/ridgepole/ridgepole/pull/362))
|
|
83
95
|
|
|
84
96
|
### 0.9.5
|
|
85
97
|
|
|
86
|
-
|
|
98
|
+
- Call `super` in `disable_table_options.rb` ([pull#357](https://github.com/ridgepole/ridgepole/pull/357))
|
|
87
99
|
|
|
88
100
|
### 0.9.4
|
|
89
101
|
|
|
90
|
-
|
|
102
|
+
- Fix `--alter-extra` option for unique index ([pull#356](https://github.com/ridgepole/ridgepole/pull/356))
|
|
91
103
|
|
|
92
104
|
### 0.9.3
|
|
93
105
|
|
|
94
|
-
|
|
106
|
+
- Fix `limit` option for `t.integer` ([pull#354](https://github.com/ridgepole/ridgepole/pull/354))
|
|
95
107
|
|
|
96
108
|
### 0.9.2
|
|
97
109
|
|
|
98
|
-
|
|
110
|
+
- Support `t.column index option` ([pull#353](https://github.com/ridgepole/ridgepole/pull/353))
|
|
99
111
|
|
|
100
112
|
### 0.9.1
|
|
101
113
|
|
|
102
|
-
|
|
114
|
+
- Support `t.foreign_key` ([pull#348](https://github.com/ridgepole/ridgepole/pull/348))
|
|
103
115
|
|
|
104
116
|
### 0.9.0
|
|
105
117
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
118
|
+
- Remove `--mysql-use-alter` option ([pull#330](https://github.com/ridgepole/ridgepole/pull/330))
|
|
119
|
+
- Add `--table-hash-options` option ([pull#331](https://github.com/ridgepole/ridgepole/pull/331))
|
|
120
|
+
- Support Rails 6.1 ([pull#323](https://github.com/ridgepole/ridgepole/pull/323))
|
|
121
|
+
- Disable Rails 5.0 support ([pull#335](https://github.com/ridgepole/ridgepole/pull/335))
|
|
122
|
+
- Fix PK AUTO_INCREMENT change bug ([pull#334](https://github.com/ridgepole/ridgepole/pull/334))
|
|
111
123
|
|
|
112
124
|
## 0.8
|
|
113
125
|
|
|
114
126
|
### 0.8.13
|
|
115
127
|
|
|
116
|
-
|
|
128
|
+
- Support `serial` and `bigserial` column types ([pull#321](https://github.com/ridgepole/ridgepole/pull/321))
|
|
117
129
|
|
|
118
130
|
### 0.8.12
|
|
119
131
|
|
|
120
|
-
|
|
132
|
+
- Pluralize column specified by `references` ([pull#317](https://github.com/ridgepole/ridgepole/pull/317))
|
|
121
133
|
|
|
122
134
|
### 0.8.11
|
|
123
135
|
|
|
124
|
-
|
|
125
|
-
|
|
136
|
+
- Fix FK index check support multiple PK ([pull#315](https://github.com/ridgepole/ridgepole/pull/315))
|
|
137
|
+
- Support t.reference() foreign_key option ([pull#316](https://github.com/ridgepole/ridgepole/pull/316))
|
|
126
138
|
|
|
127
139
|
### 0.8.10
|
|
128
140
|
|
|
129
|
-
|
|
141
|
+
- Raise an error if an InnoDB column has a foreign key but no index ([pull#310](https://github.com/ridgepole/ridgepole/pull/310))
|
|
130
142
|
|
|
131
143
|
### 0.8.9
|
|
132
144
|
|
|
133
|
-
|
|
134
|
-
|
|
145
|
+
- Fix unexpected differences on text types and blob types on Rails 6 ([pull#306](https://github.com/ridgepole/ridgepole/pull/306))
|
|
146
|
+
- Fix unexpected warning when a foreign key is added on the primary key ([pull#307](https://github.com/ridgepole/ridgepole/pull/307))
|
|
135
147
|
|
|
136
148
|
### 0.8.8
|
|
137
149
|
|
|
138
|
-
|
|
150
|
+
- Fix keyword arguments warnings in Ruby 2.7 ([pull#303](https://github.com/ridgepole/ridgepole/pull/303))
|
|
139
151
|
|
|
140
152
|
### 0.8.7
|
|
141
153
|
|
|
142
|
-
|
|
154
|
+
- Support `require_relative` ([pull#298](https://github.com/ridgepole/ridgepole/pull/298))
|
|
143
155
|
|
|
144
156
|
### 0.8.6
|
|
145
157
|
|
|
146
|
-
|
|
158
|
+
- Support multiple databases feature ([pull#297](https://github.com/ridgepole/ridgepole/pull/297))
|
|
147
159
|
|
|
148
160
|
### 0.8.5
|
|
149
161
|
|
|
150
|
-
|
|
162
|
+
- Improve warning message on table options ([pull#291](https://github.com/ridgepole/ridgepole/pull/291))
|
|
151
163
|
|
|
152
164
|
### 0.8.4
|
|
153
165
|
|
|
154
|
-
|
|
166
|
+
- 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))
|
|
155
167
|
|
|
156
168
|
### 0.8.3
|
|
157
169
|
|
|
158
|
-
|
|
170
|
+
- Fix "topological sort failed" error ([pull#287](https://github.com/ridgepole/ridgepole/pull/287))
|
|
159
171
|
|
|
160
172
|
### 0.8.2
|
|
161
173
|
|
|
162
|
-
|
|
174
|
+
- Support `postgres://` schema ([pull#285](https://github.com/ridgepole/ridgepole/pull/285))
|
|
163
175
|
|
|
164
176
|
### 0.8.1
|
|
165
177
|
|
|
166
|
-
|
|
178
|
+
- Drop tables in an order considering foreign key constraints ([pull#284](https://github.com/ridgepole/ridgepole/pull/284))
|
|
167
179
|
|
|
168
180
|
### 0.8.0
|
|
169
181
|
|
|
170
|
-
|
|
182
|
+
- Support Rails 6.0
|
|
171
183
|
|
|
172
184
|
## 0.7
|
|
173
185
|
|
|
174
186
|
### 0.7.8
|
|
175
187
|
|
|
176
|
-
|
|
188
|
+
- Fix for `add_foreign_key(..., column: ,,,)` ([pull#278](https://github.com/ridgepole/ridgepole/pull/278))
|
|
177
189
|
|
|
178
190
|
### 0.7.7
|
|
179
191
|
|
|
180
|
-
|
|
192
|
+
- Support URI query string ([pull#273](https://github.com/ridgepole/ridgepole/pull/273))
|
|
181
193
|
|
|
182
194
|
### 0.7.6
|
|
183
195
|
|
|
184
|
-
|
|
185
|
-
|
|
196
|
+
- Fix database url check ([pull#266](https://github.com/ridgepole/ridgepole/pull/266))
|
|
197
|
+
- Add ignore option ([pull#267](https://github.com/ridgepole/ridgepole/pull/267))
|
|
186
198
|
|
|
187
199
|
### 0.7.5
|
|
188
200
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
201
|
+
- Fix polymorphic options ([pull#263](https://github.com/ridgepole/ridgepole/pull/263))
|
|
202
|
+
- Fix `--mysql-use-alter` option ([pull#246](https://github.com/ridgepole/ridgepole/pull/264))
|
|
203
|
+
- Fix Database URI parsing ([pull#265](https://github.com/ridgepole/ridgepole/pull/265))
|
|
192
204
|
|
|
193
205
|
### 0.7.4
|
|
194
206
|
|
|
195
|
-
|
|
207
|
+
- Fix `add_foreign_key` options ([issue#250](https://github.com/ridgepole/ridgepole/issues/250))
|
|
196
208
|
|
|
197
209
|
### 0.7.3
|
|
198
210
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
211
|
+
- Add `--mysql-change-table-comment option` ([pull#166](https://github.com/ridgepole/ridgepole/pull/166))
|
|
212
|
+
- Refactoring with RuboCop
|
|
213
|
+
- Support primary key adding/dropping ([issue#246](https://github.com/ridgepole/ridgepole/issues/246))
|
|
202
214
|
|
|
203
215
|
### 0.7.2
|
|
204
216
|
|
|
205
|
-
|
|
217
|
+
- Support Rails 5.2
|
|
206
218
|
|
|
207
219
|
### 0.7.1
|
|
208
220
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
221
|
+
- Remove `--reverse` option
|
|
222
|
+
- Add `--allow-pk-change` option
|
|
223
|
+
- Add `--create-table-with-index` option
|
|
224
|
+
- Add `--mysql-dump-auto-increment` option (`rails >= 5.1`)
|
|
213
225
|
|
|
214
226
|
### 0.7.0
|
|
215
227
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
228
|
+
- Remove Rails 4.x support
|
|
229
|
+
- Add Rails 5.1 support
|
|
230
|
+
- Remove `--enable-mysql-awesome` option
|
|
231
|
+
- Add `--skip-drop-table` option
|
|
232
|
+
- Support foreign key without name
|
|
233
|
+
- Support MySQL JSON Type and Generated Columns
|
|
234
|
+
- Add `--mysql-change-table-options` option
|
|
235
|
+
- Pass config from env
|
|
236
|
+
- Fix change fk order
|
|
237
|
+
- Add `--check-relation-type` option
|
|
238
|
+
- Add `--skip-column-comment-change` option
|
|
239
|
+
- Add `--default-bigint-limit` option
|
|
240
|
+
- Add `--ignore-table-comment` option
|
|
229
241
|
|
|
230
242
|
## 0.6
|
|
231
243
|
|
|
232
244
|
### 0.6.6
|
|
233
245
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
246
|
+
- Use `t.column` for migration ([pull#114](https://github.com/ridgepole/ridgepole/pull/114))
|
|
247
|
+
- Support DATABASE_URL format ([pull#118](https://github.com/ridgepole/ridgepole/pull/118))
|
|
248
|
+
- Add Ruby2.4 CI ([pull#119](https://github.com/ridgepole/ridgepole/pull/119))
|
|
237
249
|
|
|
238
250
|
### 0.6.5
|
|
239
251
|
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
252
|
+
- Fix rails version `'>= 4.2', '< 6'`
|
|
253
|
+
- Support new types ([pull#84](https://github.com/ridgepole/ridgepole/pull/84))
|
|
254
|
+
- Support `default: -> { ... }` ([pull#85](https://github.com/ridgepole/ridgepole/pull/85))
|
|
255
|
+
- Support DDL Comment (Rails5 only)
|
|
256
|
+
- Output schema diff when pass `--verbose`
|
|
257
|
+
- Support composite primary key (Rails5 only / [pull#97](https://github.com/ridgepole/ridgepole/pull/97))
|
|
246
258
|
|
|
247
259
|
### 0.6.4
|
|
248
260
|
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
261
|
+
- Execute sql using external script ([pull#56](https://github.com/ridgepole/ridgepole/pull/56))
|
|
262
|
+
- Add `--mysql-use-alter` option
|
|
263
|
+
- Add `--alter-extra` option
|
|
264
|
+
- Add `--dump-with-default-fk-name` option
|
|
265
|
+
- Support `t.index` ([pull#64](https://github.com/ridgepole/ridgepole/pull/64))
|
|
266
|
+
- Remove migration_comments
|
|
267
|
+
- Fix foreign key apply order
|
|
256
268
|
|
|
257
269
|
### 0.6.3
|
|
258
270
|
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
271
|
+
- Fix `default` option ([pull#48](https://github.com/ridgepole/ridgepole/pull/48))
|
|
272
|
+
- Add `--enable-migration-comments` option ([pull#50](https://github.com/ridgepole/ridgepole/pull/50))
|
|
273
|
+
- Disable `rename_table_indexes`
|
|
262
274
|
|
|
263
275
|
### 0.6.1
|
|
264
276
|
|
|
265
|
-
|
|
277
|
+
- Support [PostgreSQL columns](https://github.com/winebarrel/rails/blob/v4.2.1/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb#L79)
|
|
266
278
|
|
|
267
279
|
### 0.6.0
|
|
268
280
|
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
281
|
+
- Fix rails version `~> 4.2.1`
|
|
282
|
+
- Disable following libraries support:
|
|
283
|
+
- activerecord-mysql-unsigned
|
|
284
|
+
- migration_comments
|
|
285
|
+
- foreigner
|
|
286
|
+
- Disable sqlite support
|
|
287
|
+
- Add PostgreSQL test
|
|
288
|
+
- Remove `--mysql-awesome-unsigned-pk` option
|
|
277
289
|
|
|
278
290
|
## 0.5
|
|
279
291
|
|
|
280
292
|
### 0.5.2
|
|
281
293
|
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
294
|
+
- Add `--enable-mysql-awesome` option ([activerecord-mysql-awesome](https://github.com/kamipo/activerecord-mysql-awesome) is required `>= 0.0.3`)
|
|
295
|
+
- 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`
|
|
296
|
+
- Fix foreigner version `<= 1.7.1`
|
|
285
297
|
|
|
286
298
|
### 0.5.1
|
|
287
299
|
|
|
288
|
-
|
|
289
|
-
|
|
300
|
+
- Add `--enable-migration-comments` option ([migration_comments](https://github.com/pinnymz/migration_comments) is required)
|
|
301
|
+
- Fix rails version `< 4.2.0`
|
|
290
302
|
|
|
291
303
|
### 0.5.0
|
|
292
304
|
|
|
293
|
-
|
|
305
|
+
- Fix `activerecord-mysql-unsigned` version: `~> 0.3.1`
|
|
294
306
|
|
|
295
307
|
## 0.4
|
|
296
308
|
|
|
297
309
|
### 0.4.12
|
|
298
310
|
|
|
299
|
-
|
|
311
|
+
- Fix `activerecord-mysql-unsigned` version: `~> 0.2.0`
|
|
300
312
|
|
|
301
313
|
### 0.4.11
|
|
302
314
|
|
|
303
|
-
|
|
315
|
+
- Add `--enable-mysql-pkdump` option.
|
|
304
316
|
|
|
305
317
|
### 0.4.8
|
|
306
318
|
|
|
307
|
-
|
|
308
|
-
|
|
319
|
+
- `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.
|
|
320
|
+
- 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
|
[](https://github.com/ridgepole/ridgepole/actions)
|
|
10
10
|
[](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
|
|
|
@@ -96,6 +96,7 @@ Usage: ridgepole [options]
|
|
|
96
96
|
--debug
|
|
97
97
|
--[no-]color
|
|
98
98
|
-v, --version
|
|
99
|
+
-h, --help
|
|
99
100
|
```
|
|
100
101
|
|
|
101
102
|
## Usage
|
data/bin/ridgepole
CHANGED
|
@@ -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
|
|
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
|
@@ -4,6 +4,10 @@ module Ridgepole
|
|
|
4
4
|
class Delta
|
|
5
5
|
SCRIPT_NAME = '<Schema>'
|
|
6
6
|
|
|
7
|
+
RIDGEPOLE_OPTIONS = %i[
|
|
8
|
+
renamed_from
|
|
9
|
+
].freeze
|
|
10
|
+
|
|
7
11
|
def initialize(delta, options = {})
|
|
8
12
|
@delta = delta
|
|
9
13
|
@options = options
|
|
@@ -235,7 +239,7 @@ create_table(#{table_name.inspect}, #{inspect_options_include_default_proc(optio
|
|
|
235
239
|
normalize_limit(column_type, column_options)
|
|
236
240
|
|
|
237
241
|
buf.puts(<<-RUBY)
|
|
238
|
-
t.column(#{column_name.inspect}, :#{column_type.to_s.inspect}, #{inspect_options_include_default_proc(column_options)})
|
|
242
|
+
t.column(#{column_name.inspect}, :#{column_type.to_s.inspect}, #{inspect_options_include_default_proc(normalize_options(column_options))})
|
|
239
243
|
RUBY
|
|
240
244
|
end
|
|
241
245
|
|
|
@@ -246,19 +250,19 @@ create_table(#{table_name.inspect}, #{inspect_options_include_default_proc(optio
|
|
|
246
250
|
end
|
|
247
251
|
|
|
248
252
|
unless (check_constraints = attrs[:check_constraints] || {}).empty?
|
|
249
|
-
check_constraints.
|
|
253
|
+
check_constraints.each_value do |check_constraint_attrs|
|
|
250
254
|
append_add_check_constraint(table_name, check_constraint_attrs, buf, true)
|
|
251
255
|
end
|
|
252
256
|
end
|
|
253
257
|
|
|
254
258
|
unless (exclusion_constraints = attrs[:exclusion_constraints] || {}).empty?
|
|
255
|
-
exclusion_constraints.
|
|
259
|
+
exclusion_constraints.each_value do |exclusion_constraint_attrs|
|
|
256
260
|
append_add_exclusion_constraint(table_name, exclusion_constraint_attrs, buf, true)
|
|
257
261
|
end
|
|
258
262
|
end
|
|
259
263
|
|
|
260
264
|
unless (unique_constraints = attrs[:unique_constraints] || {}).empty?
|
|
261
|
-
unique_constraints.
|
|
265
|
+
unique_constraints.each_value do |unique_constraint_attrs|
|
|
262
266
|
append_add_unique_constraint(table_name, unique_constraint_attrs, buf, true)
|
|
263
267
|
end
|
|
264
268
|
end
|
|
@@ -276,7 +280,7 @@ end
|
|
|
276
280
|
end
|
|
277
281
|
|
|
278
282
|
unless (foreign_keys = attrs[:foreign_keys] || {}).empty?
|
|
279
|
-
foreign_keys.
|
|
283
|
+
foreign_keys.each_value do |foreign_key_attrs|
|
|
280
284
|
append_add_foreign_key(table_name, foreign_key_attrs, post_buf_for_fk, @options)
|
|
281
285
|
end
|
|
282
286
|
end
|
|
@@ -304,7 +308,7 @@ drop_table(#{table_name.inspect})
|
|
|
304
308
|
def append_change_table_options(table_name, table_options, buf)
|
|
305
309
|
# XXX: MySQL only
|
|
306
310
|
buf.puts(<<-RUBY)
|
|
307
|
-
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]}"
|
|
308
312
|
RUBY
|
|
309
313
|
|
|
310
314
|
buf.puts
|
|
@@ -502,11 +506,11 @@ remove_index(#{table_name.inspect}, #{target})
|
|
|
502
506
|
end
|
|
503
507
|
|
|
504
508
|
def append_change_foreign_keys(table_name, delta, pre_buf_for_fk, post_buf_for_fk, options)
|
|
505
|
-
(delta[:delete] || {}).
|
|
509
|
+
(delta[:delete] || {}).each_value do |attrs|
|
|
506
510
|
append_remove_foreign_key(table_name, attrs, pre_buf_for_fk, options)
|
|
507
511
|
end
|
|
508
512
|
|
|
509
|
-
(delta[:add] || {}).
|
|
513
|
+
(delta[:add] || {}).each_value do |attrs|
|
|
510
514
|
append_add_foreign_key(table_name, attrs, post_buf_for_fk, options)
|
|
511
515
|
end
|
|
512
516
|
end
|
|
@@ -536,11 +540,11 @@ remove_foreign_key(#{table_name.inspect}, #{target})
|
|
|
536
540
|
end
|
|
537
541
|
|
|
538
542
|
def append_change_check_constraints(table_name, delta, buf)
|
|
539
|
-
(delta[:delete] || {}).
|
|
543
|
+
(delta[:delete] || {}).each_value do |attrs|
|
|
540
544
|
append_remove_check_constraint(table_name, attrs, buf)
|
|
541
545
|
end
|
|
542
546
|
|
|
543
|
-
(delta[:add] || {}).
|
|
547
|
+
(delta[:add] || {}).each_value do |attrs|
|
|
544
548
|
append_add_check_constraint(table_name, attrs, buf)
|
|
545
549
|
end
|
|
546
550
|
end
|
|
@@ -570,11 +574,11 @@ remove_check_constraint(#{table_name.inspect}, #{expression.inspect}, **#{attrs_
|
|
|
570
574
|
end
|
|
571
575
|
|
|
572
576
|
def append_change_exclusion_constraints(table_name, delta, buf)
|
|
573
|
-
(delta[:delete] || {}).
|
|
577
|
+
(delta[:delete] || {}).each_value do |attrs|
|
|
574
578
|
append_remove_exclusion_constraint(table_name, attrs, buf)
|
|
575
579
|
end
|
|
576
580
|
|
|
577
|
-
(delta[:add] || {}).
|
|
581
|
+
(delta[:add] || {}).each_value do |attrs|
|
|
578
582
|
append_add_exclusion_constraint(table_name, attrs, buf)
|
|
579
583
|
end
|
|
580
584
|
end
|
|
@@ -604,11 +608,11 @@ remove_exclusion_constraint(#{table_name.inspect}, #{expression.inspect}, **#{at
|
|
|
604
608
|
end
|
|
605
609
|
|
|
606
610
|
def append_change_unique_constraints(table_name, delta, buf)
|
|
607
|
-
(delta[:delete] || {}).
|
|
611
|
+
(delta[:delete] || {}).each_value do |attrs|
|
|
608
612
|
append_remove_unique_constraint(table_name, attrs, buf)
|
|
609
613
|
end
|
|
610
614
|
|
|
611
|
-
(delta[:add] || {}).
|
|
615
|
+
(delta[:add] || {}).each_value do |attrs|
|
|
612
616
|
append_add_unique_constraint(table_name, attrs, buf)
|
|
613
617
|
end
|
|
614
618
|
end
|
|
@@ -646,6 +650,12 @@ remove_unique_constraint(#{table_name.inspect}, #{column_name.inspect}, **#{attr
|
|
|
646
650
|
column_options[:limit] ||= default_limit if default_limit
|
|
647
651
|
end
|
|
648
652
|
|
|
653
|
+
def normalize_options(options)
|
|
654
|
+
opts = options.dup
|
|
655
|
+
RIDGEPOLE_OPTIONS.each { opts.delete(_1) }
|
|
656
|
+
opts
|
|
657
|
+
end
|
|
658
|
+
|
|
649
659
|
def inspect_options_include_default_proc(options)
|
|
650
660
|
options = options.dup
|
|
651
661
|
|
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.60.2'
|
|
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.2
|
|
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-02-25 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.60.2
|
|
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.60.2
|
|
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.
|