ridgepole 0.7.1 → 0.7.2.beta

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +4 -3
  3. data/Appraisals +8 -0
  4. data/README.md +2 -0
  5. data/docker-compose.yml +2 -2
  6. data/gemfiles/activerecord_5.2.gemfile +11 -0
  7. data/lib/ridgepole/ext/schema_dumper.rb +1 -1
  8. data/lib/ridgepole/schema_statements_ext.rb +2 -2
  9. data/lib/ridgepole/version.rb +1 -1
  10. data/ridgepole.gemspec +1 -0
  11. data/spec/erb_helper.rb +3 -1
  12. data/spec/mysql/_migrate/migrate_change_table_option_spec.rb +5 -5
  13. data/spec/mysql/bigint_pk/int_pk_spec.rb +2 -2
  14. data/spec/mysql/collation/collation_spec.rb +15 -15
  15. data/spec/mysql/comment/comment_spec.rb +10 -10
  16. data/spec/mysql/default_lambda/default_lambda_spec.rb +2 -2
  17. data/spec/mysql/diff/diff2_spec.rb +4 -4
  18. data/spec/mysql/diff/diff_spec.rb +4 -4
  19. data/spec/mysql/dump/dump_class_method_spec.rb +3 -3
  20. data/spec/mysql/dump/dump_some_tables_spec.rb +2 -2
  21. data/spec/mysql/dump/dump_spec.rb +3 -3
  22. data/spec/mysql/dump/dump_unknown_column_type_spec.rb +1 -1
  23. data/spec/mysql/dump/dump_without_table_options_spec.rb +2 -2
  24. data/spec/mysql/fk/migrate_change_fk_spec.rb +16 -16
  25. data/spec/mysql/fk/migrate_create_fk_spec.rb +14 -14
  26. data/spec/mysql/fk/migrate_drop_fk_spec.rb +18 -18
  27. data/spec/mysql/migrate/migrate_add_column2_spec.rb +8 -8
  28. data/spec/mysql/migrate/migrate_add_column_order_spec.rb +12 -12
  29. data/spec/mysql/migrate/migrate_add_column_spec.rb +4 -4
  30. data/spec/mysql/migrate/migrate_add_column_with_alter_extra_spec.rb +2 -2
  31. data/spec/mysql/migrate/migrate_add_column_with_script_spec.rb +2 -2
  32. data/spec/mysql/migrate/migrate_change_column2_spec.rb +2 -2
  33. data/spec/mysql/migrate/migrate_change_column3_spec.rb +14 -14
  34. data/spec/mysql/migrate/migrate_change_column5_spec.rb +4 -4
  35. data/spec/mysql/migrate/migrate_change_column6_spec.rb +11 -11
  36. data/spec/mysql/migrate/migrate_change_column7_spec.rb +2 -2
  37. data/spec/mysql/migrate/migrate_change_column_default_spec.rb +20 -20
  38. data/spec/mysql/migrate/migrate_change_column_float_spec.rb +9 -4
  39. data/spec/mysql/migrate/migrate_change_column_spec.rb +7 -7
  40. data/spec/mysql/migrate/migrate_change_index2_spec.rb +2 -2
  41. data/spec/mysql/migrate/migrate_change_index3_spec.rb +4 -4
  42. data/spec/mysql/migrate/migrate_change_index4_spec.rb +6 -6
  43. data/spec/mysql/migrate/migrate_change_index5_spec.rb +2 -2
  44. data/spec/mysql/migrate/migrate_change_index6_spec.rb +2 -2
  45. data/spec/mysql/migrate/migrate_change_index7_spec.rb +7 -7
  46. data/spec/mysql/migrate/migrate_change_index8_spec.rb +7 -7
  47. data/spec/mysql/migrate/migrate_change_index_spec.rb +3 -3
  48. data/spec/mysql/migrate/migrate_change_table_option_spec.rb +4 -4
  49. data/spec/mysql/migrate/migrate_check_relation_column_type_spec.rb +8 -8
  50. data/spec/mysql/migrate/migrate_create_index2_spec.rb +2 -2
  51. data/spec/mysql/migrate/migrate_create_index_spec.rb +4 -4
  52. data/spec/mysql/migrate/migrate_create_table_spec.rb +2 -2
  53. data/spec/mysql/migrate/migrate_create_table_with_index_spec.rb +2 -2
  54. data/spec/mysql/migrate/migrate_create_table_with_script_spec.rb +2 -2
  55. data/spec/mysql/migrate/migrate_drop_column_and_index2_spec.rb +4 -4
  56. data/spec/mysql/migrate/migrate_drop_column_and_index_spec.rb +6 -6
  57. data/spec/mysql/migrate/migrate_drop_column_and_unique_index_spec.rb +4 -4
  58. data/spec/mysql/migrate/migrate_drop_column_spec.rb +4 -4
  59. data/spec/mysql/migrate/migrate_drop_index_spec.rb +4 -4
  60. data/spec/mysql/migrate/migrate_drop_table_spec.rb +2 -2
  61. data/spec/mysql/migrate/migrate_empty_spec.rb +2 -2
  62. data/spec/mysql/migrate/migrate_execute_spec.rb +23 -23
  63. data/spec/mysql/migrate/migrate_log_file_spec.rb +2 -2
  64. data/spec/mysql/migrate/migrate_merge_mode_spec.rb +2 -2
  65. data/spec/mysql/migrate/migrate_noop_spec.rb +27 -27
  66. data/spec/mysql/migrate/migrate_primary_key_spec.rb +2 -2
  67. data/spec/mysql/migrate/migrate_rename_column_spec.rb +4 -4
  68. data/spec/mysql/migrate/migrate_rename_table_spec.rb +4 -4
  69. data/spec/mysql/migrate/migrate_same_default_null_spec.rb +4 -4
  70. data/spec/mysql/migrate/migrate_same_spec.rb +5 -5
  71. data/spec/mysql/migrate/migrate_script_error_spec.rb +1 -1
  72. data/spec/mysql/migrate/migrate_skip_drop_table_spec.rb +2 -2
  73. data/spec/mysql/migrate/migrate_skip_rename_column_spec.rb +2 -2
  74. data/spec/mysql/migrate/migrate_skip_rename_table_spec.rb +2 -2
  75. data/spec/mysql/migrate/migrate_with_ignore_tables_spec.rb +2 -2
  76. data/spec/mysql/migrate/migrate_with_pre_post_query_spec.rb +2 -2
  77. data/spec/mysql/migrate/migrate_with_tables_spec.rb +2 -2
  78. data/spec/mysql/migrate/migrate_with_verbose_log_spec.rb +2 -2
  79. data/spec/mysql/migrate_/migrate_create_index_with_alter_spec.rb +2 -2
  80. data/spec/mysql/migrate_/migrate_drop_index_with_alter_spec.rb +2 -2
  81. data/spec/mysql/text_blob_types/text_blob_types_spec.rb +1 -1
  82. data/spec/mysql/~default_name_fk/migrate_change_fk_spec.rb +4 -4
  83. data/spec/mysql/~default_name_fk/migrate_create_fk_spec.rb +9 -9
  84. data/spec/mysql/~default_name_fk/migrate_drop_fk_spec.rb +6 -6
  85. data/spec/mysql/~dump_auto_increment/migrate_create_table_with_index_spec.rb +2 -2
  86. data/spec/mysql57/json/add_json_column_spec.rb +2 -2
  87. data/spec/mysql57/json/change_json_column_spec.rb +6 -6
  88. data/spec/mysql57/json/drop_json_column_spec.rb +2 -2
  89. data/spec/mysql57/virtual/add_virtual_column_spec.rb +2 -2
  90. data/spec/mysql57/virtual/change_virtual_column_spec.rb +2 -2
  91. data/spec/mysql57/virtual/drop_virtual_column_spec.rb +2 -2
  92. data/spec/postgresql/dump/dump_spec.rb +3 -3
  93. data/spec/postgresql/fk/migrate_change_fk_spec.rb +2 -2
  94. data/spec/postgresql/fk/migrate_create_fk_spec.rb +8 -8
  95. data/spec/postgresql/fk/migrate_drop_fk_spec.rb +4 -4
  96. data/spec/postgresql/migrate/migrate_add_column_spec.rb +6 -6
  97. data/spec/postgresql/migrate/migrate_bigint_spec.rb +2 -2
  98. data/spec/postgresql/migrate/migrate_change_column_default_spec.rb +2 -2
  99. data/spec/postgresql/migrate/migrate_change_column_spec.rb +4 -4
  100. data/spec/postgresql/migrate/migrate_change_index_spec.rb +3 -3
  101. data/spec/postgresql/migrate/migrate_check_relation_column_type_spec.rb +4 -4
  102. data/spec/postgresql/migrate/migrate_create_table_spec.rb +2 -2
  103. data/spec/postgresql/migrate/migrate_create_table_with_default_proc_spec.rb +8 -8
  104. data/spec/postgresql/migrate/migrate_drop_column_spec.rb +4 -4
  105. data/spec/postgresql/migrate/migrate_drop_column_with_index_spec.rb +6 -6
  106. data/spec/postgresql/migrate/migrate_drop_index_spec.rb +4 -4
  107. data/spec/postgresql/migrate/migrate_drop_table_spec.rb +2 -2
  108. data/spec/postgresql/migrate/migrate_ext_cols_spec.rb +2 -2
  109. data/spec/postgresql/migrate/migrate_references_spec.rb +6 -6
  110. data/spec/postgresql/migrate/migrate_rename_column_spec.rb +4 -4
  111. data/spec/postgresql/migrate/migrate_rename_table_spec.rb +4 -4
  112. data/spec/postgresql/migrate/migrate_same_spec.rb +5 -5
  113. data/spec/postgresql/~default_name_fk/migrate_change_fk_spec.rb +1 -1
  114. data/spec/postgresql/~default_name_fk/migrate_create_fk_spec.rb +4 -4
  115. data/spec/postgresql/~default_name_fk/migrate_drop_fk_spec.rb +2 -2
  116. data/spec/spec_condition.rb +7 -0
  117. data/spec/spec_helper.rb +1 -0
  118. metadata +19 -4
