ridgepole 0.7.0.beta11 → 0.7.0.beta12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/ridgepole/dsl_parser/context.rb +3 -1
- data/lib/ridgepole/version.rb +1 -1
- data/spec/mysql/migrate/migrate_change_index8_spec.rb +83 -0
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 49d810a267218a0eb0e29b24172b263bb01160de
|
4
|
+
data.tar.gz: 103967b434908d08b210e156107f5833fc45a567
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 80869484e860c7e14bd0757b09b72a6694cfa8dfadc883127f7f61c32e198954e16c00deb2ff63568c0fa04525b5604d9eb65c111a54654d035d1c534e7afab9
|
7
|
+
data.tar.gz: dd88225d51a88f149f8de5b913fa7198d5c97ff707e91062b7eb21a61be4e53d5f09b336adaef5f080ea98b9257b1a427bc83738760c1c5ffe321929e4108957
|
data/README.md
CHANGED
@@ -9,7 +9,7 @@ It defines DB schema using [Rails DSL](http://guides.rubyonrails.org/migrations.
|
|
9
9
|
[![Build Status](https://travis-ci.org/winebarrel/ridgepole.svg?branch=0.6)](https://travis-ci.org/winebarrel/ridgepole)
|
10
10
|
[![Coverage Status](https://coveralls.io/repos/github/winebarrel/ridgepole/badge.svg?branch=0.6)](https://coveralls.io/github/winebarrel/ridgepole?branch=0.6)
|
11
11
|
|
12
|
-
[![Edge Version](https://img.shields.io/badge/edge_version-0.7.0.
|
12
|
+
[![Edge Version](https://img.shields.io/badge/edge_version-0.7.0.beta12-brightgreen.svg)](https://rubygems.org/gems/ridgepole/versions/0.7.0.beta12)
|
13
13
|
[![Build Status](https://travis-ci.org/winebarrel/ridgepole.svg?branch=0.7)](https://travis-ci.org/winebarrel/ridgepole)
|
14
14
|
[![Coverage Status](https://coveralls.io/repos/github/winebarrel/ridgepole/badge.svg?branch=0.7)](https://coveralls.io/github/winebarrel/ridgepole?branch=0.7)
|
15
15
|
|
@@ -64,8 +64,10 @@ class Ridgepole::DSLParser
|
|
64
64
|
column_name.each do |col|
|
65
65
|
options[:length][col] = index_length
|
66
66
|
end
|
67
|
+
end
|
67
68
|
|
68
|
-
|
69
|
+
if options[:length]
|
70
|
+
options[:length] = options[:length].compact.symbolize_keys
|
69
71
|
end
|
70
72
|
|
71
73
|
@__definition[table_name][:indices][idx] = {
|
data/lib/ridgepole/version.rb
CHANGED
@@ -0,0 +1,83 @@
|
|
1
|
+
describe 'Ridgepole::Client#diff -> migrate' do
|
2
|
+
context 'when change index (length has string keys) / No update' do
|
3
|
+
let(:actual_dsl) {
|
4
|
+
erbh(<<-EOS)
|
5
|
+
create_table "employees", primary_key: "emp_no", force: :cascade do |t|
|
6
|
+
t.date "birth_date", null: false
|
7
|
+
t.string "first_name", limit: 14, null: false
|
8
|
+
t.string "last_name", limit: 16, null: false
|
9
|
+
t.string "gender", limit: 1, null: false
|
10
|
+
t.date "hire_date", null: false
|
11
|
+
t.index ["first_name", "last_name"], name: "idx_first_name_last_name", length: { first_name: 10, last_name: 10 }, <%= i cond(5.0, using: :btree) %>
|
12
|
+
end
|
13
|
+
EOS
|
14
|
+
}
|
15
|
+
|
16
|
+
let(:expected_dsl) {
|
17
|
+
erbh(<<-EOS)
|
18
|
+
create_table "employees", primary_key: "emp_no", force: :cascade do |t|
|
19
|
+
t.date "birth_date", null: false
|
20
|
+
t.string "first_name", limit: 14, null: false
|
21
|
+
t.string "last_name", limit: 16, null: false
|
22
|
+
t.string "gender", limit: 1, null: false
|
23
|
+
t.date "hire_date", null: false
|
24
|
+
t.index ["first_name", "last_name"], name: "idx_first_name_last_name", length: { "first_name" => 10, "last_name" => 10, "foo" => nil }, <%= i cond(5.0, using: :btree) %>
|
25
|
+
end
|
26
|
+
EOS
|
27
|
+
}
|
28
|
+
|
29
|
+
before { subject.diff(actual_dsl).migrate }
|
30
|
+
subject { client }
|
31
|
+
|
32
|
+
it {
|
33
|
+
delta = subject.diff(expected_dsl)
|
34
|
+
expect(delta.differ?).to be_falsy
|
35
|
+
expect(subject.dump).to match_fuzzy actual_dsl
|
36
|
+
}
|
37
|
+
end
|
38
|
+
|
39
|
+
context 'when change index (length has string keys) / Update' do
|
40
|
+
let(:actual_dsl) {
|
41
|
+
<<-EOS
|
42
|
+
create_table "employees", primary_key: "emp_no", force: :cascade do |t|
|
43
|
+
t.date "birth_date", null: false
|
44
|
+
t.string "first_name", limit: 14, null: false
|
45
|
+
t.string "last_name", limit: 16, null: false
|
46
|
+
t.string "gender", limit: 1, null: false
|
47
|
+
t.date "hire_date", null: false
|
48
|
+
end
|
49
|
+
EOS
|
50
|
+
}
|
51
|
+
|
52
|
+
let(:expected_dsl) {
|
53
|
+
erbh(<<-EOS)
|
54
|
+
create_table "employees", primary_key: "emp_no", force: :cascade do |t|
|
55
|
+
t.date "birth_date", null: false
|
56
|
+
t.string "first_name", limit: 14, null: false
|
57
|
+
t.string "last_name", limit: 16, null: false
|
58
|
+
t.string "gender", limit: 1, null: false
|
59
|
+
t.date "hire_date", null: false
|
60
|
+
t.index ["first_name", "last_name"], name: "idx_first_name_last_name", length: { "first_name" => 10, "last_name" => 10 }, <%= i cond(5.0, using: :btree) %>
|
61
|
+
end
|
62
|
+
EOS
|
63
|
+
}
|
64
|
+
|
65
|
+
let(:actual_dsl_plus_index) {
|
66
|
+
actual_dsl.sub(/\bend\b/, erbh(<<-EOS))
|
67
|
+
t.index ["first_name", "last_name"], name: "idx_first_name_last_name", length: { first_name: 10, last_name: 10 }, <%= i cond(5.0, using: :btree) %>
|
68
|
+
end
|
69
|
+
EOS
|
70
|
+
}
|
71
|
+
|
72
|
+
before { subject.diff(actual_dsl).migrate }
|
73
|
+
subject { client }
|
74
|
+
|
75
|
+
it {
|
76
|
+
delta = subject.diff(expected_dsl)
|
77
|
+
expect(delta.differ?).to be_truthy
|
78
|
+
expect(subject.dump).to match_fuzzy actual_dsl
|
79
|
+
delta.migrate
|
80
|
+
expect(subject.dump).to match_fuzzy actual_dsl_plus_index
|
81
|
+
}
|
82
|
+
end
|
83
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ridgepole
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.0.
|
4
|
+
version: 0.7.0.beta12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Genki Sugawara
|
@@ -282,6 +282,7 @@ files:
|
|
282
282
|
- spec/mysql/migrate/migrate_change_index5_spec.rb
|
283
283
|
- spec/mysql/migrate/migrate_change_index6_spec.rb
|
284
284
|
- spec/mysql/migrate/migrate_change_index7_spec.rb
|
285
|
+
- spec/mysql/migrate/migrate_change_index8_spec.rb
|
285
286
|
- spec/mysql/migrate/migrate_change_index_spec.rb
|
286
287
|
- spec/mysql/migrate/migrate_change_table_option_spec.rb
|
287
288
|
- spec/mysql/migrate/migrate_check_relation_column_type_spec.rb
|
@@ -426,6 +427,7 @@ test_files:
|
|
426
427
|
- spec/mysql/migrate/migrate_change_index5_spec.rb
|
427
428
|
- spec/mysql/migrate/migrate_change_index6_spec.rb
|
428
429
|
- spec/mysql/migrate/migrate_change_index7_spec.rb
|
430
|
+
- spec/mysql/migrate/migrate_change_index8_spec.rb
|
429
431
|
- spec/mysql/migrate/migrate_change_index_spec.rb
|
430
432
|
- spec/mysql/migrate/migrate_change_table_option_spec.rb
|
431
433
|
- spec/mysql/migrate/migrate_check_relation_column_type_spec.rb
|