ridgepole 0.8.9 → 0.9.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (143) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/test.yml +83 -0
  3. data/.rubocop.yml +9 -34
  4. data/.simplecov +6 -0
  5. data/Appraisals +4 -5
  6. data/README.md +25 -40
  7. data/bin/ridgepole +13 -3
  8. data/gemfiles/{activerecord_5.0.gemfile → activerecord_6.1.gemfile} +1 -2
  9. data/lib/ridgepole/client.rb +8 -3
  10. data/lib/ridgepole/default_limit.rb +1 -1
  11. data/lib/ridgepole/delta.rb +16 -1
  12. data/lib/ridgepole/diff.rb +50 -31
  13. data/lib/ridgepole/dsl_parser.rb +3 -5
  14. data/lib/ridgepole/dsl_parser/context.rb +1 -1
  15. data/lib/ridgepole/dsl_parser/table_definition.rb +52 -42
  16. data/lib/ridgepole/execute_expander.rb +10 -1
  17. data/lib/ridgepole/ext/abstract_adapter/disable_table_options.rb +9 -1
  18. data/lib/ridgepole/external_sql_executer.rb +12 -1
  19. data/lib/ridgepole/version.rb +1 -1
  20. data/ridgepole.gemspec +7 -4
  21. data/spec/erb_helper.rb +5 -5
  22. data/spec/mysql/_migrate/migrate_change_table_option_spec.rb +2 -2
  23. data/spec/mysql/bigint_pk/int_pk_spec.rb +1 -1
  24. data/spec/mysql/cli/ridgepole_spec.rb +35 -1
  25. data/spec/mysql/collation/collation_spec.rb +15 -15
  26. data/spec/mysql/comment/comment_spec.rb +9 -9
  27. data/spec/mysql/diff/diff2_spec.rb +5 -5
  28. data/spec/mysql/diff/diff_spec.rb +3 -3
  29. data/spec/mysql/dump/dump_class_method_spec.rb +13 -13
  30. data/spec/mysql/dump/dump_some_tables_spec.rb +4 -4
  31. data/spec/mysql/dump/dump_spec.rb +13 -13
  32. data/spec/mysql/dump/dump_unknown_column_type_spec.rb +2 -2
  33. data/spec/mysql/dump/dump_without_table_options_spec.rb +2 -2
  34. data/spec/mysql/fk/migrate_change_fk2_spec.rb +2 -2
  35. data/spec/mysql/fk/migrate_change_fk_spec.rb +20 -20
  36. data/spec/mysql/fk/migrate_create_fk_spec.rb +73 -24
  37. data/spec/mysql/fk/migrate_drop_fk_spec.rb +26 -26
  38. data/spec/mysql/fk/migrate_fk_with_column_spec.rb +16 -16
  39. data/spec/mysql/fk/migrate_ignore_fk_spec.rb +6 -6
  40. data/spec/mysql/migrate/migrate_add_column_order_spec.rb +2 -2
  41. data/spec/mysql/migrate/migrate_add_column_spec.rb +18 -18
  42. data/spec/mysql/migrate/migrate_add_column_with_alter_extra_spec.rb +106 -18
  43. data/spec/mysql/migrate/migrate_add_column_with_script_spec.rb +18 -18
  44. data/spec/mysql/migrate/migrate_change_column2_spec.rb +5 -5
  45. data/spec/mysql/migrate/migrate_change_column3_spec.rb +116 -25
  46. data/spec/mysql/migrate/migrate_change_column5_spec.rb +3 -3
  47. data/spec/mysql/migrate/migrate_change_column6_spec.rb +7 -7
  48. data/spec/mysql/migrate/migrate_change_column8_spec.rb +38 -5
  49. data/spec/mysql/migrate/migrate_change_column_default_spec.rb +2 -14
  50. data/spec/mysql/migrate/migrate_change_column_spec.rb +21 -21
  51. data/spec/mysql/migrate/migrate_change_index2_spec.rb +5 -5
  52. data/spec/mysql/migrate/migrate_change_index3_spec.rb +7 -7
  53. data/spec/mysql/migrate/migrate_change_index4_spec.rb +6 -6
  54. data/spec/mysql/migrate/migrate_change_index5_spec.rb +4 -4
  55. data/spec/mysql/migrate/migrate_change_index6_spec.rb +27 -27
  56. data/spec/mysql/migrate/migrate_change_index7_spec.rb +4 -4
  57. data/spec/mysql/migrate/migrate_change_index8_spec.rb +4 -4
  58. data/spec/mysql/migrate/migrate_change_index_spec.rb +34 -28
  59. data/spec/mysql/migrate/migrate_check_relation_column_type_spec.rb +5 -5
  60. data/spec/mysql/migrate/migrate_create_index2_spec.rb +24 -24
  61. data/spec/mysql/migrate/migrate_create_index_spec.rb +18 -18
  62. data/spec/mysql/migrate/migrate_create_table_spec.rb +16 -16
  63. data/spec/mysql/migrate/migrate_create_table_with_ignore_spec.rb +4 -4
  64. data/spec/mysql/migrate/migrate_create_table_with_index_spec.rb +4 -4
  65. data/spec/mysql/migrate/migrate_create_table_with_script_spec.rb +16 -16
  66. data/spec/mysql/migrate/migrate_drop_column_and_index2_spec.rb +18 -18
  67. data/spec/mysql/migrate/migrate_drop_column_and_index_spec.rb +16 -16
  68. data/spec/mysql/migrate/migrate_drop_column_and_unique_index_spec.rb +1 -1
  69. data/spec/mysql/migrate/migrate_drop_column_spec.rb +18 -18
  70. data/spec/mysql/migrate/migrate_drop_index_spec.rb +15 -15
  71. data/spec/mysql/migrate/migrate_drop_table_spec.rb +16 -16
  72. data/spec/mysql/migrate/migrate_empty_spec.rb +9 -9
  73. data/spec/mysql/migrate/migrate_execute_spec.rb +32 -32
  74. data/spec/mysql/migrate/migrate_ignore_column_spec.rb +4 -4
  75. data/spec/mysql/migrate/migrate_ignore_index_spec.rb +5 -5
  76. data/spec/mysql/migrate/migrate_log_file_spec.rb +16 -16
  77. data/spec/mysql/migrate/migrate_merge_mode_spec.rb +18 -18
  78. data/spec/mysql/migrate/migrate_noop_spec.rb +12 -12
  79. data/spec/mysql/migrate/migrate_primary_key_spec.rb +31 -6
  80. data/spec/mysql/migrate/migrate_rename_column_spec.rb +18 -18
  81. data/spec/mysql/migrate/migrate_rename_table_spec.rb +22 -22
  82. data/spec/mysql/migrate/migrate_same_spec.rb +13 -13
  83. data/spec/mysql/migrate/migrate_skip_column_comment_change_spec.rb +2 -2
  84. data/spec/mysql/migrate/migrate_skip_drop_table_spec.rb +18 -18
  85. data/spec/mysql/migrate/migrate_skip_rename_column_spec.rb +18 -18
  86. data/spec/mysql/migrate/migrate_skip_rename_table_spec.rb +18 -18
  87. data/spec/mysql/migrate/migrate_with_pre_post_query_spec.rb +18 -18
  88. data/spec/mysql/text_blob_types/text_blob_types_spec.rb +2 -2
  89. data/spec/mysql/~default_name_fk/migrate_change_fk_spec.rb +6 -6
  90. data/spec/mysql/~default_name_fk/migrate_create_fk_spec.rb +9 -9
  91. data/spec/mysql/~default_name_fk/migrate_drop_fk_spec.rb +8 -8
  92. data/spec/mysql/~dump_auto_increment/migrate_create_table_with_index_spec.rb +5 -5
  93. data/spec/mysql57/json/add_json_column_spec.rb +2 -2
  94. data/spec/mysql57/json/change_json_column_spec.rb +6 -6
  95. data/spec/mysql57/json/drop_json_column_spec.rb +2 -2
  96. data/spec/mysql57/virtual/add_virtual_column_spec.rb +1 -1
  97. data/spec/mysql57/virtual/change_virtual_column_spec.rb +1 -1
  98. data/spec/mysql57/virtual/drop_virtual_column_spec.rb +1 -1
  99. data/spec/postgresql/dump/dump_spec.rb +13 -13
  100. data/spec/postgresql/fk/migrate_change_fk_spec.rb +6 -6
  101. data/spec/postgresql/fk/migrate_create_fk_spec.rb +5 -5
  102. data/spec/postgresql/fk/migrate_drop_fk_spec.rb +8 -8
  103. data/spec/postgresql/migrate/migrate_add_column_spec.rb +27 -20
  104. data/spec/postgresql/migrate/migrate_add_expression_index_spec.rb +1 -1
  105. data/spec/postgresql/migrate/migrate_change_column_spec.rb +20 -16
  106. data/spec/postgresql/migrate/migrate_change_index_spec.rb +18 -18
  107. data/spec/postgresql/migrate/migrate_check_relation_column_type_spec.rb +1 -1
  108. data/spec/postgresql/migrate/migrate_create_table_spec.rb +14 -14
  109. data/spec/postgresql/migrate/migrate_drop_column_spec.rb +29 -22
  110. data/spec/postgresql/migrate/migrate_drop_column_with_index_spec.rb +17 -17
  111. data/spec/postgresql/migrate/migrate_drop_expression_index_spec.rb +3 -3
  112. data/spec/postgresql/migrate/migrate_drop_index_spec.rb +15 -15
  113. data/spec/postgresql/migrate/migrate_drop_table_spec.rb +16 -16
  114. data/spec/postgresql/migrate/migrate_primary_key2_spec.rb +1 -1
  115. data/spec/postgresql/migrate/migrate_primary_key_spec.rb +1 -1
  116. data/spec/postgresql/migrate/migrate_references_spec.rb +6 -6
  117. data/spec/postgresql/migrate/migrate_rename_column_spec.rb +18 -18
  118. data/spec/postgresql/migrate/migrate_rename_table_spec.rb +20 -20
  119. data/spec/postgresql/migrate/migrate_same_spec.rb +13 -13
  120. data/spec/postgresql/~default_name_fk/migrate_change_fk_spec.rb +3 -3
  121. data/spec/postgresql/~default_name_fk/migrate_create_fk_spec.rb +4 -4
  122. data/spec/postgresql/~default_name_fk/migrate_drop_fk_spec.rb +4 -4
  123. data/spec/processing_for_ci.rb +13 -0
  124. data/spec/spec_condition.rb +4 -0
  125. data/spec/spec_helper.rb +3 -2
  126. metadata +74 -49
  127. data/.travis.yml +0 -45
  128. data/lib/ridgepole/ext/abstract_mysql_adapter/use_alter_index.rb +0 -31
  129. data/omnibus-ridgepole/.gitignore +0 -10
  130. data/omnibus-ridgepole/Dockerfile.centos +0 -25
  131. data/omnibus-ridgepole/Dockerfile.ubuntu +0 -21
  132. data/omnibus-ridgepole/Gemfile +0 -24
  133. data/omnibus-ridgepole/README.md +0 -15
  134. data/omnibus-ridgepole/Rakefile +0 -38
  135. data/omnibus-ridgepole/config/projects/ridgepole.rb +0 -27
  136. data/omnibus-ridgepole/config/software/ridgepole.rb +0 -13
  137. data/omnibus-ridgepole/omnibus.rb +0 -54
  138. data/omnibus-ridgepole/package-scripts/ridgepole/postinst +0 -1
  139. data/omnibus-ridgepole/package-scripts/ridgepole/postrm +0 -1
  140. data/spec/mysql/bigint_pk/bigint_pk_spec.rb +0 -47
  141. data/spec/mysql/migrate_/migrate_create_index_with_alter_spec.rb +0 -141
  142. data/spec/mysql/migrate_/migrate_drop_index_with_alter_spec.rb +0 -141
  143. data/spec/processing_for_travis.rb +0 -11
