ridgepole 0.6.4.beta4 → 0.6.4.beta5
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 -0
- data/lib/ridgepole/dsl_parser.rb +13 -2
- data/lib/ridgepole/version.rb +1 -1
- data/spec/mysql/migrate/migrate_change_index6_spec.rb +216 -0
- data/spec/mysql/migrate/migrate_create_index2_spec.rb +157 -0
- data/spec/mysql/migrate/{migrate_drop_column_and_index_2_spec.rb → migrate_drop_column_and_index2_spec.rb} +0 -0
- metadata +32 -28
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ade1dcbc7f445d902258dd4f800d5753d44c2fc
|
4
|
+
data.tar.gz: 10157b046ddc87eb64d77f6cc19476625ab25f0d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 25133d89cc2b7b768c06e9166196df029e16af4eb49afb80f774513ed37a0e5d165dc9e7d3ae7b91d3eca87aed3b93f6d1060c3246899a5a87cf0650051f3c5f
|
7
|
+
data.tar.gz: 4da5e0c7910df14d8873c84d18ceb24cd833a5a5b62c9eda883e0f054d211a567e9e8a7327cb883a3af098f88864ace7477c2a8978068a918b49fabfd41bcb71
|
data/README.md
CHANGED
@@ -47,6 +47,7 @@ It defines DB schema using [Rails DSL](http://guides.rubyonrails.org/migrations.
|
|
47
47
|
* Add `--mysql-use-alter` option
|
48
48
|
* Add `--alter-extra` option
|
49
49
|
* Add `--dump-with-default-fk-name` option
|
50
|
+
* Support `t.index` ([pull#64](https://github.com/winebarrel/ridgepole/pull/64))
|
50
51
|
|
51
52
|
## Installation
|
52
53
|
|
data/lib/ridgepole/dsl_parser.rb
CHANGED
@@ -9,8 +9,10 @@ class Ridgepole::DSLParser
|
|
9
9
|
class TableDefinition
|
10
10
|
attr_reader :__definition
|
11
11
|
|
12
|
-
def initialize
|
12
|
+
def initialize(table_name, base)
|
13
13
|
@__definition = {}
|
14
|
+
@table_name = table_name
|
15
|
+
@base = base
|
14
16
|
end
|
15
17
|
|
16
18
|
def column(name, type, options = {})
|
@@ -72,6 +74,10 @@ class Ridgepole::DSLParser
|
|
72
74
|
end
|
73
75
|
end
|
74
76
|
|
77
|
+
def index(name, options = {})
|
78
|
+
@base.add_index(@table_name, name, options)
|
79
|
+
end
|
80
|
+
|
75
81
|
def timestamps(*args)
|
76
82
|
options = {:null => false}.merge(args.extract_options!)
|
77
83
|
column(:created_at, :datetime, options)
|
@@ -81,11 +87,16 @@ class Ridgepole::DSLParser
|
|
81
87
|
def references(*args)
|
82
88
|
options = args.extract_options!
|
83
89
|
polymorphic = options.delete(:polymorphic)
|
90
|
+
index_options = options.delete(:index)
|
84
91
|
type = options.delete(:type) || :integer
|
85
92
|
|
86
93
|
args.each do |col|
|
87
94
|
column("#{col}_id", type, options)
|
88
95
|
column("#{col}_type", :string, polymorphic.is_a?(Hash) ? polymorphic : options) if polymorphic
|
96
|
+
if index_options
|
97
|
+
index("#{col}_id", index_options.is_a?(Hash) ? index_options : {})
|
98
|
+
index("#{col}_type", index_options.is_a?(Hash) ? index_options : {}) if polymorphic
|
99
|
+
end
|
89
100
|
end
|
90
101
|
end
|
91
102
|
alias :belongs_to :references
|
@@ -114,7 +125,7 @@ class Ridgepole::DSLParser
|
|
114
125
|
|
115
126
|
def create_table(table_name, options = {})
|
116
127
|
table_name = table_name.to_s
|
117
|
-
table_definition = TableDefinition.new
|
128
|
+
table_definition = TableDefinition.new(table_name, self)
|
118
129
|
|
119
130
|
[:primary_key].each do |key|
|
120
131
|
options[key] = options[key].to_s if options[key]
|
data/lib/ridgepole/version.rb
CHANGED
@@ -0,0 +1,216 @@
|
|
1
|
+
unless postgresql?
|
2
|
+
describe 'Ridgepole::Client#diff -> migrate' do
|
3
|
+
context 'when change index (use t.index)' do
|
4
|
+
let(:actual_dsl) {
|
5
|
+
<<-RUBY
|
6
|
+
create_table "clubs"#{unsigned_if_enabled}, force: :cascade do |t|
|
7
|
+
t.string "name", limit: 255, default: "", null: false
|
8
|
+
end
|
9
|
+
|
10
|
+
add_index "clubs", ["name"], name: "idx_name", unique: true, using: :btree
|
11
|
+
|
12
|
+
create_table "departments", primary_key: "dept_no"#{unsigned_if_enabled}, force: :cascade do |t|
|
13
|
+
t.string "dept_name", limit: 40, null: false
|
14
|
+
end
|
15
|
+
|
16
|
+
add_index "departments", ["dept_name"], name: "dept_name", unique: true, using: :btree
|
17
|
+
|
18
|
+
create_table "dept_emp", id: false, force: :cascade do |t|
|
19
|
+
t.integer "emp_no", limit: 4, null: false
|
20
|
+
t.string "dept_no", limit: 4, null: false
|
21
|
+
t.date "from_date", null: false
|
22
|
+
t.date "to_date", null: false
|
23
|
+
end
|
24
|
+
|
25
|
+
add_index "dept_emp", ["dept_no"], name: "dept_no", using: :btree
|
26
|
+
add_index "dept_emp", ["emp_no"], name: "emp_no", using: :btree
|
27
|
+
|
28
|
+
create_table "dept_manager", id: false, force: :cascade do |t|
|
29
|
+
t.string "dept_no", limit: 4, null: false
|
30
|
+
t.integer "emp_no", limit: 4, null: false
|
31
|
+
t.date "from_date", null: false
|
32
|
+
t.date "to_date", null: false
|
33
|
+
end
|
34
|
+
|
35
|
+
add_index "dept_manager", ["dept_no"], name: "dept_no", using: :btree
|
36
|
+
add_index "dept_manager", ["emp_no"], name: "emp_no", using: :btree
|
37
|
+
|
38
|
+
create_table "employee_clubs"#{unsigned_if_enabled}, force: :cascade do |t|
|
39
|
+
t.integer "emp_no", limit: 4, null: false#{unsigned_if_enabled}
|
40
|
+
t.integer "club_id", limit: 4, null: false#{unsigned_if_enabled}
|
41
|
+
end
|
42
|
+
|
43
|
+
add_index "employee_clubs", ["emp_no", "club_id"], name: "idx_emp_no_club_id", using: :btree
|
44
|
+
|
45
|
+
create_table "employees", primary_key: "emp_no"#{unsigned_if_enabled}, force: :cascade do |t|
|
46
|
+
t.date "birth_date", null: false
|
47
|
+
t.string "first_name", limit: 14, null: false
|
48
|
+
t.string "last_name", limit: 16, null: false
|
49
|
+
t.string "gender", limit: 1, null: false
|
50
|
+
t.date "hire_date", null: false
|
51
|
+
end
|
52
|
+
|
53
|
+
create_table "salaries", id: false, force: :cascade do |t|
|
54
|
+
t.integer "emp_no", limit: 4, null: false
|
55
|
+
t.integer "salary", limit: 4, null: false
|
56
|
+
t.date "from_date", null: false
|
57
|
+
t.date "to_date", null: false
|
58
|
+
end
|
59
|
+
|
60
|
+
add_index "salaries", ["emp_no"], name: "emp_no", using: :btree
|
61
|
+
|
62
|
+
create_table "titles", id: false, force: :cascade do |t|
|
63
|
+
t.integer "emp_no", limit: 4, null: false
|
64
|
+
t.string "title", limit: 50, null: false
|
65
|
+
t.date "from_date", null: false
|
66
|
+
t.date "to_date"
|
67
|
+
end
|
68
|
+
|
69
|
+
add_index "titles", ["emp_no"], name: "emp_no", using: :btree
|
70
|
+
RUBY
|
71
|
+
}
|
72
|
+
|
73
|
+
let(:expected_dsl) {
|
74
|
+
<<-RUBY
|
75
|
+
create_table "clubs"#{unsigned_if_enabled}, force: :cascade do |t|
|
76
|
+
t.string "name", limit: 255, default: "", null: false
|
77
|
+
end
|
78
|
+
|
79
|
+
add_index "clubs", ["name"], name: "idx_name", unique: true, using: :btree
|
80
|
+
|
81
|
+
create_table "departments", primary_key: "dept_no"#{unsigned_if_enabled}, force: :cascade do |t|
|
82
|
+
t.string "dept_name", limit: 40, null: false
|
83
|
+
end
|
84
|
+
|
85
|
+
add_index "departments", ["dept_name"], name: "dept_name", unique: true, using: :btree
|
86
|
+
|
87
|
+
create_table "dept_emp", id: false, force: :cascade do |t|
|
88
|
+
t.integer "emp_no", limit: 4, null: false
|
89
|
+
t.string "dept_no", limit: 4, null: false
|
90
|
+
t.date "from_date", null: false
|
91
|
+
t.date "to_date", null: false
|
92
|
+
end
|
93
|
+
|
94
|
+
add_index "dept_emp", ["dept_no"], name: "dept_no", using: :btree
|
95
|
+
add_index "dept_emp", ["from_date"], name: "emp_no", using: :btree
|
96
|
+
|
97
|
+
create_table "dept_manager", id: false, force: :cascade do |t|
|
98
|
+
t.string "dept_no", limit: 4, null: false
|
99
|
+
t.integer "emp_no", limit: 4, null: false
|
100
|
+
t.date "from_date", null: false
|
101
|
+
t.date "to_date", null: false
|
102
|
+
end
|
103
|
+
|
104
|
+
add_index "dept_manager", ["dept_no"], name: "dept_no", using: :btree
|
105
|
+
add_index "dept_manager", ["from_date"], name: "emp_no", using: :btree
|
106
|
+
|
107
|
+
create_table "employee_clubs"#{unsigned_if_enabled}, force: :cascade do |t|
|
108
|
+
t.integer "emp_no", limit: 4, null: false#{unsigned_if_enabled}
|
109
|
+
t.integer "club_id", limit: 4, null: false#{unsigned_if_enabled}
|
110
|
+
end
|
111
|
+
|
112
|
+
add_index "employee_clubs", ["emp_no", "club_id"], name: "idx_emp_no_club_id", using: :btree
|
113
|
+
|
114
|
+
create_table "employees", primary_key: "emp_no"#{unsigned_if_enabled}, force: :cascade do |t|
|
115
|
+
t.date "birth_date", null: false
|
116
|
+
t.string "first_name", limit: 14, null: false
|
117
|
+
t.string "last_name", limit: 16, null: false
|
118
|
+
t.string "gender", limit: 1, null: false
|
119
|
+
t.date "hire_date", null: false
|
120
|
+
end
|
121
|
+
|
122
|
+
create_table "salaries", id: false, force: :cascade do |t|
|
123
|
+
t.integer "emp_no", limit: 4, null: false
|
124
|
+
t.integer "salary", limit: 4, null: false
|
125
|
+
t.date "from_date", null: false
|
126
|
+
t.date "to_date", null: false
|
127
|
+
end
|
128
|
+
|
129
|
+
add_index "salaries", ["from_date"], name: "emp_no", using: :btree
|
130
|
+
|
131
|
+
create_table "titles", id: false, force: :cascade do |t|
|
132
|
+
t.integer "emp_no", limit: 4, null: false
|
133
|
+
t.string "title", limit: 50, null: false
|
134
|
+
t.date "from_date", null: false
|
135
|
+
t.date "to_date"
|
136
|
+
end
|
137
|
+
|
138
|
+
add_index "titles", ["emp_no"], name: "emp_no", using: :btree
|
139
|
+
RUBY
|
140
|
+
}
|
141
|
+
|
142
|
+
let(:expected_dsl_using_t_index) {
|
143
|
+
<<-RUBY
|
144
|
+
create_table "clubs"#{unsigned_if_enabled}, force: :cascade do |t|
|
145
|
+
t.string "name", limit: 255, default: "", null: false
|
146
|
+
t.index "name", name: "idx_name", unique: true, using: :btree
|
147
|
+
end
|
148
|
+
|
149
|
+
create_table "departments", primary_key: "dept_no"#{unsigned_if_enabled}, force: :cascade do |t|
|
150
|
+
t.string "dept_name", limit: 40, null: false
|
151
|
+
t.index ["dept_name"], name: "dept_name", unique: true, using: :btree
|
152
|
+
end
|
153
|
+
|
154
|
+
create_table "dept_emp", id: false, force: :cascade do |t|
|
155
|
+
t.integer "emp_no", limit: 4, null: false
|
156
|
+
t.string "dept_no", limit: 4, null: false
|
157
|
+
t.date "from_date", null: false
|
158
|
+
t.date "to_date", null: false
|
159
|
+
t.index "dept_no", name: "dept_no", using: :btree
|
160
|
+
t.index ["from_date"], name: "emp_no", using: :btree
|
161
|
+
end
|
162
|
+
|
163
|
+
create_table "dept_manager", id: false, force: :cascade do |t|
|
164
|
+
t.string "dept_no", limit: 4, null: false
|
165
|
+
t.integer "emp_no", limit: 4, null: false
|
166
|
+
t.date "from_date", null: false
|
167
|
+
t.date "to_date", null: false
|
168
|
+
t.index "dept_no", name: "dept_no", using: :btree
|
169
|
+
t.index ["from_date"], name: "emp_no", using: :btree
|
170
|
+
end
|
171
|
+
|
172
|
+
create_table "employee_clubs"#{unsigned_if_enabled}, force: :cascade do |t|
|
173
|
+
t.integer "emp_no", limit: 4, null: false#{unsigned_if_enabled}
|
174
|
+
t.integer "club_id", limit: 4, null: false#{unsigned_if_enabled}
|
175
|
+
t.index ["emp_no", "club_id"], name: "idx_emp_no_club_id", using: :btree
|
176
|
+
end
|
177
|
+
|
178
|
+
create_table "employees", primary_key: "emp_no"#{unsigned_if_enabled}, force: :cascade do |t|
|
179
|
+
t.date "birth_date", null: false
|
180
|
+
t.string "first_name", limit: 14, null: false
|
181
|
+
t.string "last_name", limit: 16, null: false
|
182
|
+
t.string "gender", limit: 1, null: false
|
183
|
+
t.date "hire_date", null: false
|
184
|
+
end
|
185
|
+
|
186
|
+
create_table "salaries", id: false, force: :cascade do |t|
|
187
|
+
t.integer "emp_no", limit: 4, null: false
|
188
|
+
t.integer "salary", limit: 4, null: false
|
189
|
+
t.date "from_date", null: false
|
190
|
+
t.date "to_date", null: false
|
191
|
+
t.index "from_date", name: "emp_no", using: :btree
|
192
|
+
end
|
193
|
+
|
194
|
+
create_table "titles", id: false, force: :cascade do |t|
|
195
|
+
t.integer "emp_no", limit: 4, null: false
|
196
|
+
t.string "title", limit: 50, null: false
|
197
|
+
t.date "from_date", null: false
|
198
|
+
t.date "to_date"
|
199
|
+
t.index ["emp_no"], name: "emp_no", using: :btree
|
200
|
+
end
|
201
|
+
RUBY
|
202
|
+
}
|
203
|
+
|
204
|
+
before { subject.diff(actual_dsl).migrate }
|
205
|
+
subject { client }
|
206
|
+
|
207
|
+
it {
|
208
|
+
delta = subject.diff(expected_dsl_using_t_index)
|
209
|
+
expect(delta.differ?).to be_truthy
|
210
|
+
expect(subject.dump.delete_empty_lines).to eq actual_dsl.strip_heredoc.strip.delete_empty_lines
|
211
|
+
delta.migrate
|
212
|
+
expect(subject.dump.delete_empty_lines).to eq expected_dsl.strip_heredoc.strip.delete_empty_lines
|
213
|
+
}
|
214
|
+
end
|
215
|
+
end
|
216
|
+
end
|
@@ -0,0 +1,157 @@
|
|
1
|
+
unless postgresql?
|
2
|
+
describe 'Ridgepole::Client#diff -> migrate' do
|
3
|
+
context 'when create index (use t.index)' do
|
4
|
+
let(:dsl) {
|
5
|
+
<<-RUBY
|
6
|
+
create_table "clubs"#{unsigned_if_enabled}, force: :cascade do |t|
|
7
|
+
t.string "name", limit: 255, default: "", null: false
|
8
|
+
end
|
9
|
+
|
10
|
+
add_index "clubs", ["name"], name: "idx_name", unique: true, using: :btree
|
11
|
+
|
12
|
+
create_table "departments", primary_key: "dept_no"#{unsigned_if_enabled}, force: :cascade do |t|
|
13
|
+
t.string "dept_name", limit: 40, null: false
|
14
|
+
end
|
15
|
+
|
16
|
+
add_index "departments", ["dept_name"], name: "dept_name", unique: true, using: :btree
|
17
|
+
|
18
|
+
create_table "dept_emp", id: false, force: :cascade do |t|
|
19
|
+
t.integer "emp_no", limit: 4, null: false
|
20
|
+
t.string "dept_no", limit: 4, null: false
|
21
|
+
t.date "from_date", null: false
|
22
|
+
t.date "to_date", null: false
|
23
|
+
end
|
24
|
+
|
25
|
+
add_index "dept_emp", ["dept_no"], name: "dept_no", using: :btree
|
26
|
+
add_index "dept_emp", ["emp_no"], name: "emp_no", using: :btree
|
27
|
+
|
28
|
+
create_table "dept_manager", id: false, force: :cascade do |t|
|
29
|
+
t.string "dept_no", limit: 4, null: false
|
30
|
+
t.integer "emp_no", limit: 4, null: false
|
31
|
+
t.date "from_date", null: false
|
32
|
+
t.date "to_date", null: false
|
33
|
+
end
|
34
|
+
|
35
|
+
add_index "dept_manager", ["dept_no"], name: "dept_no", using: :btree
|
36
|
+
add_index "dept_manager", ["emp_no"], name: "emp_no", using: :btree
|
37
|
+
|
38
|
+
create_table "employee_clubs"#{unsigned_if_enabled}, force: :cascade do |t|
|
39
|
+
t.integer "emp_no", limit: 4, null: false#{unsigned_if_enabled}
|
40
|
+
t.integer "club_id", limit: 4, null: false#{unsigned_if_enabled}
|
41
|
+
end
|
42
|
+
|
43
|
+
add_index "employee_clubs", ["emp_no", "club_id"], name: "idx_emp_no_club_id", using: :btree
|
44
|
+
|
45
|
+
create_table "employees", primary_key: "emp_no"#{unsigned_if_enabled}, force: :cascade do |t|
|
46
|
+
t.date "birth_date", null: false
|
47
|
+
t.string "first_name", limit: 14, null: false
|
48
|
+
t.string "last_name", limit: 16, null: false
|
49
|
+
t.string "gender", limit: 1, null: false
|
50
|
+
t.date "hire_date", null: false
|
51
|
+
end
|
52
|
+
|
53
|
+
create_table "salaries", id: false, force: :cascade do |t|
|
54
|
+
t.integer "emp_no", limit: 4, null: false
|
55
|
+
t.integer "salary", limit: 4, null: false
|
56
|
+
t.date "from_date", null: false
|
57
|
+
t.date "to_date", null: false
|
58
|
+
end
|
59
|
+
|
60
|
+
add_index "salaries", ["emp_no"], name: "emp_no", using: :btree
|
61
|
+
|
62
|
+
create_table "titles", id: false, force: :cascade do |t|
|
63
|
+
t.integer "emp_no", limit: 4, null: false
|
64
|
+
t.string "title", limit: 50, null: false
|
65
|
+
t.date "from_date", null: false
|
66
|
+
t.date "to_date"
|
67
|
+
end
|
68
|
+
|
69
|
+
add_index "titles", ["emp_no"], name: "emp_no", using: :btree
|
70
|
+
RUBY
|
71
|
+
}
|
72
|
+
|
73
|
+
let(:actual_dsl) {
|
74
|
+
dsl.delete_add_index('clubs', ['name']).
|
75
|
+
delete_add_index('employee_clubs', ['emp_no', 'club_id']).
|
76
|
+
delete_add_index('titles', ['emp_no'])
|
77
|
+
}
|
78
|
+
|
79
|
+
let(:expected_dsl) {
|
80
|
+
<<-RUBY
|
81
|
+
create_table "clubs"#{unsigned_if_enabled}, force: :cascade do |t|
|
82
|
+
t.string "name", limit: 255, default: "", null: false
|
83
|
+
t.index ["name"], name: "idx_name", unique: true, using: :btree
|
84
|
+
end
|
85
|
+
|
86
|
+
create_table "departments", primary_key: "dept_no"#{unsigned_if_enabled}, force: :cascade do |t|
|
87
|
+
t.string "dept_name", limit: 40, null: false
|
88
|
+
end
|
89
|
+
|
90
|
+
add_index "departments", ["dept_name"], name: "dept_name", unique: true, using: :btree
|
91
|
+
|
92
|
+
create_table "dept_emp", id: false, force: :cascade do |t|
|
93
|
+
t.integer "emp_no", limit: 4, null: false
|
94
|
+
t.string "dept_no", limit: 4, null: false
|
95
|
+
t.date "from_date", null: false
|
96
|
+
t.date "to_date", null: false
|
97
|
+
end
|
98
|
+
|
99
|
+
add_index "dept_emp", ["dept_no"], name: "dept_no", using: :btree
|
100
|
+
add_index "dept_emp", ["emp_no"], name: "emp_no", using: :btree
|
101
|
+
|
102
|
+
create_table "dept_manager", id: false, force: :cascade do |t|
|
103
|
+
t.string "dept_no", limit: 4, null: false
|
104
|
+
t.integer "emp_no", limit: 4, null: false
|
105
|
+
t.date "from_date", null: false
|
106
|
+
t.date "to_date", null: false
|
107
|
+
end
|
108
|
+
|
109
|
+
add_index "dept_manager", ["dept_no"], name: "dept_no", using: :btree
|
110
|
+
add_index "dept_manager", ["emp_no"], name: "emp_no", using: :btree
|
111
|
+
|
112
|
+
create_table "employee_clubs"#{unsigned_if_enabled}, force: :cascade do |t|
|
113
|
+
t.integer "emp_no", limit: 4, null: false#{unsigned_if_enabled}
|
114
|
+
t.integer "club_id", limit: 4, null: false#{unsigned_if_enabled}
|
115
|
+
t.index ["emp_no", "club_id"], name: "idx_emp_no_club_id", using: :btree
|
116
|
+
end
|
117
|
+
|
118
|
+
create_table "employees", primary_key: "emp_no"#{unsigned_if_enabled}, force: :cascade do |t|
|
119
|
+
t.date "birth_date", null: false
|
120
|
+
t.string "first_name", limit: 14, null: false
|
121
|
+
t.string "last_name", limit: 16, null: false
|
122
|
+
t.string "gender", limit: 1, null: false
|
123
|
+
t.date "hire_date", null: false
|
124
|
+
end
|
125
|
+
|
126
|
+
create_table "salaries", id: false, force: :cascade do |t|
|
127
|
+
t.integer "emp_no", limit: 4, null: false
|
128
|
+
t.integer "salary", limit: 4, null: false
|
129
|
+
t.date "from_date", null: false
|
130
|
+
t.date "to_date", null: false
|
131
|
+
end
|
132
|
+
|
133
|
+
add_index "salaries", ["emp_no"], name: "emp_no", using: :btree
|
134
|
+
|
135
|
+
create_table "titles", id: false, force: :cascade do |t|
|
136
|
+
t.integer "emp_no", limit: 4, null: false
|
137
|
+
t.string "title", limit: 50, null: false
|
138
|
+
t.date "from_date", null: false
|
139
|
+
t.date "to_date"
|
140
|
+
t.index ["emp_no"], name: "emp_no", using: :btree
|
141
|
+
end
|
142
|
+
RUBY
|
143
|
+
}
|
144
|
+
|
145
|
+
before { subject.diff(actual_dsl).migrate }
|
146
|
+
subject { client }
|
147
|
+
|
148
|
+
it {
|
149
|
+
delta = subject.diff(expected_dsl)
|
150
|
+
expect(delta.differ?).to be_truthy
|
151
|
+
expect(subject.dump.delete_empty_lines).to eq actual_dsl.strip_heredoc.strip.delete_empty_lines
|
152
|
+
delta.migrate
|
153
|
+
expect(subject.dump.delete_empty_lines).to eq dsl.strip_heredoc.strip.delete_empty_lines
|
154
|
+
}
|
155
|
+
end
|
156
|
+
end
|
157
|
+
end
|
File without changes
|
metadata
CHANGED
@@ -1,139 +1,139 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ridgepole
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.4.
|
4
|
+
version: 0.6.4.beta5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Genki Sugawara
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-02-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 4.2.1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 4.2.1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - '>='
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - '>='
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - '>='
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: 3.0.0
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - '>='
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 3.0.0
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: mysql2
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ~>
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: 0.3.20
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ~>
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: 0.3.20
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: pg
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - '>='
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - '>='
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: coveralls
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - '>='
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
108
|
+
- - '>='
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: activerecord-mysql-awesome
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- -
|
115
|
+
- - '>='
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: 0.0.7
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- -
|
122
|
+
- - '>='
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: 0.0.7
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: migration_comments
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- -
|
129
|
+
- - '>='
|
130
130
|
- !ruby/object:Gem::Version
|
131
131
|
version: '0'
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- -
|
136
|
+
- - '>='
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
139
|
description: Ridgepole is a tool to manage DB schema. It defines DB schema using Rails
|
@@ -145,9 +145,9 @@ executables:
|
|
145
145
|
extensions: []
|
146
146
|
extra_rdoc_files: []
|
147
147
|
files:
|
148
|
-
-
|
149
|
-
-
|
150
|
-
-
|
148
|
+
- .gitignore
|
149
|
+
- .rspec
|
150
|
+
- .travis.yml
|
151
151
|
- Gemfile
|
152
152
|
- LICENSE.txt
|
153
153
|
- README.md
|
@@ -204,13 +204,15 @@ files:
|
|
204
204
|
- spec/mysql/migrate/migrate_change_index3_spec.rb
|
205
205
|
- spec/mysql/migrate/migrate_change_index4_spec.rb
|
206
206
|
- spec/mysql/migrate/migrate_change_index5_spec.rb
|
207
|
+
- spec/mysql/migrate/migrate_change_index6_spec.rb
|
207
208
|
- spec/mysql/migrate/migrate_change_index_spec.rb
|
208
209
|
- spec/mysql/migrate/migrate_change_table_option_spec.rb
|
210
|
+
- spec/mysql/migrate/migrate_create_index2_spec.rb
|
209
211
|
- spec/mysql/migrate/migrate_create_index_spec.rb
|
210
212
|
- spec/mysql/migrate/migrate_create_table_spec.rb
|
211
213
|
- spec/mysql/migrate/migrate_create_table_with_options_spec.rb
|
212
214
|
- spec/mysql/migrate/migrate_create_table_with_script_spec.rb
|
213
|
-
- spec/mysql/migrate/
|
215
|
+
- spec/mysql/migrate/migrate_drop_column_and_index2_spec.rb
|
214
216
|
- spec/mysql/migrate/migrate_drop_column_and_index_spec.rb
|
215
217
|
- spec/mysql/migrate/migrate_drop_column_spec.rb
|
216
218
|
- spec/mysql/migrate/migrate_drop_index_spec.rb
|
@@ -273,17 +275,17 @@ require_paths:
|
|
273
275
|
- lib
|
274
276
|
required_ruby_version: !ruby/object:Gem::Requirement
|
275
277
|
requirements:
|
276
|
-
- -
|
278
|
+
- - '>='
|
277
279
|
- !ruby/object:Gem::Version
|
278
280
|
version: '0'
|
279
281
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
280
282
|
requirements:
|
281
|
-
- -
|
283
|
+
- - '>'
|
282
284
|
- !ruby/object:Gem::Version
|
283
285
|
version: 1.3.1
|
284
286
|
requirements: []
|
285
287
|
rubyforge_project:
|
286
|
-
rubygems_version: 2.
|
288
|
+
rubygems_version: 2.0.14.1
|
287
289
|
signing_key:
|
288
290
|
specification_version: 4
|
289
291
|
summary: Ridgepole is a tool to manage DB schema.
|
@@ -320,13 +322,15 @@ test_files:
|
|
320
322
|
- spec/mysql/migrate/migrate_change_index3_spec.rb
|
321
323
|
- spec/mysql/migrate/migrate_change_index4_spec.rb
|
322
324
|
- spec/mysql/migrate/migrate_change_index5_spec.rb
|
325
|
+
- spec/mysql/migrate/migrate_change_index6_spec.rb
|
323
326
|
- spec/mysql/migrate/migrate_change_index_spec.rb
|
324
327
|
- spec/mysql/migrate/migrate_change_table_option_spec.rb
|
328
|
+
- spec/mysql/migrate/migrate_create_index2_spec.rb
|
325
329
|
- spec/mysql/migrate/migrate_create_index_spec.rb
|
326
330
|
- spec/mysql/migrate/migrate_create_table_spec.rb
|
327
331
|
- spec/mysql/migrate/migrate_create_table_with_options_spec.rb
|
328
332
|
- spec/mysql/migrate/migrate_create_table_with_script_spec.rb
|
329
|
-
- spec/mysql/migrate/
|
333
|
+
- spec/mysql/migrate/migrate_drop_column_and_index2_spec.rb
|
330
334
|
- spec/mysql/migrate/migrate_drop_column_and_index_spec.rb
|
331
335
|
- spec/mysql/migrate/migrate_drop_column_spec.rb
|
332
336
|
- spec/mysql/migrate/migrate_drop_index_spec.rb
|