@@ -133,15 +133,15 @@ describe 'Ridgepole::Client#diff -> migrate' do
133
133
  it {
134
134
  delta = subject.diff(expected_dsl)
135
135
  expect(delta.differ?).to be_truthy
136
- expect(subject.dump).to match_fuzzy actual_dsl
136
+ expect(subject.dump).to match_ruby actual_dsl
137
137
  delta.migrate
138
- expect(subject.dump).to match_fuzzy expected_dsl
138
+ expect(subject.dump).to match_ruby expected_dsl
139
139
  }
140
140
 
141
141
  it {
142
142
  delta = client(:bulk_change => true).diff(expected_dsl)
143
143
  expect(delta.differ?).to be_truthy
144
- expect(subject.dump).to match_fuzzy actual_dsl
144
+ expect(subject.dump).to match_ruby actual_dsl
145
145
  expect(delta.script).to match_fuzzy erbh(<<-EOS)
146
146
  change_table("employee_clubs", {:bulk=>true}) do |t|
147
147
  t.column("any_col", :string, {:null=>false, :after=>"club_id", :limit=>255})
@@ -153,7 +153,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
153
153
  end
154
154
  EOS
155
155
  delta.migrate
156
- expect(subject.dump).to match_fuzzy expected_dsl
156
+ expect(subject.dump).to match_ruby expected_dsl
157
157
  }