@@ -6,10 +6,10 @@ describe 'Ridgepole::Client#diff -> migrate' do
6
6
  erbh(<<-ERB)
7
7
  create_table "child", force: :cascade do |t|
8
8
  t.integer "parent_id"
9
- t.index ["parent_id"], name: "par_id", <%= i cond(5.0, using: :btree) %>
9
+ t.index ["parent_id"], name: "par_id"
10
10
  end
11
11
 
12
- create_table "parent", <%= i cond('>= 5.1',id: :integer) %>, force: :cascade do |t|
12
+ create_table "parent", id: :integer, force: :cascade do |t|
13
13
  end
14
14
  ERB
15
15
  end
@@ -48,12 +48,12 @@ describe 'Ridgepole::Client#diff -> migrate' do
48
48
  erbh(<<-ERB)
49
49
  create_table "child", force: :cascade do |t|
50
50
  t.integer "parent_id"
51
- t.index ["parent_id"], name: "par_id", <%= i cond(5.0, using: :btree) %>
51
+ t.index ["parent_id"], name: "par_id"
52
52
  end
53
53
 
54
54
  add_foreign_key "child", "parent", name: "child_ibfk_1"
55
55
 
56
- create_table "parent", <%= i cond('>= 5.1',id: :integer) %>, force: :cascade do |t|
56
+ create_table "parent", id: :integer, force: :cascade do |t|
57
57
  end
