ridgepole 0.9.3 → 0.9.4
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4b1fa89270221dcad6cdfa188a879de277c0ed1ea8672d2d9456b3057fe70ac1
|
4
|
+
data.tar.gz: 1d30c79ae7adf620347c70f769a12e0cb01e38fdf799cf6cbe67f952ab014d9c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 853d1138335b2c697c7f84d1beceae743badacc2891fd05bb8d9349c7b8c10d763516d5d2c6e63d88a7f60d0c0f887270baa03738cc3496409bca6609990097c
|
7
|
+
data.tar.gz: f4b38e66c8a5295bdc7241a407b5a2c848a3558d6421a1cbe12520f5cd85aff08154783d353f0fc2d7ce4798f620e31e5b59fc31f2225ec4d52fefc33e8dec14
|
data/README.md
CHANGED
@@ -140,7 +140,9 @@ It defines DB schema using [Rails DSL](http://guides.rubyonrails.org/migrations.
|
|
140
140
|
* `>= 0.9.2`
|
141
141
|
* Support `t.column index option` ([pull#353](https://github.com/winebarrel/ridgepole/pull/353))
|
142
142
|
* `>= 0.9.3`
|
143
|
-
* Fix `limit` option for `t.integer` ([pull#354](https://github.com/winebarrel/ridgepole/pull/
|
143
|
+
* Fix `limit` option for `t.integer` ([pull#354](https://github.com/winebarrel/ridgepole/pull/354))
|
144
|
+
* `>= 0.9.4`
|
145
|
+
* Fix `--alter-extra` option for unique index ([pull#356](https://github.com/winebarrel/ridgepole/pull/356))
|
144
146
|
</details>
|
145
147
|
|
146
148
|
**Notice**
|
@@ -50,7 +50,7 @@ module Ridgepole
|
|
50
50
|
case sql
|
51
51
|
when /\AALTER\b/i
|
52
52
|
sql += ',' + Ridgepole::ExecuteExpander.alter_extra
|
53
|
-
when /\A(CREATE|DROP)\s+INDEX\b/i
|
53
|
+
when /\A(CREATE|DROP)\s+((ONLINE|OFFLINE)\s+)?((UNIQUE|FULLTEXT|SPATIAL)\s+)?INDEX\b/i
|
54
54
|
# https://dev.mysql.com/doc/refman/5.6/en/create-index.html
|
55
55
|
# https://dev.mysql.com/doc/refman/5.6/en/drop-index.html
|
56
56
|
sql += ' ' + Ridgepole::ExecuteExpander.alter_extra.tr(',', ' ')
|
data/lib/ridgepole/version.rb
CHANGED
@@ -186,6 +186,51 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
186
186
|
}
|
187
187
|
end
|
188
188
|
|
189
|
+
context 'when add unique index' do
|
190
|
+
let(:actual_dsl) do
|
191
|
+
erbh(<<-ERB)
|
192
|
+
create_table "employees", primary_key: "emp_no", force: :cascade do |t|
|
193
|
+
t.date "birth_date", null: false
|
194
|
+
t.string "first_name", limit: 14, null: false
|
195
|
+
t.string "last_name", limit: 16, null: false
|
196
|
+
t.string "gender", limit: 1, null: false
|
197
|
+
t.date "hire_date", null: false
|
198
|
+
end
|
199
|
+
ERB
|
200
|
+
end
|
201
|
+
|
202
|
+
let(:expected_dsl) do
|
203
|
+
erbh(<<-ERB)
|
204
|
+
create_table "employees", primary_key: "emp_no", force: :cascade do |t|
|
205
|
+
t.date "birth_date", null: false
|
206
|
+
t.string "first_name", limit: 14, null: false
|
207
|
+
t.string "last_name", limit: 16, null: false
|
208
|
+
t.string "gender", limit: 1, null: false
|
209
|
+
t.date "hire_date", null: false
|
210
|
+
t.index ["first_name"], name: "idx_first_name", unique: true
|
211
|
+
end
|
212
|
+
ERB
|
213
|
+
end
|
214
|
+
|
215
|
+
let(:alter_extra) { 'LOCK=DEFAULT, ALGORITHM=DEFAULT' }
|
216
|
+
|
217
|
+
before { subject.diff(actual_dsl).migrate }
|
218
|
+
subject { client }
|
219
|
+
|
220
|
+
it {
|
221
|
+
delta = subject.diff(expected_dsl)
|
222
|
+
expect(delta.differ?).to be_truthy
|
223
|
+
expect(subject.dump).to match_ruby actual_dsl
|
224
|
+
migrated, sql = delta.migrate(alter_extra: alter_extra, noop: true)
|
225
|
+
expect(migrated).to be_truthy
|
226
|
+
expect(sql).to match_fuzzy erbh(<<-SQL)
|
227
|
+
CREATE UNIQUE INDEX `idx_first_name` ON `employees` (`first_name`) LOCK=DEFAULT ALGORITHM=DEFAULT
|
228
|
+
SQL
|
229
|
+
delta.migrate(alter_extra: alter_extra)
|
230
|
+
expect(subject.dump).to match_ruby expected_dsl
|
231
|
+
}
|
232
|
+
end
|
233
|
+
|
189
234
|
context 'when drop index' do
|
190
235
|
let(:actual_dsl) do
|
191
236
|
erbh(<<-ERB)
|
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: 0.9.
|
4
|
+
version: 0.9.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Genki Sugawara
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-04-
|
11
|
+
date: 2021-04-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -472,7 +472,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
472
472
|
- !ruby/object:Gem::Version
|
473
473
|
version: '0'
|
474
474
|
requirements: []
|
475
|
-
rubygems_version: 3.
|
475
|
+
rubygems_version: 3.1.4
|
476
476
|
signing_key:
|
477
477
|
specification_version: 4
|
478
478
|
summary: Ridgepole is a tool to manage DB schema.
|