158
158
  end
159
159
  end
@@ -133,9 +133,9 @@ describe 'Ridgepole::Client#diff -> migrate' do
133
133
  it {
134
134
  delta = subject.diff(expected_dsl)
135
135
  expect(delta.differ?).to be_truthy
136
- expect(subject.dump).to match_fuzzy actual_dsl
136
+ expect(subject.dump).to match_ruby actual_dsl
137
137
  delta.migrate(alter_extra: 'FORCE')
138
- expect(subject.dump).to match_fuzzy expected_dsl
138
+ expect(subject.dump).to match_ruby expected_dsl
139
139
  }
140
140
  end
141
141
  end
@@ -133,7 +133,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
133
133
  it {
134
134
  delta = subject.diff(expected_dsl)
135
135
  expect(delta.differ?).to be_truthy
136
- expect(subject.dump).to match_fuzzy actual_dsl
136
+ expect(subject.dump).to match_ruby actual_dsl
137
137
 
138
138
  script = <<-EOS
139
139
  echo "$1" | #{MYSQL_CLI} #{TEST_SCHEMA}
@@ -144,7 +144,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
144
144
  delta.migrate(external_script: path)
145
145
  end
146
146
 
147
- expect(subject.dump).to match_fuzzy expected_dsl
147
+ expect(subject.dump).to match_ruby expected_dsl
148
148
  }
149
149
  end
150
150
  end
@@ -81,9 +81,9 @@ describe 'Ridgepole::Client#diff -> migrate' do
81
81
  it {
82
82
  delta = subject.diff(dsl)
83
83
  expect(delta.differ?).to be_truthy
84
- expect(subject.dump).to match_fuzzy actual_dsl
84
+ expect(subject.dump).to match_ruby actual_dsl
85
85
  delta.migrate
86
- expect(subject.dump).to match_fuzzy expected_dsl
86
+ expect(subject.dump).to match_ruby expected_dsl
87
87
  }
88
88
  end