58
58
  ERB
59
59
  end
@@ -62,10 +62,10 @@ describe 'Ridgepole::Client#diff -> migrate' do
62
62
  erbh(<<-ERB)
63
63
  create_table "child", force: :cascade do |t|
64
64
  t.integer "parent_id"
65
- t.index ["parent_id"], name: "par_id", <%= i cond(5.0, using: :btree) %>
65
+ t.index ["parent_id"], name: "par_id"
66
66
  end
67
67
 
68
- create_table "parent", <%= i cond('>= 5.1',id: :integer) %>, force: :cascade do |t|
68
+ create_table "parent", id: :integer, force: :cascade do |t|
69
69
  end
70
70
 
71
71
  add_foreign_key "child", "parent", name: "child_ibfk_1"
@@ -88,14 +88,14 @@ describe 'Ridgepole::Client#diff -> migrate' do
88
88
  erbh(<<-ERB)
89
89
  create_table "child", force: :cascade do |t|
90
90
  t.integer "parent_id", unsigned: true
91
- t.index ["parent_id"], name: "par_id", <%= i cond(5.0, using: :btree) %>
91
+ t.index ["parent_id"], name: "par_id"
92
92
  end
93
93
 
94
94
  add_foreign_key "child", "parent", name: "child_ibfk_1"
