ridgepole 0.8.7 → 0.8.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +63 -0
- data/.rubocop.yml +11 -2
- data/README.md +14 -2
- data/lib/ridgepole/delta.rb +28 -21
- data/lib/ridgepole/diff.rb +12 -0
- data/lib/ridgepole/dsl_parser.rb +3 -4
- data/lib/ridgepole/dsl_parser/context.rb +2 -3
- data/lib/ridgepole/dsl_parser/table_definition.rb +7 -0
- data/lib/ridgepole/ext/abstract_mysql_adapter/use_alter_index.rb +1 -1
- data/lib/ridgepole/external_sql_executer.rb +1 -1
- data/lib/ridgepole/version.rb +1 -1
- data/ridgepole.gemspec +1 -1
- data/spec/erb_helper.rb +4 -4
- data/spec/mysql/collation/collation_spec.rb +6 -0
- data/spec/mysql/diff/diff2_spec.rb +3 -3
- data/spec/mysql/diff/diff_spec.rb +3 -3
- data/spec/mysql/fk/migrate_create_fk_spec.rb +79 -10
- data/spec/mysql/fk/migrate_drop_fk_spec.rb +1 -1
- data/spec/mysql/fk/migrate_fk_with_column_spec.rb +2 -2
- data/spec/mysql/migrate/migrate_add_column_spec.rb +5 -5
- data/spec/mysql/migrate/migrate_change_column3_spec.rb +109 -18
- data/spec/mysql/migrate/migrate_change_column_spec.rb +5 -5
- data/spec/mysql/migrate/migrate_change_index_spec.rb +9 -9
- data/spec/mysql/migrate/migrate_create_index_spec.rb +6 -6
- data/spec/mysql/migrate/migrate_create_table_with_index_spec.rb +7 -7
- data/spec/mysql/migrate/migrate_create_table_with_options_spec.rb +8 -8
- data/spec/mysql/migrate/migrate_drop_column_and_index_spec.rb +4 -4
- data/spec/mysql/migrate/migrate_drop_column_spec.rb +3 -3
- data/spec/mysql/migrate/migrate_drop_index_spec.rb +6 -6
- data/spec/mysql/migrate/migrate_rename_column_spec.rb +3 -3
- data/spec/mysql/migrate/migrate_script_error_spec.rb +1 -1
- data/spec/mysql/text_blob_types/text_blob_types_spec.rb +4 -1
- data/spec/mysql/~default_name_fk/migrate_create_fk_spec.rb +1 -1
- data/spec/mysql/~default_name_fk/migrate_drop_fk_spec.rb +1 -1
- data/spec/mysql/~dump_auto_increment/migrate_create_table_with_index_spec.rb +7 -7
- data/spec/postgresql/diff/diff_spec.rb +2 -2
- data/spec/postgresql/fk/migrate_create_fk_spec.rb +2 -2
- data/spec/postgresql/fk/migrate_drop_fk_spec.rb +1 -1
- data/spec/postgresql/migrate/migrate_add_column_spec.rb +5 -5
- data/spec/postgresql/migrate/migrate_change_column_spec.rb +4 -4
- data/spec/postgresql/migrate/migrate_change_index_spec.rb +9 -9
- data/spec/postgresql/migrate/migrate_drop_column_spec.rb +3 -3
- data/spec/postgresql/migrate/migrate_drop_column_with_index_spec.rb +5 -5
- data/spec/postgresql/migrate/migrate_drop_expression_index_spec.rb +1 -1
- data/spec/postgresql/migrate/migrate_drop_index_spec.rb +6 -6
- data/spec/postgresql/migrate/migrate_rename_column_spec.rb +2 -2
- data/spec/postgresql/~default_name_fk/migrate_create_fk_spec.rb +1 -1
- data/spec/postgresql/~default_name_fk/migrate_drop_fk_spec.rb +1 -1
- data/spec/spec_condition.rb +4 -4
- data/spec/spec_helper.rb +2 -1
- metadata +7 -7
- data/.travis.yml +0 -44
@@ -50,7 +50,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
50
50
|
expect(delta.differ?).to be_truthy
|
51
51
|
expect(subject.dump).to match_fuzzy sorted_actual_dsl
|
52
52
|
expect(delta.script).to match_fuzzy <<-RUBY
|
53
|
-
remove_foreign_key("child",
|
53
|
+
remove_foreign_key("child", name: "child_ibfk_1")
|
54
54
|
RUBY
|
55
55
|
delta.migrate
|
56
56
|
expect(subject.dump).to match_ruby expected_dsl
|
@@ -44,8 +44,8 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
44
44
|
expect(delta.differ?).to be_truthy
|
45
45
|
expect(subject.dump).to match_ruby actual_dsl
|
46
46
|
expect(delta.script).to match_fuzzy <<-RUBY
|
47
|
-
add_foreign_key("direct_messages", "users", {:column=>"reciever_id"})
|
48
|
-
add_foreign_key("direct_messages", "users", {:column=>"sender_id"})
|
47
|
+
add_foreign_key("direct_messages", "users", **{:column=>"reciever_id"})
|
48
|
+
add_foreign_key("direct_messages", "users", **{:column=>"sender_id"})
|
49
49
|
RUBY
|
50
50
|
delta.migrate
|
51
51
|
expect(subject.dump).to match_ruby expected_dsl
|
@@ -145,13 +145,13 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
145
145
|
expect(delta.differ?).to be_truthy
|
146
146
|
expect(subject.dump).to match_ruby actual_dsl
|
147
147
|
expect(delta.script).to match_fuzzy erbh(<<-ERB)
|
148
|
-
change_table("employee_clubs",
|
149
|
-
t.column("any_col", :string, {:null=>false, :after=>"club_id", :limit=>255})
|
148
|
+
change_table("employee_clubs", bulk: true) do |t|
|
149
|
+
t.column("any_col", :string, **{:null=>false, :after=>"club_id", :limit=>255})
|
150
150
|
end
|
151
151
|
|
152
|
-
change_table("employees",
|
153
|
-
t.column("age", :integer, {:null=>false, :after=>"hire_date", :limit=>4})
|
154
|
-
t.column("updated_at", :date, {:after=>"age"})
|
152
|
+
change_table("employees", bulk: true) do |t|
|
153
|
+
t.column("age", :integer, **{:null=>false, :after=>"hire_date", :limit=>4})
|
154
|
+
t.column("updated_at", :date, **{:after=>"age"})
|
155
155
|
end
|
156
156
|
ERB
|
157
157
|
delta.migrate
|
@@ -99,9 +99,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
99
99
|
t.string "last_name", limit: 16, null: false
|
100
100
|
t.string "gender", limit: 1, null: false
|
101
101
|
t.date "hire_date", null: false
|
102
|
-
t.<%= cond('>= 5.1','bigint', 'integer') %> "products_id"
|
103
102
|
t.<%= cond('>= 5.1','bigint', 'integer') %> "user_id"
|
104
|
-
t.index "products_id"
|
105
103
|
t.index "user_id"
|
106
104
|
end
|
107
105
|
ERB
|
@@ -115,7 +113,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
115
113
|
t.string "last_name", limit: 16, null: false
|
116
114
|
t.string "gender", limit: 1, null: false
|
117
115
|
t.date "hire_date", null: false
|
118
|
-
t.references :
|
116
|
+
t.references :user
|
119
117
|
end
|
120
118
|
RUBY
|
121
119
|
end
|
@@ -138,11 +136,8 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
138
136
|
t.string "last_name", limit: 16, null: false
|
139
137
|
t.string "gender", limit: 1, null: false
|
140
138
|
t.date "hire_date", null: false
|
141
|
-
t.<%= cond('>= 5.1','bigint', 'integer') %> "products_id"
|
142
|
-
t.string "products_type"
|
143
139
|
t.<%= cond('>= 5.1','bigint', 'integer') %> "user_id"
|
144
140
|
t.string "user_type"
|
145
|
-
t.index ["products_type", "products_id"]
|
146
141
|
t.index ["user_type", "user_id"]
|
147
142
|
end
|
148
143
|
ERB
|
@@ -156,7 +151,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
156
151
|
t.string "last_name", limit: 16, null: false
|
157
152
|
t.string "gender", limit: 1, null: false
|
158
153
|
t.date "hire_date", null: false
|
159
|
-
t.references :
|
154
|
+
t.references :user, polymorphic: true
|
160
155
|
end
|
161
156
|
RUBY
|
162
157
|
end
|
@@ -174,11 +169,8 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
174
169
|
let(:actual_dsl) do
|
175
170
|
erbh(<<-ERB)
|
176
171
|
create_table "employees", primary_key: "emp_no", force: :cascade do |t|
|
177
|
-
t.<%= cond('>= 5.1','bigint', 'integer') %> "products_id", unsigned: true
|
178
|
-
t.string "products_type"
|
179
172
|
t.<%= cond('>= 5.1','bigint', 'integer') %> "user_id", unsigned: true
|
180
173
|
t.string "user_type"
|
181
|
-
t.index ["products_type", "products_id"]
|
182
174
|
t.index ["user_type", "user_id"]
|
183
175
|
end
|
184
176
|
ERB
|
@@ -187,7 +179,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
187
179
|
let(:expected_dsl) do
|
188
180
|
<<-RUBY
|
189
181
|
create_table "employees", primary_key: "emp_no", force: :cascade do |t|
|
190
|
-
t.references :
|
182
|
+
t.references :user, unsigned: true, polymorphic: true
|
191
183
|
end
|
192
184
|
RUBY
|
193
185
|
end
|
@@ -222,7 +214,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
222
214
|
t.string "last_name", limit: 16, null: false
|
223
215
|
t.string "gender", limit: 1, null: false
|
224
216
|
t.date "hire_date", null: false
|
225
|
-
t.references :
|
217
|
+
t.references :user
|
226
218
|
end
|
227
219
|
RUBY
|
228
220
|
end
|
@@ -235,9 +227,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
235
227
|
t.string "last_name", limit: 16, null: false
|
236
228
|
t.string "gender", limit: 1, null: false
|
237
229
|
t.date "hire_date", null: false
|
238
|
-
t.<%= cond('>= 5.1','bigint', 'integer') %> "products_id"
|
239
230
|
t.<%= cond('>= 5.1','bigint', 'integer') %> "user_id"
|
240
|
-
t.index ["products_id"], name: "index_employees_on_products_id", <%= i cond(5.0, using: :btree) %>
|
241
231
|
t.index ["user_id"], name: "index_employees_on_user_id", <%= i cond(5.0, using: :btree) %>
|
242
232
|
end
|
243
233
|
ERB
|
@@ -276,7 +266,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
276
266
|
t.string "last_name", limit: 16, null: false
|
277
267
|
t.string "gender", limit: 1, null: false
|
278
268
|
t.date "hire_date", null: false
|
279
|
-
t.references :
|
269
|
+
t.references :user, polymorphic: true
|
280
270
|
end
|
281
271
|
RUBY
|
282
272
|
end
|
@@ -289,11 +279,8 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
289
279
|
t.string "last_name", limit: 16, null: false
|
290
280
|
t.string "gender", limit: 1, null: false
|
291
281
|
t.date "hire_date", null: false
|
292
|
-
t.<%= cond('>= 5.1','bigint', 'integer') %> "products_id"
|
293
|
-
t.string "products_type"
|
294
282
|
t.<%= cond('>= 5.1','bigint', 'integer') %> "user_id"
|
295
283
|
t.string "user_type"
|
296
|
-
t.index ["products_type", "products_id"], name: "index_employees_on_products_type_and_products_id", <%= i cond(5.0, using: :btree) %>
|
297
284
|
t.index ["user_type", "user_id"], name: "index_employees_on_user_type_and_user_id", <%= i cond(5.0, using: :btree) %>
|
298
285
|
end
|
299
286
|
ERB
|
@@ -310,4 +297,108 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
310
297
|
expect(subject.dump).to match_ruby expected_dsl
|
311
298
|
}
|
312
299
|
end
|
300
|
+
|
301
|
+
context 'when use references with fk (no change)' do
|
302
|
+
let(:actual_dsl) do
|
303
|
+
erbh(<<-ERB)
|
304
|
+
create_table "users", force: :cascade do |t|
|
305
|
+
end
|
306
|
+
|
307
|
+
create_table "employees", primary_key: "emp_no", force: :cascade do |t|
|
308
|
+
t.date "birth_date", null: false
|
309
|
+
t.string "first_name", limit: 14, null: false
|
310
|
+
t.string "last_name", limit: 16, null: false
|
311
|
+
t.string "gender", limit: 1, null: false
|
312
|
+
t.date "hire_date", null: false
|
313
|
+
t.<%= cond('>= 5.1','bigint', 'integer') %> "user_id"
|
314
|
+
t.index "user_id"
|
315
|
+
end
|
316
|
+
|
317
|
+
add_foreign_key("employees", "users")
|
318
|
+
ERB
|
319
|
+
end
|
320
|
+
|
321
|
+
let(:expected_dsl) do
|
322
|
+
erbh(<<-ERB)
|
323
|
+
create_table "users", force: :cascade do |t|
|
324
|
+
end
|
325
|
+
|
326
|
+
create_table "employees", primary_key: "emp_no", force: :cascade do |t|
|
327
|
+
t.date "birth_date", null: false
|
328
|
+
t.string "first_name", limit: 14, null: false
|
329
|
+
t.string "last_name", limit: 16, null: false
|
330
|
+
t.string "gender", limit: 1, null: false
|
331
|
+
t.date "hire_date", null: false
|
332
|
+
t.references :user, foreign_key: true
|
333
|
+
end
|
334
|
+
ERB
|
335
|
+
end
|
336
|
+
|
337
|
+
before { subject.diff(actual_dsl).migrate }
|
338
|
+
subject { client }
|
339
|
+
|
340
|
+
it {
|
341
|
+
delta = subject.diff(expected_dsl)
|
342
|
+
expect(delta.differ?).to be_falsey
|
343
|
+
}
|
344
|
+
end
|
345
|
+
|
346
|
+
context 'when use references with fk (change)' do
|
347
|
+
let(:actual_dsl) do
|
348
|
+
erbh(<<-ERB)
|
349
|
+
create_table "employees", primary_key: "emp_no", force: :cascade do |t|
|
350
|
+
t.date "birth_date", null: false
|
351
|
+
t.string "first_name", limit: 14, null: false
|
352
|
+
t.string "last_name", limit: 16, null: false
|
353
|
+
t.string "gender", limit: 1, null: false
|
354
|
+
t.date "hire_date", null: false
|
355
|
+
end
|
356
|
+
create_table "users", force: :cascade do |t|
|
357
|
+
end
|
358
|
+
ERB
|
359
|
+
end
|
360
|
+
|
361
|
+
let(:dsl) do
|
362
|
+
erbh(<<-ERB)
|
363
|
+
create_table "employees", primary_key: "emp_no", force: :cascade do |t|
|
364
|
+
t.date "birth_date", null: false
|
365
|
+
t.string "first_name", limit: 14, null: false
|
366
|
+
t.string "last_name", limit: 16, null: false
|
367
|
+
t.string "gender", limit: 1, null: false
|
368
|
+
t.date "hire_date", null: false
|
369
|
+
t.references :user, foreign_key: true
|
370
|
+
end
|
371
|
+
create_table "users", force: :cascade do |t|
|
372
|
+
end
|
373
|
+
ERB
|
374
|
+
end
|
375
|
+
|
376
|
+
let(:expected_dsl) do
|
377
|
+
erbh(<<-ERB)
|
378
|
+
create_table "employees", primary_key: "emp_no", force: :cascade do |t|
|
379
|
+
t.date "birth_date", null: false
|
380
|
+
t.string "first_name", limit: 14, null: false
|
381
|
+
t.string "last_name", limit: 16, null: false
|
382
|
+
t.string "gender", limit: 1, null: false
|
383
|
+
t.date "hire_date", null: false
|
384
|
+
t.<%= cond('>= 5.1','bigint', 'integer') %> "user_id"
|
385
|
+
t.index ["user_id"], name: "index_employees_on_user_id", <%= i cond(5.0, using: :btree) %>
|
386
|
+
end
|
387
|
+
create_table "users", force: :cascade do |t|
|
388
|
+
end
|
389
|
+
add_foreign_key("employees", "users")
|
390
|
+
ERB
|
391
|
+
end
|
392
|
+
|
393
|
+
before { subject.diff(actual_dsl).migrate }
|
394
|
+
subject { client }
|
395
|
+
|
396
|
+
it {
|
397
|
+
delta = subject.diff(dsl)
|
398
|
+
expect(delta.differ?).to be_truthy
|
399
|
+
expect(subject.dump).to match_ruby actual_dsl
|
400
|
+
delta.migrate
|
401
|
+
expect(subject.dump).to match_ruby expected_dsl
|
402
|
+
}
|
403
|
+
end
|
313
404
|
end
|
@@ -142,13 +142,13 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
142
142
|
expect(delta.differ?).to be_truthy
|
143
143
|
expect(subject.dump).to match_ruby actual_dsl
|
144
144
|
expect(delta.script).to match_fuzzy erbh(<<-ERB)
|
145
|
-
change_table("employee_clubs",
|
146
|
-
t.change("club_id", :integer,
|
145
|
+
change_table("employee_clubs", bulk: true) do |t|
|
146
|
+
t.change("club_id", :integer, **<%= {:null=>true, :default=>nil, :unsigned=>false} + cond('>= 5.1',comment: nil) %>)
|
147
147
|
end
|
148
148
|
|
149
|
-
change_table("employees",
|
150
|
-
t.change("last_name", :string,
|
151
|
-
t.change("gender", :string,
|
149
|
+
change_table("employees", bulk: true) do |t|
|
150
|
+
t.change("last_name", :string, **<%= {:limit=>20, :default=>"XXX", :unsigned=>false} + cond('>= 5.1',comment: nil) %>)
|
151
|
+
t.change("gender", :string, **<%= {:limit=>2, :null=>false, :default=>nil, :unsigned=>false} + cond('>= 5.1',comment: nil) %>)
|
152
152
|
end
|
153
153
|
ERB
|
154
154
|
delta.migrate
|
@@ -204,19 +204,19 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
204
204
|
expect(delta.differ?).to be_truthy
|
205
205
|
expect(subject.dump).to match_ruby actual_dsl
|
206
206
|
expect(delta.script).to match_fuzzy <<-RUBY
|
207
|
-
change_table("dept_emp",
|
208
|
-
t.remove_index(
|
209
|
-
t.index(["from_date"], {:name=>"emp_no", :using=>:btree, :unique=>false})
|
207
|
+
change_table("dept_emp", bulk: true) do |t|
|
208
|
+
t.remove_index(name: "emp_no")
|
209
|
+
t.index(["from_date"], **{:name=>"emp_no", :using=>:btree, :unique=>false})
|
210
210
|
end
|
211
211
|
|
212
|
-
change_table("dept_manager",
|
213
|
-
t.remove_index(
|
214
|
-
t.index(["from_date"], {:name=>"emp_no", :using=>:btree, :unique=>false})
|
212
|
+
change_table("dept_manager", bulk: true) do |t|
|
213
|
+
t.remove_index(name: "emp_no")
|
214
|
+
t.index(["from_date"], **{:name=>"emp_no", :using=>:btree, :unique=>false})
|
215
215
|
end
|
216
216
|
|
217
|
-
change_table("salaries",
|
218
|
-
t.remove_index(
|
219
|
-
t.index(["from_date"], {:name=>"emp_no", :using=>:btree, :unique=>false})
|
217
|
+
change_table("salaries", bulk: true) do |t|
|
218
|
+
t.remove_index(name: "emp_no")
|
219
|
+
t.index(["from_date"], **{:name=>"emp_no", :using=>:btree, :unique=>false})
|
220
220
|
end
|
221
221
|
RUBY
|
222
222
|
|
@@ -141,16 +141,16 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
141
141
|
expect(delta.differ?).to be_truthy
|
142
142
|
expect(subject.dump).to match_ruby actual_dsl
|
143
143
|
expect(delta.script).to match_fuzzy erbh(<<-ERB)
|
144
|
-
change_table("clubs",
|
145
|
-
t.index(["name"],
|
144
|
+
change_table("clubs", bulk: true) do |t|
|
145
|
+
t.index(["name"], **<%= {:name=>"idx_name", :unique=>true} + cond(5.0, using: :btree) %>)
|
146
146
|
end
|
147
147
|
|
148
|
-
change_table("employee_clubs",
|
149
|
-
t.index(["emp_no", "club_id"],
|
148
|
+
change_table("employee_clubs", bulk: true) do |t|
|
149
|
+
t.index(["emp_no", "club_id"], **<%= {:name=>"idx_emp_no_club_id"} + cond(5.0, using: :btree) %>)
|
150
150
|
end
|
151
151
|
|
152
|
-
change_table("titles",
|
153
|
-
t.index(["emp_no"],
|
152
|
+
change_table("titles", bulk: true) do |t|
|
153
|
+
t.index(["emp_no"], **<%= {:name=>"emp_no"} + cond(5.0, using: :btree) %>)
|
154
154
|
end
|
155
155
|
ERB
|
156
156
|
delta.migrate
|
@@ -25,13 +25,13 @@ describe 'Ridgepole::Client#diff -> migrate (with index)' do
|
|
25
25
|
expect(delta.differ?).to be_truthy
|
26
26
|
|
27
27
|
expect(delta.script).to match_fuzzy erbh(<<-ERB)
|
28
|
-
create_table("dept_emp", {:primary_key=>["emp_no", "dept_no"]}) do |t|
|
29
|
-
t.column("emp_no", :"integer", {:null=>false, :limit=>4})
|
30
|
-
t.column("dept_no", :"string", {:null=>false, :limit=>255})
|
31
|
-
t.column("from_date", :"date", {:null=>false})
|
32
|
-
t.column("to_date", :"date", {:null=>false})
|
33
|
-
t.index(["dept_no"],
|
34
|
-
t.index(["emp_no"],
|
28
|
+
create_table("dept_emp", **{:primary_key=>["emp_no", "dept_no"]}) do |t|
|
29
|
+
t.column("emp_no", :"integer", **{:null=>false, :limit=>4})
|
30
|
+
t.column("dept_no", :"string", **{:null=>false, :limit=>255})
|
31
|
+
t.column("from_date", :"date", **{:null=>false})
|
32
|
+
t.column("to_date", :"date", **{:null=>false})
|
33
|
+
t.index(["dept_no"], **<%= {:name=>"dept_no"} + cond(5.0, using: :btree) %>)
|
34
|
+
t.index(["emp_no"], **<%= {:name=>"emp_no"} + cond(5.0, using: :btree) %>)
|
35
35
|
end
|
36
36
|
ERB
|
37
37
|
|
@@ -20,11 +20,11 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
20
20
|
expect(delta.differ?).to be_truthy
|
21
21
|
|
22
22
|
expect(delta.script).to match_fuzzy <<-RUBY
|
23
|
-
create_table("employee_clubs", {:options=>"ENGINE=MyISAM CHARSET=utf8"}) do |t|
|
24
|
-
t.column("emp_no", :"integer", {:null=>false, :unsigned=>true, :limit=>4})
|
25
|
-
t.column("club_id", :"integer", {:null=>false, :unsigned=>true, :limit=>4})
|
23
|
+
create_table("employee_clubs", **{:options=>"ENGINE=MyISAM CHARSET=utf8"}) do |t|
|
24
|
+
t.column("emp_no", :"integer", **{:null=>false, :unsigned=>true, :limit=>4})
|
25
|
+
t.column("club_id", :"integer", **{:null=>false, :unsigned=>true, :limit=>4})
|
26
26
|
end
|
27
|
-
add_index("employee_clubs", ["emp_no", "club_id"], {:name=>"idx_emp_no_club_id", :using=>:btree})
|
27
|
+
add_index("employee_clubs", ["emp_no", "club_id"], **{:name=>"idx_emp_no_club_id", :using=>:btree})
|
28
28
|
RUBY
|
29
29
|
}
|
30
30
|
end
|
@@ -48,11 +48,11 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
48
48
|
expect(delta.differ?).to be_truthy
|
49
49
|
|
50
50
|
expect(delta.script).to match_fuzzy <<-RUBY
|
51
|
-
create_table("employee_clubs", {:options=>"ENGINE=InnoDB CHARSET=utf8mb4"}) do |t|
|
52
|
-
t.column("emp_no", :"integer", {:null=>false, :unsigned=>true, :limit=>4})
|
53
|
-
t.column("club_id", :"integer", {:null=>false, :unsigned=>true, :limit=>4})
|
51
|
+
create_table("employee_clubs", **{:options=>"ENGINE=InnoDB CHARSET=utf8mb4"}) do |t|
|
52
|
+
t.column("emp_no", :"integer", **{:null=>false, :unsigned=>true, :limit=>4})
|
53
|
+
t.column("club_id", :"integer", **{:null=>false, :unsigned=>true, :limit=>4})
|
54
54
|
end
|
55
|
-
add_index("employee_clubs", ["emp_no", "club_id"], {:name=>"idx_emp_no_club_id", :using=>:btree})
|
55
|
+
add_index("employee_clubs", ["emp_no", "club_id"], **{:name=>"idx_emp_no_club_id", :using=>:btree})
|
56
56
|
RUBY
|
57
57
|
}
|
58
58
|
end
|
@@ -138,23 +138,23 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
138
138
|
expect(delta.differ?).to be_truthy
|
139
139
|
expect(subject.dump).to match_ruby actual_dsl
|
140
140
|
expect(delta.script).to match_fuzzy <<-RUBY
|
141
|
-
change_table("dept_emp",
|
141
|
+
change_table("dept_emp", bulk: true) do |t|
|
142
142
|
t.remove("emp_no")
|
143
143
|
t.remove("from_date")
|
144
144
|
t.remove("to_date")
|
145
145
|
end
|
146
146
|
|
147
|
-
change_table("dept_manager",
|
147
|
+
change_table("dept_manager", bulk: true) do |t|
|
148
148
|
t.remove("emp_no")
|
149
149
|
t.remove("from_date")
|
150
150
|
t.remove("to_date")
|
151
151
|
end
|
152
152
|
|
153
|
-
change_table("employee_clubs",
|
153
|
+
change_table("employee_clubs", bulk: true) do |t|
|
154
154
|
t.remove("club_id")
|
155
155
|
end
|
156
156
|
|
157
|
-
change_table("employees",
|
157
|
+
change_table("employees", bulk: true) do |t|
|
158
158
|
t.remove("last_name")
|
159
159
|
t.remove("gender")
|
160
160
|
t.remove("hire_date")
|
@@ -135,17 +135,17 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
135
135
|
expect(delta.differ?).to be_truthy
|
136
136
|
expect(subject.dump).to match_ruby actual_dsl
|
137
137
|
expect(delta.script).to match_fuzzy <<-RUBY
|
138
|
-
change_table("dept_emp",
|
138
|
+
change_table("dept_emp", bulk: true) do |t|
|
139
139
|
t.remove("from_date")
|
140
140
|
t.remove("to_date")
|
141
141
|
end
|
142
142
|
|
143
|
-
change_table("dept_manager",
|
143
|
+
change_table("dept_manager", bulk: true) do |t|
|
144
144
|
t.remove("from_date")
|
145
145
|
t.remove("to_date")
|
146
146
|
end
|
147
147
|
|
148
|
-
change_table("employees",
|
148
|
+
change_table("employees", bulk: true) do |t|
|
149
149
|
t.remove("last_name")
|
150
150
|
t.remove("gender")
|
151
151
|
t.remove("hire_date")
|
@@ -141,16 +141,16 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
141
141
|
expect(delta.differ?).to be_truthy
|
142
142
|
expect(subject.dump).to match_ruby actual_dsl
|
143
143
|
expect(delta.script).to match_fuzzy <<-RUBY
|
144
|
-
change_table("clubs",
|
145
|
-
t.remove_index(
|
144
|
+
change_table("clubs", bulk: true) do |t|
|
145
|
+
t.remove_index(name: "idx_name")
|
146
146
|
end
|
147
147
|
|
148
|
-
change_table("employee_clubs",
|
149
|
-
t.remove_index(
|
148
|
+
change_table("employee_clubs", bulk: true) do |t|
|
149
|
+
t.remove_index(name: "idx_emp_no_club_id")
|
150
150
|
end
|
151
151
|
|
152
|
-
change_table("titles",
|
153
|
-
t.remove_index(
|
152
|
+
change_table("titles", bulk: true) do |t|
|
153
|
+
t.remove_index(name: "emp_no")
|
154
154
|
end
|
155
155
|
RUBY
|
156
156
|
delta.migrate
|
@@ -142,15 +142,15 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
142
142
|
expect(delta.differ?).to be_truthy
|
143
143
|
expect(subject.dump).to match_ruby actual_dsl
|
144
144
|
expect(delta.script).to match_fuzzy <<-RUBY
|
145
|
-
change_table("dept_emp",
|
145
|
+
change_table("dept_emp", bulk: true) do |t|
|
146
146
|
t.rename("from_date", "from_date2")
|
147
147
|
end
|
148
148
|
|
149
|
-
change_table("dept_manager",
|
149
|
+
change_table("dept_manager", bulk: true) do |t|
|
150
150
|
t.rename("to_date", "to_date2")
|
151
151
|
end
|
152
152
|
|
153
|
-
change_table("employees",
|
153
|
+
change_table("employees", bulk: true) do |t|
|
154
154
|
t.rename("gender", "gender2")
|
155
155
|
end
|
156
156
|
RUBY
|