89
89
  end
@@ -82,9 +82,9 @@ describe 'Ridgepole::Client#diff -> migrate' do
82
82
  it {
83
83
  delta = subject.diff(dsl)
84
84
  expect(delta.differ?).to be_truthy
85
- expect(subject.dump).to match_fuzzy actual_dsl
85
+ expect(subject.dump).to match_ruby actual_dsl
86
86
  delta.migrate
87
- expect(subject.dump).to match_fuzzy expected_dsl
87
+ expect(subject.dump).to match_ruby expected_dsl
88
88
  }
89
89
  end
90
90
 
@@ -97,8 +97,8 @@ describe 'Ridgepole::Client#diff -> migrate' do
97
97
  t.string "last_name", limit: 16, null: false
98
98
  t.string "gender", limit: 1, null: false
99
99
  t.date "hire_date", null: false
100
- t.<%= cond(5.1, 'bigint', 'integer') %> "products_id"
101
- t.<%= cond(5.1, 'bigint', 'integer') %> "user_id"
100
+ t.<%= cond('>= 5.1','bigint', 'integer') %> "products_id"
101
+ t.<%= cond('>= 5.1','bigint', 'integer') %> "user_id"
102
102
  t.index "products_id"
103
103
  t.index "user_id"
104
104
  end
@@ -136,9 +136,9 @@ describe 'Ridgepole::Client#diff -> migrate' do
136
136
  t.string "last_name", limit: 16, null: false
137
137
  t.string "gender", limit: 1, null: false
138
138
  t.date "hire_date", null: false
139
- t.<%= cond(5.1, 'bigint', 'integer') %> "products_id"
139
+ t.<%= cond('>= 5.1','bigint', 'integer') %> "products_id"
140
140
  t.string "products_type"
141
- t.<%= cond(5.1, 'bigint', 'integer') %> "user_id"
141
+ t.<%= cond('>= 5.1','bigint', 'integer') %> "user_id"
142
142
  t.string "user_type"
143
143
  t.index ["products_type", "products_id"]
144
144
  t.index ["user_type", "user_id"]
@@ -202,8 +202,8 @@ describe 'Ridgepole::Client#diff -> migrate' do
202
202
  t.string "last_name", limit: 16, null: false
203
203
  t.string "gender", limit: 1, null: false
204
204
  t.date "hire_date", null: false
205
- t.<%= cond(5.1, 'bigint', 'integer') %> "products_id"
206
- t.<%= cond(5.1, 'bigint', 'integer') %> "user_id"
205
+ t.<%= cond('>= 5.1','bigint', 'integer') %> "products_id"
206
+ t.<%= cond('>= 5.1','bigint', 'integer') %> "user_id"
207
207
  t.index ["products_id"], name: "index_employees_on_products_id", <%= i cond(5.0, using: :btree) %>
208
208
  t.index ["user_id"], name: "index_employees_on_user_id", <%= i cond(5.0, using: :btree) %>
209
209
  end
@@ -216,9 +216,9 @@ describe 'Ridgepole::Client#diff -> migrate' do
216
216
  it {
217
217
  delta = subject.diff(dsl)
218
218
  expect(delta.differ?).to be_truthy
219
- expect(subject.dump).to match_fuzzy actual_dsl
219
+ expect(subject.dump).to match_ruby actual_dsl
220
220
  delta.migrate
221
- expect(subject.dump).to match_fuzzy expected_dsl
221
+ expect(subject.dump).to match_ruby expected_dsl
222
222
  }
223
223
  end
224
224
 
@@ -256,9 +256,9 @@ describe 'Ridgepole::Client#diff -> migrate' do
256
256
  t.string "last_name", limit: 16, null: false
257
257
  t.string "gender", limit: 1, null: false
258
258
  t.date "hire_date", null: false
259
- t.<%= cond(5.1, 'bigint', 'integer') %> "products_id"
259
+ t.<%= cond('>= 5.1','bigint', 'integer') %> "products_id"
260
260
  t.string "products_type"
261
- t.<%= cond(5.1, 'bigint', 'integer') %> "user_id"
261
+ t.<%= cond('>= 5.1','bigint', 'integer') %> "user_id"
262
262
  t.string "user_type"
263
263
  t.index ["products_type", "products_id"], name: "index_employees_on_products_type_and_products_id", <%= i cond(5.0, using: :btree) %>
264
264
  t.index ["user_type", "user_id"], name: "index_employees_on_user_type_and_user_id", <%= i cond(5.0, using: :btree) %>