95
95
 
96
96
  add_foreign_key "child", "parent", name: "child_ibfk_1"
97
97
 
98
- create_table "parent", <%= i cond('>= 5.1',id: :integer) %>, force: :cascade do |t|
98
+ create_table "parent", id: :integer, force: :cascade do |t|
99
99
  end
100
100
  ERB
101
101
  end
@@ -114,10 +114,10 @@ describe 'Ridgepole::Client#diff -> migrate' do
114
114
  erbh(<<-ERB)
115
115
  create_table "child", force: :cascade do |t|
116
116
  t.integer "parent_id"
117
- t.index ["parent_id"], name: "par_id", <%= i cond(5.0, using: :btree) %>
117
+ t.index ["parent_id"], name: "par_id"
118
118
  end
119
119
 
120
- create_table "parent", <%= i cond('>= 5.1',id: :integer) %>, force: :cascade do |t|
120
+ create_table "parent", id: :integer, force: :cascade do |t|
121
121
  end
122
122
  ERB
123
123
  end
@@ -156,7 +156,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
156
156
  erbh(<<-ERB)
157
157
  add_foreign_key "child", "parent", name: "child_ibfk_1"
158
158
 
159
- create_table "parent", <%= i cond('>= 5.1',id: :integer) %>, force: :cascade do |t|
159
+ create_table "parent", id: :integer, force: :cascade do |t|
160
160
  end
161
161
  ERB
162
162
  end
@@ -173,7 +173,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
173
173
  context 'when create fk without any indexes for its column' do
174
174
  let(:dsl) do
175
175
  erbh(<<-ERB)
176
- create_table "parent", <%= i cond('>= 5.1',id: :integer) %>, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
176
+ create_table "parent", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
177
177
  end
178
178
 
179
179
  create_table "child", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
@@ -186,26 +186,22 @@ describe 'Ridgepole::Client#diff -> migrate' do
186
186
  subject { client(dump_without_table_options: false) }
187
187
 
188
188
  it {
189
- expect(Ridgepole::Logger.instance).to receive(:warn).with(<<-MSG).twice
190
- [WARNING] Table `child` has a foreign key on `parent_id` column, but doesn't have any indexes on the column.
191
- Although an index will be added automatically by InnoDB, please add an index explicitly before the next operation.
192
- MSG
193
- subject.diff(dsl).migrate
194
-
195
- expect(subject.diff(dsl).differ?).to be_truthy
189
+ expect do
190
+ subject.diff(dsl).migrate
191
+ end.to raise_error('The column `parent_id` of the table `child` has a foreign key but no index. Although InnoDB creates an index automatically, please add one explicitly in order for ridgepole to manage it.')
196
192
  }
197
193
  end
198
194
 
199
195
  context 'when create fk with first key of multiple column indexes for its column' do
200
196
  let(:dsl) do
201
197
  erbh(<<-ERB)