@@ -272,9 +272,9 @@ describe 'Ridgepole::Client#diff -> migrate' do
272
272
  it {
273
273
  delta = subject.diff(dsl)
274
274
  expect(delta.differ?).to be_truthy
275
- expect(subject.dump).to match_fuzzy actual_dsl
275
+ expect(subject.dump).to match_ruby actual_dsl
276
276
  delta.migrate
277
- expect(subject.dump).to match_fuzzy expected_dsl
277
+ expect(subject.dump).to match_ruby expected_dsl
278
278
  }
279
279
  end
280
280
  end
@@ -36,9 +36,9 @@ describe 'Ridgepole::Client#diff -> migrate' do
36
36
  it {
37
37
  delta = subject.diff(expected_dsl)
38
38
  expect(delta.differ?).to be_truthy
39
- expect(subject.dump).to match_fuzzy actual_dsl
39
+ expect(subject.dump).to match_ruby actual_dsl
40
40
  delta.migrate
41
- expect(subject.dump).to match_fuzzy expected_dsl
41
+ expect(subject.dump).to match_ruby expected_dsl
42
42
  }
43
43
  end
44
44
 
@@ -79,9 +79,9 @@ describe 'Ridgepole::Client#diff -> migrate' do
79
79
  it {
80
80
  delta = subject.diff(expected_dsl)
81
81
  expect(delta.differ?).to be_truthy
82
- expect(subject.dump).to match_fuzzy actual_dsl
82
+ expect(subject.dump).to match_ruby actual_dsl
83
83
  delta.migrate
84
- expect(subject.dump).to match_fuzzy expected_dsl
84
+ expect(subject.dump).to match_ruby expected_dsl
85
85
  }
86
86
  end
87
87
 
@@ -37,13 +37,13 @@ describe 'Ridgepole::Client#diff -> migrate' do
37
37
  it {
38
38
  delta = subject.diff(expected_dsl)
39
39
  expect(delta.differ?).to be_truthy
40
- expect(subject.dump).to match_fuzzy actual_dsl
40
+ expect(subject.dump).to match_ruby actual_dsl
41
41
  delta.migrate
42
- expect(subject.dump).to match_fuzzy expected_dsl
42
+ expect(subject.dump).to match_ruby expected_dsl
43
43
 
44
44
  expect(show_create_table_mysql('employees')).to match_fuzzy erbh(<<-EOS)
45
45
  CREATE TABLE `employees` (
46
- `id` <%= cond(5.1, 'bigint(20)', 'int(11)') %> NOT NULL AUTO_INCREMENT,
46
+ `id` <%= cond('>= 5.1','bigint(20)', 'int(11)') %> NOT NULL AUTO_INCREMENT,
47
47
  `ext_column` varchar(255) NOT NULL,
48
48
  `birth_date` date NOT NULL,
49
49
  `first_name` varchar(14) NOT NULL,
@@ -97,13 +97,13 @@ describe 'Ridgepole::Client#diff -> migrate' do
97
97
  it {
98
98
  delta = subject.diff(expected_dsl)
99
99
  expect(delta.differ?).to be_truthy
100
- expect(subject.dump).to match_fuzzy actual_dsl
100
+ expect(subject.dump).to match_ruby actual_dsl
101
101
  delta.migrate
102
- expect(subject.dump).to match_fuzzy expected_dsl
102
+ expect(subject.dump).to match_ruby expected_dsl
103
103
 
104
104
  expect(show_create_table_mysql('employees')).to match_fuzzy erbh(<<-EOS)
105
105
  CREATE TABLE `employees` (
106
- `emp_id` <%= cond(5.1, 'bigint(20)', 'int(11)') %> NOT NULL AUTO_INCREMENT,
106
+ `emp_id` <%= cond('>= 5.1','bigint(20)', 'int(11)') %> NOT NULL AUTO_INCREMENT,
107
107
  `ext_column` varchar(255) NOT NULL,
108
108
  `birth_date` date NOT NULL,
109
109
  `first_name` varchar(14) NOT NULL,
@@ -157,9 +157,9 @@ describe 'Ridgepole::Client#diff -> migrate' do
157
157
  it {
158
158
  delta = subject.diff(expected_dsl)
159
159
  expect(delta.differ?).to be_truthy
160
- expect(subject.dump).to match_fuzzy actual_dsl
160
+ expect(subject.dump).to match_ruby actual_dsl
161
161
  delta.migrate
162
- expect(subject.dump).to match_fuzzy expected_dsl
162
+ expect(subject.dump).to match_ruby expected_dsl
163
163
 
164
164
  expect(show_create_table_mysql('employees')).to match_fuzzy <<-EOS
165
165
  CREATE TABLE `employees` (
@@ -215,13 +215,13 @@ describe 'Ridgepole::Client#diff -> migrate' do
215
215
  it {
216
216
  delta = subject.diff(expected_dsl)
217
217
  expect(delta.differ?).to be_truthy
218
- expect(subject.dump).to match_fuzzy actual_dsl
218
+ expect(subject.dump).to match_ruby actual_dsl
219
219
  delta.migrate
220
- expect(subject.dump).to match_fuzzy expected_dsl.sub(/, *primary_key: *"emp_id"/, '')
220
+ expect(subject.dump).to match_ruby expected_dsl.sub(/, *primary_key: *"emp_id"/, '')
221
221
 
222
222
  expect(show_create_table_mysql('employees')).to match_fuzzy erbh(<<-EOS)
223
223
  CREATE TABLE `employees` (
224
- `id` <%= cond(5.1, 'bigint(20)', 'int(11)') %> NOT NULL AUTO_INCREMENT,
224
+ `id` <%= cond('>= 5.1','bigint(20)', 'int(11)') %> NOT NULL AUTO_INCREMENT,
225
225
  `ext_column` varchar(255) NOT NULL,
226
226
  `birth_date` date NOT NULL,
227
227
  `first_name` varchar(14) NOT NULL,
@@ -4,7 +4,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
4
4
  erbh(<<-EOS)
5
5
  create_table "salaries", id: false, force: :cascade do |t|
6
6
  t.integer "emp_no", limit: 8, null: false
7
- t.float "salary", limit: 24, null: false
7
+ t.float "salary", <%= i cond('< 5.2.0.beta2', limit: 24) %>, null: false
8
8
  t.date "from_date", null: false
9
9
  t.date "to_date", null: false
10
10
  end
@@ -15,7 +15,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
15
15
  subject { client }
16
16
 
17
17
  it {
18
- expect(subject.dump).to match_fuzzy dsl.sub(/t.integer "emp_no", limit: 8/, 't.bigint "emp_no"')
18
+ expect(subject.dump).to match_ruby dsl.sub(/t.integer "emp_no", limit: 8/, 't.bigint "emp_no"')
19
19
  delta = subject.diff(dsl)
20
20
  expect(delta.differ?).to be_falsey
21
21
  }
@@ -4,7 +4,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
4
4
  erbh(<<-EOS)
5
5
  create_table "salaries", id: false, force: :cascade do |t|
6
6
  t.integer "emp_no", default: 0, null: false
7
- t.float "salary", limit: 24, null: false
7
+ t.float "salary", <%= i cond('< 5.2.0.beta2', limit: 24) %>, null: false
8
8
  t.date "from_date", null: false
9
9
  t.date "to_date", null: false
10
10
  end
@@ -12,10 +12,10 @@ describe 'Ridgepole::Client#diff -> migrate' do
12
12
  }
13
13
 
14
14
  let(:expected_dsl) {
15
- <<-EOS
15
+ erbh(<<-EOS)
16
16
  create_table "salaries", id: false, force: :cascade do |t|
17
17
  t.integer "emp_no", limit: 4, null: true
18
- t.float "salary", limit: 24, null: false
18
+ t.float "salary", <%= i cond('< 5.2.0.beta2', limit: 24) %>, null: false
19
19
  t.date "from_date", null: false
20
20
  t.date "to_date", null: false
21
21
  end
@@ -26,7 +26,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
26
26
  erbh(<<-EOS)
27
27
  create_table "salaries", id: false, force: :cascade do |t|
28
28
  t.integer "emp_no"
29
- t.float "salary", limit: 24, null: false
29
+ t.float "salary", <%= i cond('< 5.2.0.beta2', limit: 24) %>, null: false
30
30
  t.date "from_date", null: false
31
31
  t.date "to_date", null: false
32
32
  end
@@ -39,7 +39,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
39
39
  it {
40
40
  delta = subject.diff(expected_dsl)
41
41
  expect(delta.differ?).to be_truthy
42
- expect(subject.dump).to match_fuzzy actual_dsl
42
+ expect(subject.dump).to match_ruby actual_dsl
43
43
  delta.migrate
44
44
  expect(subject.dump).to match_fuzzy result_dsl
45
45
  }
@@ -50,7 +50,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
50
50
  erbh(<<-EOS)
51
51
  create_table "salaries", id: false, force: :cascade do |t|
52
52
  t.integer "emp_no", default: 0, null: false
53
- t.float "salary", limit: 24, null: false
53
+ t.float "salary", <%= i cond('< 5.2.0.beta2', limit: 24) %>, null: false
54
54
  t.date "from_date", null: false
55
55
  t.date "to_date", null: false
56
56
  end
@@ -61,7 +61,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
61
61
  erbh(<<-EOS)
62
62
  create_table "salaries", id: false, force: :cascade do |t|
63
63
  t.integer "emp_no", null: false
64
- t.float "salary", limit: 24, null: false
64
+ t.float "salary", <%= i cond('< 5.2.0.beta2', limit: 24) %>, null: false
65
65
  t.date "from_date", null: false
66
66
  t.date "to_date", null: false
67
67
  end
@@ -74,9 +74,9 @@ describe 'Ridgepole::Client#diff -> migrate' do
74
74
  it {
75
75
  delta = subject.diff(expected_dsl)
76
76
  expect(delta.differ?).to be_truthy
77
- expect(subject.dump).to match_fuzzy actual_dsl
77
+ expect(subject.dump).to match_ruby actual_dsl
78
78
  delta.migrate
79
- expect(subject.dump).to match_fuzzy expected_dsl
79
+ expect(subject.dump).to match_ruby expected_dsl
80
80
  }
81
81
  end
82
82
 
@@ -85,7 +85,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
85
85
  erbh(<<-EOS)
86
86
  create_table "salaries", id: false, force: :cascade do |t|
87
87
  t.integer "emp_no", default: 0, null: false
88
- t.float "salary", limit: 24, null: false
88
+ t.float "salary", <%= i cond('< 5.2.0.beta2', limit: 24) %>, null: false
89
89
  t.date "from_date", null: false
90
90
  t.date "to_date", null: false
91
91
  end
@@ -106,7 +106,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
106
106
  erbh(<<-EOS)
107
107
  create_table "salaries", id: false, force: :cascade do |t|
108
108
  t.integer "emp_no", default: 0, null: false
109
- t.float "salary", limit: 24, null: false
109
+ t.float "salary", <%= i cond('< 5.2.0.beta2', limit: 24) %>, null: false
110
110
  t.date "from_date", null: false
111
111
  t.date "to_date", null: false
112
112
  end
@@ -114,10 +114,10 @@ describe 'Ridgepole::Client#diff -> migrate' do
114
114
  }
115
115
 
116
116
  let(:expected_dsl) {
117
- <<-EOS
117
+ erbh(<<-EOS)
118
118
  create_table "salaries", id: false, force: :cascade do |t|
119
119
  t.integer "emp_no", limit: 4, default: 0, null: true
120
- t.float "salary", limit: 24, null: false
120
+ t.float "salary", <%= i cond('< 5.2.0.beta2', limit: 24) %>, null: false
121
121
  t.date "from_date", null: false
122
122
  t.date "to_date", null: false
123
123
  end
@@ -128,7 +128,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
128
128
  erbh(<<-EOS)
129
129
  create_table "salaries", id: false, force: :cascade do |t|
130
130
  t.integer "emp_no", default: 0
131
- t.float "salary", limit: 24, null: false
131
+ t.float "salary", <%= i cond('< 5.2.0.beta2', limit: 24) %>, null: false
132
132
  t.date "from_date", null: false
133
133
  t.date "to_date", null: false
134
134
  end
@@ -141,7 +141,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
141
141
  it {
142
142
  delta = subject.diff(expected_dsl)
143
143
  expect(delta.differ?).to be_truthy
144
- expect(subject.dump).to match_fuzzy actual_dsl
144
+ expect(subject.dump).to match_ruby actual_dsl
145
145
  delta.migrate
146
146
  expect(subject.dump).to match_fuzzy result_dsl
147
147
  }
@@ -152,7 +152,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
152
152
  erbh(<<-EOS)
153
153
  create_table "salaries", id: false, force: :cascade do |t|
154
154
  t.integer "emp_no", default: 0
155
- t.float "salary", limit: 24, null: false
155
+ t.float "salary", <%= i cond('< 5.2.0.beta2', limit: 24) %>, null: false
156
156
  t.date "from_date", null: false
157
157
  t.date "to_date", null: false
158
158
  end
@@ -163,7 +163,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
163
163
  erbh(<<-EOS)
164
164
  create_table "salaries", id: false, force: :cascade do |t|
165
165
  t.integer "emp_no", null: false
166
- t.float "salary", limit: 24, null: false
166
+ t.float "salary", <%= i cond('< 5.2.0.beta2', limit: 24) %>, null: false
167
167
  t.date "from_date", null: false
168
168
  t.date "to_date", null: false
169
169
  end
@@ -174,7 +174,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
174
174
  erbh(<<-EOS)
175
175
  create_table "salaries", id: false, force: :cascade do |t|
176
176
  t.integer "emp_no", <%= i cond(5.0, default: 0) + {null: false} %>
177
- t.float "salary", limit: 24, null: false
177
+ t.float "salary", <%= i cond('< 5.2.0.beta2', limit: 24) %>, null: false
178
178
  t.date "from_date", null: false
179
179
  t.date "to_date", null: false
180
180
  end
@@ -193,7 +193,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
193
193
 
194
194
  delta = subject.diff(expected_dsl)
195
195
  expect(delta.differ?).to be_truthy
196
- expect(subject.dump).to match_fuzzy actual_dsl
196
+ expect(subject.dump).to match_ruby actual_dsl
197
197
  delta.migrate
198
198
  expect(subject.dump).to match_fuzzy result_dsl
199
199
 
@@ -202,7 +202,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
202
202
  expect(delta.differ?).to be_truthy
203
203
  expect(subject.dump).to match_fuzzy result_dsl
204
204
  delta.migrate
205
- expect(subject.dump).to match_fuzzy expected_dsl
205
+ expect(subject.dump).to match_ruby expected_dsl
206
206
  end
207
207
  }
208
208
  end
@@ -27,10 +27,15 @@ describe 'Ridgepole::Client#diff -> migrate' do
27
27
 
28
28
  it {
29
29
  delta = subject.diff(expected_dsl)
30
- expect(delta.differ?).to be_truthy
31
- expect(subject.dump).to match_fuzzy actual_dsl
32
- delta.migrate
33
- expect(subject.dump).to match_fuzzy actual_dsl
30
+
31
+ if condition('< 5.2.0.beta2')
32
+ expect(delta.differ?).to be_truthy
33
+ expect(subject.dump).to match_ruby actual_dsl
34
+ delta.migrate
35
+ expect(subject.dump).to match_ruby actual_dsl
36
+ else
37
+ expect(delta.differ?).to be_falsy
38
+ end
34
39
  }
35
40
  end
36
41
 
@@ -130,27 +130,27 @@ describe 'Ridgepole::Client#diff -> migrate' do
130
130
  it {
131
131
  delta = subject.diff(expected_dsl)
132
132
  expect(delta.differ?).to be_truthy
133
- expect(subject.dump).to match_fuzzy actual_dsl
133
+ expect(subject.dump).to match_ruby actual_dsl
134
134
  delta.migrate
135
- expect(subject.dump).to match_fuzzy expected_dsl
135
+ expect(subject.dump).to match_ruby expected_dsl
136
136
  }
137
137
 
138
138
  it {
139
139
  delta = client(:bulk_change => true).diff(expected_dsl)
140
140
  expect(delta.differ?).to be_truthy
141
- expect(subject.dump).to match_fuzzy actual_dsl
141
+ expect(subject.dump).to match_ruby actual_dsl
142
142
  expect(delta.script).to match_fuzzy erbh(<<-EOS)
143
143
  change_table("employee_clubs", {:bulk => true}) do |t|
144
- t.change("club_id", :integer, <%= {:null=>true, :default=>nil, :unsigned=>false} + cond(5.1, comment: nil) %>)
144
+ t.change("club_id", :integer, <%= {:null=>true, :default=>nil, :unsigned=>false} + cond('>= 5.1',comment: nil) %>)
145
145
  end
146
146
 
147
147
  change_table("employees", {:bulk => true}) do |t|
148
- t.change("last_name", :string, <%= {:limit=>20, :default=>"XXX", :unsigned=>false} + cond(5.1, comment: nil) %>)
149
- t.change("gender", :string, <%= {:limit=>2, :null=>false, :default=>nil, :unsigned=>false} + cond(5.1, comment: nil) %>)
148
+ t.change("last_name", :string, <%= {:limit=>20, :default=>"XXX", :unsigned=>false} + cond('>= 5.1',comment: nil) %>)
149
+ t.change("gender", :string, <%= {:limit=>2, :null=>false, :default=>nil, :unsigned=>false} + cond('>= 5.1',comment: nil) %>)
150
150
  end
151
151
  EOS
152
152
  delta.migrate
153
- expect(subject.dump).to match_fuzzy expected_dsl
153
+ expect(subject.dump).to match_ruby expected_dsl
154
154
  }
155
155
  end
156
156
  end