202
- create_table "parent", <%= i cond('>= 5.1',id: :integer) %>, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
198
+ create_table "parent", id: :integer, force: :cascade, <%= i cond('>= 6.1', { charset: 'utf8' }, { options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" }) %> do |t|
203
199
  end
204
200
 
205
- create_table "child", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
201
+ create_table "child", force: :cascade, <%= i cond('>= 6.1', { charset: 'utf8' }, { options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" }) %> do |t|
206
202
  t.integer "parent_id"
207
203
  t.string "name"
208
- t.index ["parent_id", "name"], name: "par_id", <%= i cond(5.0, using: :btree) %>
204
+ t.index ["parent_id", "name"], name: "par_id"
209
205
  end
210
206
  add_foreign_key "child", "parent", name: "child_ibfk_1"
211
207
  ERB
@@ -224,10 +220,10 @@ describe 'Ridgepole::Client#diff -> migrate' do
224
220
  context 'when create fk on the primary key' do
225
221
  let(:dsl) do
226
222
  erbh(<<-ERB)
227
- create_table "users", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
223
+ create_table "users", force: :cascade, <%= i cond('>= 6.1', { charset: 'utf8' }, { options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" }) %> do |t|
228
224
  end
229
225
 
230
- create_table "icons", primary_key: "user_id", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
226
+ create_table "icons", primary_key: "user_id", force: :cascade, <%= i cond('>= 6.1', { charset: 'utf8' }, { options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" }) %> do |t|
231
227
  end
232
228
  add_foreign_key "icons", "users", name: "fk_icons_users"
233
229
  ERB
@@ -243,3 +239,56 @@ describe 'Ridgepole::Client#diff -> migrate' do
243
239
  }
244
240
  end
245
241
  end
242
+
243
+ context 'when create fk on the first primary key' do
244
+ let(:dsl) do
245
+ erbh(<<-ERB)
246
+ create_table "users", id: :integer, force: :cascade, <%= i cond('>= 6.1', { charset: 'utf8' }, { options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" }) %> do |t|
247
+ end
248
+
249
+ create_table "employee", id: :integer, force: :cascade, <%= i cond('>= 6.1', { charset: 'utf8' }, { options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" }) %> do |t|
250
+ end
251
+
252
+ create_table "icons", primary_key: ["user_id", "employee_id"], force: :cascade, <%= i cond('>= 6.1', { charset: 'utf8' }, { options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" }) %> do |t|
253
+ t.integer "user_id", null: false
254
+ t.integer "employee_id", null: false
255
+ end
256
+ add_foreign_key "icons", "users", name: "fk_icons_users"
257
+ ERB
258
+ end
259
+
260
+ subject { client(dump_without_table_options: false) }
261
+
262
+ it {
263
+ expect(Ridgepole::Logger.instance).to_not receive(:warn)
264
+ subject.diff(dsl).migrate
265
+
266
+ expect(subject.diff(dsl).differ?).to be_falsey
267
+ }
268
+ end
269
+
270
+ context 'when create fk on the second primary key' do
271
+ let(:dsl) do
272
+ erbh(<<-ERB)
273
+ create_table "users", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
274
+ end
275
+
276
+ create_table "employee", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
277
+ end
278
+
279
+ create_table "icons", primary_key: ["user_id", "employee_id"], force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
280
+ t.integer "user_id", null: false
281
+ t.integer "employee_id", null: false
282
+ end
283
+ add_foreign_key "icons", "employees", name: "fk_icons_employees"
284
+ ERB
285
+ end
286
+
287
+ subject { client(dump_without_table_options: false) }
288
+
289
+ it {
290
+ expect do
291
+ subject.diff(dsl).migrate
292
+ end.to raise_error('The column `employee_id` of the table `icons` has a foreign key but no index. Although InnoDB creates an index automatically, please add one explicitly in order for ridgepole to manage it.')
293
+ }
294
+ end
@@ -4,12 +4,12 @@ describe 'Ridgepole::Client#diff -> migrate' do
4
4
  context 'when drop fk' do
5
5
  let(:actual_dsl) do
6
6
  erbh(<<-ERB)
7
- create_table "parent", <%= i cond('>= 5.1',id: :integer) %>, force: :cascade do |t|
7
+ create_table "parent", id: :integer, force: :cascade do |t|
8
8
  end
9
9
 
10
10
  create_table "child", force: :cascade do |t|
11
11
  t.integer "parent_id"
12
- t.index ["parent_id"], name: "par_id", <%= i cond(5.0, using: :btree) %>
12
+ t.index ["parent_id"], name: "par_id"
13
13
  end
14
14
 
15
15
  add_foreign_key "child", "parent", name: "child_ibfk_1"
@@ -26,10 +26,10 @@ describe 'Ridgepole::Client#diff -> migrate' do
26
26
  erbh(<<-ERB)
27
27
  create_table "child", force: :cascade do |t|
28
28
  t.integer "parent_id"
29
- t.index ["parent_id"], name: "par_id", <%= i cond(5.0, using: :btree) %>
29
+ t.index ["parent_id"], name: "par_id"
30
30
  end
31
31
 
32
- create_table "parent", <%= i cond('>= 5.1',id: :integer) %>, force: :cascade do |t|
32
+ create_table "parent", id: :integer, force: :cascade do |t|
33
33
  end
34
34
  ERB
35
35
  end
@@ -60,16 +60,16 @@ describe 'Ridgepole::Client#diff -> migrate' do
60
60
  context 'when drop fk when drop table' do
61
61
  let(:dsl) do
62
62
  erbh(<<-ERB)
63
- create_table "users", <%= i cond('>= 5.1',id: :integer) %>, force: :cascade do |t|
63
+ create_table "users", id: :integer, force: :cascade do |t|
64
64
  t.integer "invitation_id"
65
- t.index ["invitation_id"], name: "idx_invitation_id", <%= i cond(5.0, using: :btree) %>
65
+ t.index ["invitation_id"], name: "idx_invitation_id"
66
66
  end
67
67
 
68
68
  add_foreign_key "users", "invitations", name: "users_ibfk"
69
69
 
70
- create_table "invitations", <%= i cond('>= 5.1',id: :integer) %>, force: :cascade do |t|
70
+ create_table "invitations", id: :integer, force: :cascade do |t|
71
71
  t.integer "user_id"
72
- t.index ["user_id"], name: "idx_user_id", <%= i cond(5.0, using: :btree) %>
72
+ t.index ["user_id"], name: "idx_user_id"
73
73
  end
74
74
 
75
75
  add_foreign_key "invitations", "users", name: "invitations_ibfk"
@@ -78,14 +78,14 @@ describe 'Ridgepole::Client#diff -> migrate' do
78
78
 
79
79
  let(:sorted_dsl) do
80
80
  erbh(<<-ERB)
81
- create_table "invitations", <%= i cond('>= 5.1',id: :integer) %>, force: :cascade do |t|
81
+ create_table "invitations", id: :integer, force: :cascade do |t|
82
82
  t.integer "user_id"
83
- t.index ["user_id"], name: "idx_user_id", <%= i cond(5.0, using: :btree) %>
83
+ t.index ["user_id"], name: "idx_user_id"
84
84
  end
85
85
 
86
- create_table "users", <%= i cond('>= 5.1',id: :integer) %>, force: :cascade do |t|
86
+ create_table "users", id: :integer, force: :cascade do |t|
87
87
  t.integer "invitation_id"
88
- t.index ["invitation_id"], name: "idx_invitation_id", <%= i cond(5.0, using: :btree) %>
88
+ t.index ["invitation_id"], name: "idx_invitation_id"
89
89
  end
90
90
 
91
91
  add_foreign_key "invitations", "users", name: "invitations_ibfk"
@@ -108,12 +108,12 @@ describe 'Ridgepole::Client#diff -> migrate' do
108
108
  context 'when drop fk without name' do
109
109
  let(:actual_dsl) do
110
110
  erbh(<<-ERB)
111
- create_table "parent", <%= i cond('>= 5.1',id: :integer) %>, force: :cascade do |t|
111
+ create_table "parent", id: :integer, force: :cascade do |t|
112
112
  end
113
113
 
114
114
  create_table "child", force: :cascade do |t|
115
115
  t.integer "parent_id"
116
- t.index ["parent_id"], name: "par_id", <%= i cond(5.0, using: :btree) %>
116
+ t.index ["parent_id"], name: "par_id"
117
117
  end
118
118
 
119
119
  add_foreign_key "child", "parent"
@@ -130,10 +130,10 @@ describe 'Ridgepole::Client#diff -> migrate' do
130
130
  erbh(<<-ERB)
131
131
  create_table "child", force: :cascade do |t|
132
132
  t.integer "parent_id"
133
- t.index ["parent_id"], name: "par_id", <%= i cond(5.0, using: :btree) %>
133
+ t.index ["parent_id"], name: "par_id"
134
134
  end
135
135
 
136
- create_table "parent", <%= i cond('>= 5.1',id: :integer) %>, force: :cascade do |t|
136
+ create_table "parent", id: :integer, force: :cascade do |t|
137
137
  end
138
138
  ERB
139
139
  end
@@ -164,12 +164,12 @@ describe 'Ridgepole::Client#diff -> migrate' do
164
164
  context 'when drop fk when drop table without name' do
165
165
  let(:dsl) do
166
166
  erbh(<<-ERB)
167
- create_table "parent", <%= i cond('>= 5.1',id: :integer) %>, force: :cascade do |t|
167
+ create_table "parent", id: :integer, force: :cascade do |t|
168
168
  end
169
169
 
170
170
  create_table "child", force: :cascade do |t|
171
171
  t.integer "parent_id"
172
- t.index ["parent_id"], name: "par_id", <%= i cond(5.0, using: :btree) %>
172
+ t.index ["parent_id"], name: "par_id"
173
173
  end
174
174
 
175
175
  add_foreign_key "child", "parent"
@@ -180,10 +180,10 @@ describe 'Ridgepole::Client#diff -> migrate' do
180
180
  erbh(<<-ERB)
181
181
  create_table "child", force: :cascade do |t|
182
182
  t.integer "parent_id"
183
- t.index ["parent_id"], name: "par_id", <%= i cond(5.0, using: :btree) %>
183
+ t.index ["parent_id"], name: "par_id"
184
184
  end
185
185
 
186
- create_table "parent", <%= i cond('>= 5.1',id: :integer) %>, force: :cascade do |t|
186
+ create_table "parent", id: :integer, force: :cascade do |t|
187
187
  end
188
188
 
189
189
  add_foreign_key "child", "parent"
@@ -207,10 +207,10 @@ describe 'Ridgepole::Client#diff -> migrate' do
207
207
  erbh(<<-ERB)
208
208
  create_table "child", force: :cascade do |t|
209
209
  t.integer "parent_id"
210
- t.index ["parent_id"], name: "par_id", <%= i cond(5.0, using: :btree) %>
210
+ t.index ["parent_id"], name: "par_id"
211
211
  end
212
212
 
213
- create_table "parent", <%= i cond('>= 5.1',id: :integer) %>, force: :cascade do |t|
213
+ create_table "parent", id: :integer, force: :cascade do |t|
214
214
  end
215
215
 
216
216
  add_foreign_key "child", "parent", name: "child_ibfk_1"
@@ -221,7 +221,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
221
221
  erbh(<<-ERB)
222
222
  create_table "child", force: :cascade do |t|
223
223
  t.integer "parent_id"
224
- t.index ["parent_id"], name: "par_id", <%= i cond(5.0, using: :btree) %>
224
+ t.index ["parent_id"], name: "par_id"
225
225
  end
226
226
  ERB
227
227
  end
@@ -243,10 +243,10 @@ describe 'Ridgepole::Client#diff -> migrate' do
243
243
  erbh(<<-ERB)
244
244
  create_table "child", force: :cascade do |t|
245
245
  t.integer "parent_id"
246
- t.index ["parent_id"], name: "par_id", <%= i cond(5.0, using: :btree) %>
246
+ t.index ["parent_id"], name: "par_id"
247
247
  end
248
248
 
249
- create_table "parent", <%= i cond('>= 5.1',id: :integer) %>, force: :cascade do |t|
249
+ create_table "parent", id: :integer, force: :cascade do |t|
250
250
  end
251
251
 
252
252
  add_foreign_key "child", "parent"
@@ -257,7 +257,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
257
257
  erbh(<<-ERB)
258
258
  create_table "child", force: :cascade do |t|
259
259
  t.integer "parent_id"
260
- t.index ["parent_id"], name: "par_id", <%= i cond(5.0, using: :btree) %>
260
+ t.index ["parent_id"], name: "par_id"
261
261
  end
262
262
  ERB
263
263
  end
@@ -4,16 +4,16 @@ describe 'Ridgepole::Client#diff -> migrate' do
4
4
  context 'when create fk with column' do
5
5
  let(:actual_dsl) do
6
6
  erbh(<<-ERB)
7
- create_table "direct_messages", <%= i cond('>= 5.1',id: :integer) %>, force: :cascade do |t|
7
+ create_table "direct_messages", id: :integer, force: :cascade do |t|
8
8
  t.integer "sender_id"
9
9
  t.integer "reciever_id"
10
10
  t.datetime "created_at", null: false
11
11
  t.datetime "updated_at", null: false
12
- t.index ["reciever_id"], name: "index_direct_messages_on_reciever_id", <%= i cond(5.0, using: :btree) %>
13
- t.index ["sender_id"], name: "index_direct_messages_on_sender_id", <%= i cond(5.0, using: :btree) %>
12
+ t.index ["reciever_id"], name: "index_direct_messages_on_reciever_id"
13
+ t.index ["sender_id"], name: "index_direct_messages_on_sender_id"
14
14
  end
15
15
 
16
- create_table "users", <%= i cond('>= 5.1',id: :integer) %>, force: :cascade do |t|
16
+ create_table "users", id: :integer, force: :cascade do |t|
17
17
  t.string "email"
18
18
  t.datetime "created_at", null: false
19
19
  t.datetime "updated_at", null: false
@@ -62,16 +62,16 @@ describe 'Ridgepole::Client#diff -> migrate' do
62
62
 
63
63
  let(:expected_dsl) do
64
64
  erbh(<<-ERB)
65
- create_table "direct_messages", <%= i cond('>= 5.1',id: :integer) %>, force: :cascade do |t|
65
+ create_table "direct_messages", id: :integer, force: :cascade do |t|
66
66
  t.integer "sender_id"
67
67
  t.integer "reciever_id"
68
68
  t.datetime "created_at", null: false
69
69
  t.datetime "updated_at", null: false
70
- t.index ["reciever_id"], name: "index_direct_messages_on_reciever_id", <%= i cond(5.0, using: :btree) %>
71
- t.index ["sender_id"], name: "index_direct_messages_on_sender_id", <%= i cond(5.0, using: :btree) %>
70
+ t.index ["reciever_id"], name: "index_direct_messages_on_reciever_id"
71
+ t.index ["sender_id"], name: "index_direct_messages_on_sender_id"
72
72
  end
73
73
 
74
- create_table "users", <%= i cond('>= 5.1',id: :integer) %>, force: :cascade do |t|
74
+ create_table "users", id: :integer, force: :cascade do |t|
75
75
  t.string "email"
76
76
  t.datetime "created_at", null: false
77
77
  t.datetime "updated_at", null: false
@@ -106,16 +106,16 @@ describe 'Ridgepole::Client#diff -> migrate' do
106
106
  context 'when change fk with column' do
107
107
  let(:actual_dsl) do
108
108
  erbh(<<-ERB)
109
- create_table "direct_messages", <%= i cond('>= 5.1',id: :integer) %>, force: :cascade do |t|
109
+ create_table "direct_messages", id: :integer, force: :cascade do |t|
110
110
  t.integer "sender_id"
111
111
  t.integer "reciever_id"
112
112
  t.datetime "created_at", null: false
113
113
  t.datetime "updated_at", null: false
114
- t.index ["reciever_id"], name: "index_direct_messages_on_reciever_id", <%= i cond(5.0, using: :btree) %>
115
- t.index ["sender_id"], name: "index_direct_messages_on_sender_id", <%= i cond(5.0, using: :btree) %>
114
+ t.index ["reciever_id"], name: "index_direct_messages_on_reciever_id"
115
+ t.index ["sender_id"], name: "index_direct_messages_on_sender_id"
116
116
  end
117
117
 
118
- create_table "users", <%= i cond('>= 5.1',id: :integer) %>, force: :cascade do |t|
118
+ create_table "users", id: :integer, force: :cascade do |t|
119
119
  t.string "email"
120
120
  t.datetime "created_at", null: false
121
121
  t.datetime "updated_at", null: false
@@ -128,16 +128,16 @@ describe 'Ridgepole::Client#diff -> migrate' do
128
128
 
129
129
  let(:expected_dsl) do
130
130
  erbh(<<-ERB)
131
- create_table "direct_messages", <%= i cond('>= 5.1',id: :integer) %>, force: :cascade do |t|
131
+ create_table "direct_messages", id: :integer, force: :cascade do |t|
132
132
  t.integer "sender_id"
133
133
  t.integer "reciever_id"
134
134
  t.datetime "created_at", null: false
135
135
  t.datetime "updated_at", null: false
136
- t.index ["reciever_id"], name: "index_direct_messages_on_reciever_id", <%= i cond(5.0, using: :btree) %>
137
- t.index ["sender_id"], name: "index_direct_messages_on_sender_id", <%= i cond(5.0, using: :btree) %>
136
+ t.index ["reciever_id"], name: "index_direct_messages_on_reciever_id"
137
+ t.index ["sender_id"], name: "index_direct_messages_on_sender_id"
138
138
  end
139
139
 
140
- create_table "users", <%= i cond('>= 5.1',id: :integer) %>, force: :cascade do |t|
140
+ create_table "users", id: :integer, force: :cascade do |t|
141
141
  t.string "email"
142
142
  t.datetime "created_at", null: false
143
143
  t.datetime "updated_at", null: false
@@ -6,10 +6,10 @@ describe 'Ridgepole::Client#diff -> migrate' do
6
6
  erbh(<<-ERB)
7
7
  create_table "child", force: :cascade do |t|
8
8
  t.integer "parent_id"
9
- t.index ["parent_id"], name: "par_id", <%= i cond(5.0, using: :btree) %>
9
+ t.index ["parent_id"], name: "par_id"
10
10
  end
11
11
 
12
- create_table "parent", <%= i cond('>= 5.1',id: :integer) %>, force: :cascade do |t|
12
+ create_table "parent", id: :integer, force: :cascade do |t|
13
13
  end
14
14
  ERB
15
15
  end
@@ -32,12 +32,12 @@ describe 'Ridgepole::Client#diff -> migrate' do
32
32
  context 'when change fk with ignore:true' do
33
33
  let(:actual_dsl) do
34
34
  erbh(<<-ERB)
35
- create_table "parent", <%= i cond('>= 5.1',id: :integer) %>, force: :cascade do |t|
35
+ create_table "parent", id: :integer, force: :cascade do |t|
36
36
  end
37
37
 
38
38
  create_table "child", force: :cascade do |t|
39
39
  t.integer "parent_id"
40
- t.index ["parent_id"], name: "par_id", <%= i cond(5.0, using: :btree) %>
40
+ t.index ["parent_id"], name: "par_id"
41
41
  end
42
42
 
43
43
  add_foreign_key "child", "parent", name: "child_ibfk_1", on_delete: :cascade
@@ -48,10 +48,10 @@ describe 'Ridgepole::Client#diff -> migrate' do
48
48
  erbh(<<-ERB)
49
49
  create_table "child", force: :cascade do |t|
50
50
  t.integer "parent_id"
51
- t.index ["parent_id"], name: "par_id", <%= i cond(5.0, using: :btree) %>
51
+ t.index ["parent_id"], name: "par_id"
52
52
  end
53
53
 
54
- create_table "parent", <%= i cond('>= 5.1',id: :integer) %>, force: :cascade do |t|
54
+ create_table "parent", id: :integer, force: :cascade do |t|
55
55
  end
56
56
 
57
57
  add_foreign_key "child", "parent", name: "child_ibfk_1", ignore: true