ridgepole 0.9.0.beta → 0.9.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (127) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/test.yml +24 -19
  3. data/.rubocop.yml +5 -4
  4. data/.simplecov +6 -0
  5. data/README.md +15 -30
  6. data/bin/ridgepole +0 -2
  7. data/lib/ridgepole/diff.rb +14 -14
  8. data/lib/ridgepole/dsl_parser/table_definition.rb +8 -1
  9. data/lib/ridgepole/version.rb +1 -1
  10. data/ridgepole.gemspec +3 -2
  11. data/spec/erb_helper.rb +1 -5
  12. data/spec/mysql/bigint_pk/int_pk_spec.rb +1 -1
  13. data/spec/mysql/collation/collation_spec.rb +14 -14
  14. data/spec/mysql/comment/comment_spec.rb +9 -9
  15. data/spec/mysql/diff/diff2_spec.rb +5 -5
  16. data/spec/mysql/diff/diff_spec.rb +3 -3
  17. data/spec/mysql/dump/dump_class_method_spec.rb +12 -12
  18. data/spec/mysql/dump/dump_some_tables_spec.rb +4 -4
  19. data/spec/mysql/dump/dump_spec.rb +12 -12
  20. data/spec/mysql/dump/dump_unknown_column_type_spec.rb +2 -2
  21. data/spec/mysql/dump/dump_without_table_options_spec.rb +1 -1
  22. data/spec/mysql/fk/migrate_change_fk2_spec.rb +2 -2
  23. data/spec/mysql/fk/migrate_change_fk_spec.rb +88 -20
  24. data/spec/mysql/fk/migrate_create_fk_spec.rb +73 -18
  25. data/spec/mysql/fk/migrate_drop_fk_spec.rb +81 -26
  26. data/spec/mysql/fk/migrate_fk_with_column_spec.rb +16 -16
  27. data/spec/mysql/fk/migrate_ignore_fk_spec.rb +6 -6
  28. data/spec/mysql/migrate/migrate_add_column_order_spec.rb +2 -2
  29. data/spec/mysql/migrate/migrate_add_column_spec.rb +18 -18
  30. data/spec/mysql/migrate/migrate_add_column_with_alter_extra_spec.rb +21 -21
  31. data/spec/mysql/migrate/migrate_add_column_with_script_spec.rb +18 -18
  32. data/spec/mysql/migrate/migrate_change_column2_spec.rb +5 -5
  33. data/spec/mysql/migrate/migrate_change_column3_spec.rb +10 -10
  34. data/spec/mysql/migrate/migrate_change_column5_spec.rb +3 -3
  35. data/spec/mysql/migrate/migrate_change_column6_spec.rb +7 -7
  36. data/spec/mysql/migrate/migrate_change_column7_spec.rb +11 -2
  37. data/spec/mysql/migrate/migrate_change_column_default_spec.rb +2 -14
  38. data/spec/mysql/migrate/migrate_change_column_spec.rb +21 -21
  39. data/spec/mysql/migrate/migrate_change_index2_spec.rb +5 -5
  40. data/spec/mysql/migrate/migrate_change_index3_spec.rb +7 -7
  41. data/spec/mysql/migrate/migrate_change_index4_spec.rb +6 -6
  42. data/spec/mysql/migrate/migrate_change_index5_spec.rb +4 -4
  43. data/spec/mysql/migrate/migrate_change_index6_spec.rb +27 -27
  44. data/spec/mysql/migrate/migrate_change_index7_spec.rb +4 -4
  45. data/spec/mysql/migrate/migrate_change_index8_spec.rb +4 -4
  46. data/spec/mysql/migrate/migrate_change_index_spec.rb +27 -27
  47. data/spec/mysql/migrate/migrate_check_relation_column_type_spec.rb +1 -1
  48. data/spec/mysql/migrate/migrate_create_index2_spec.rb +24 -24
  49. data/spec/mysql/migrate/migrate_create_index_spec.rb +78 -18
  50. data/spec/mysql/migrate/migrate_create_table_spec.rb +16 -16
  51. data/spec/mysql/migrate/migrate_create_table_with_ignore_spec.rb +4 -4
  52. data/spec/mysql/migrate/migrate_create_table_with_index_spec.rb +4 -4
  53. data/spec/mysql/migrate/migrate_create_table_with_script_spec.rb +16 -16
  54. data/spec/mysql/migrate/migrate_drop_column_and_index2_spec.rb +18 -18
  55. data/spec/mysql/migrate/migrate_drop_column_and_index_spec.rb +16 -16
  56. data/spec/mysql/migrate/migrate_drop_column_and_unique_index_spec.rb +1 -1
  57. data/spec/mysql/migrate/migrate_drop_column_spec.rb +18 -18
  58. data/spec/mysql/migrate/migrate_drop_index_spec.rb +15 -15
  59. data/spec/mysql/migrate/migrate_drop_table_spec.rb +16 -16
  60. data/spec/mysql/migrate/migrate_empty_spec.rb +9 -9
  61. data/spec/mysql/migrate/migrate_execute_spec.rb +32 -32
  62. data/spec/mysql/migrate/migrate_ignore_column_spec.rb +4 -4
  63. data/spec/mysql/migrate/migrate_ignore_index_spec.rb +5 -5
  64. data/spec/mysql/migrate/migrate_log_file_spec.rb +16 -16
  65. data/spec/mysql/migrate/migrate_merge_mode_spec.rb +18 -18
  66. data/spec/mysql/migrate/migrate_noop_spec.rb +12 -12
  67. data/spec/mysql/migrate/migrate_primary_key_spec.rb +1 -1
  68. data/spec/mysql/migrate/migrate_rename_column_spec.rb +18 -18
  69. data/spec/mysql/migrate/migrate_rename_table_spec.rb +22 -22
  70. data/spec/mysql/migrate/migrate_same_spec.rb +12 -12
  71. data/spec/mysql/migrate/migrate_skip_column_comment_change_spec.rb +2 -2
  72. data/spec/mysql/migrate/migrate_skip_drop_table_spec.rb +18 -18
  73. data/spec/mysql/migrate/migrate_skip_rename_column_spec.rb +18 -18
  74. data/spec/mysql/migrate/migrate_skip_rename_table_spec.rb +18 -18
  75. data/spec/mysql/migrate/migrate_with_pre_post_query_spec.rb +18 -18
  76. data/spec/mysql/text_blob_types/text_blob_types_spec.rb +1 -1
  77. data/spec/mysql/~default_name_fk/migrate_change_fk_spec.rb +6 -6
  78. data/spec/mysql/~default_name_fk/migrate_create_fk_spec.rb +9 -9
  79. data/spec/mysql/~default_name_fk/migrate_drop_fk_spec.rb +8 -8
  80. data/spec/mysql/~dump_auto_increment/migrate_create_table_with_index_spec.rb +5 -5
  81. data/spec/mysql57/json/add_json_column_spec.rb +2 -2
  82. data/spec/mysql57/json/change_json_column_spec.rb +6 -6
  83. data/spec/mysql57/json/drop_json_column_spec.rb +2 -2
  84. data/spec/mysql57/virtual/add_virtual_column_spec.rb +1 -1
  85. data/spec/mysql57/virtual/change_virtual_column_spec.rb +1 -1
  86. data/spec/mysql57/virtual/drop_virtual_column_spec.rb +1 -1
  87. data/spec/postgresql/dump/dump_spec.rb +12 -12
  88. data/spec/postgresql/fk/migrate_change_fk_spec.rb +6 -6
  89. data/spec/postgresql/fk/migrate_create_fk_spec.rb +5 -5
  90. data/spec/postgresql/fk/migrate_drop_fk_spec.rb +8 -8
  91. data/spec/postgresql/migrate/migrate_add_column_spec.rb +16 -16
  92. data/spec/postgresql/migrate/migrate_add_expression_index_spec.rb +1 -1
  93. data/spec/postgresql/migrate/migrate_change_column_spec.rb +16 -16
  94. data/spec/postgresql/migrate/migrate_change_index_spec.rb +18 -18
  95. data/spec/postgresql/migrate/migrate_check_relation_column_type_spec.rb +1 -1
  96. data/spec/postgresql/migrate/migrate_create_table_spec.rb +14 -14
  97. data/spec/postgresql/migrate/migrate_drop_column_spec.rb +18 -18
  98. data/spec/postgresql/migrate/migrate_drop_column_with_index_spec.rb +17 -17
  99. data/spec/postgresql/migrate/migrate_drop_expression_index_spec.rb +3 -3
  100. data/spec/postgresql/migrate/migrate_drop_index_spec.rb +15 -15
  101. data/spec/postgresql/migrate/migrate_drop_table_spec.rb +16 -16
  102. data/spec/postgresql/migrate/migrate_primary_key2_spec.rb +1 -1
  103. data/spec/postgresql/migrate/migrate_primary_key_spec.rb +1 -1
  104. data/spec/postgresql/migrate/migrate_references_spec.rb +6 -6
  105. data/spec/postgresql/migrate/migrate_rename_column_spec.rb +18 -18
  106. data/spec/postgresql/migrate/migrate_rename_table_spec.rb +20 -20
  107. data/spec/postgresql/migrate/migrate_same_spec.rb +12 -12
  108. data/spec/postgresql/~default_name_fk/migrate_change_fk_spec.rb +3 -3
  109. data/spec/postgresql/~default_name_fk/migrate_create_fk_spec.rb +4 -4
  110. data/spec/postgresql/~default_name_fk/migrate_drop_fk_spec.rb +4 -4
  111. data/spec/processing_for_ci.rb +13 -0
  112. data/spec/spec_const.rb +1 -1
  113. data/spec/spec_helper.rb +2 -1
  114. metadata +39 -37
  115. data/omnibus-ridgepole/.gitignore +0 -10
  116. data/omnibus-ridgepole/Dockerfile.centos +0 -25
  117. data/omnibus-ridgepole/Dockerfile.ubuntu +0 -21
  118. data/omnibus-ridgepole/Gemfile +0 -24
  119. data/omnibus-ridgepole/README.md +0 -15
  120. data/omnibus-ridgepole/Rakefile +0 -38
  121. data/omnibus-ridgepole/config/projects/ridgepole.rb +0 -27
  122. data/omnibus-ridgepole/config/software/ridgepole.rb +0 -13
  123. data/omnibus-ridgepole/omnibus.rb +0 -54
  124. data/omnibus-ridgepole/package-scripts/ridgepole/postinst +0 -1
  125. data/omnibus-ridgepole/package-scripts/ridgepole/postrm +0 -1
  126. data/spec/mysql/bigint_pk/bigint_pk_spec.rb +0 -47
  127. 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
@@ -43,17 +43,72 @@ describe 'Ridgepole::Client#diff -> migrate' do
43
43
  }
44
44
  end
45
45
 
46
+ context 'when create fk using `t.foreign_key`' do
47
+ let(:actual_dsl) do
48
+ erbh(<<-ERB)
49
+ create_table "child", force: :cascade do |t|
50
+ t.integer "parent_id"
51
+ t.index ["parent_id"], name: "par_id"
52
+ end
53
+
54
+ create_table "parent", id: :integer, force: :cascade do |t|
55
+ end
56
+ ERB
57
+ end
58
+
59
+ let(:expected_dsl) do
60
+ erbh(actual_dsl + <<-ERB)
61
+ add_foreign_key "child", "parent", name: "child_ibfk_1"
62
+ ERB
63
+ end
64
+
65
+ let(:expected_dsl_using_t_foreign_key) do
66
+ erbh(<<-ERB)
67
+ create_table "child", force: :cascade do |t|
68
+ t.integer "parent_id"
69
+ t.index ["parent_id"], name: "par_id"
70
+ t.foreign_key "parent", name: "child_ibfk_1"
71
+ end
72
+
73
+ create_table "parent", id: :integer, force: :cascade do |t|
74
+ end
75
+ ERB
76
+ end
77
+
78
+ before { subject.diff(actual_dsl).migrate }
79
+ subject { client }
80
+
81
+ it {
82
+ delta = subject.diff(expected_dsl_using_t_foreign_key)
83
+ expect(delta.differ?).to be_truthy
84
+ expect(subject.dump).to match_ruby actual_dsl
85
+ delta.migrate
86
+ expect(subject.dump).to match_ruby expected_dsl
87
+ }
88
+
89
+ it {
90
+ delta = client(bulk_change: true).diff(expected_dsl_using_t_foreign_key)
91
+ expect(delta.differ?).to be_truthy
92
+ expect(subject.dump).to match_ruby actual_dsl
93
+ expect(delta.script).to match_fuzzy <<-RUBY
94
+ add_foreign_key("child", "parent", **{:name=>"child_ibfk_1"})
95
+ RUBY
96
+ delta.migrate
97
+ expect(subject.dump).to match_ruby expected_dsl
98
+ }
99
+ end
100
+
46
101
  context 'when create fk when create table' do
47
102
  let(:dsl) do
48
103
  erbh(<<-ERB)
49
104
  create_table "child", force: :cascade do |t|
50
105
  t.integer "parent_id"
51
- t.index ["parent_id"], name: "par_id", <%= i cond(5.0, using: :btree) %>
106
+ t.index ["parent_id"], name: "par_id"
52
107
  end
53
108
 
54
109
  add_foreign_key "child", "parent", name: "child_ibfk_1"
55
110
 
56
- create_table "parent", <%= i cond('>= 5.1',id: :integer) %>, force: :cascade do |t|
111
+ create_table "parent", id: :integer, force: :cascade do |t|
57
112
  end
58
113
  ERB
59
114
  end
@@ -62,10 +117,10 @@ describe 'Ridgepole::Client#diff -> migrate' do
62
117
  erbh(<<-ERB)
63
118
  create_table "child", force: :cascade do |t|
64
119
  t.integer "parent_id"
65
- t.index ["parent_id"], name: "par_id", <%= i cond(5.0, using: :btree) %>
120
+ t.index ["parent_id"], name: "par_id"
66
121
  end
67
122
 
68
- create_table "parent", <%= i cond('>= 5.1',id: :integer) %>, force: :cascade do |t|
123
+ create_table "parent", id: :integer, force: :cascade do |t|
69
124
  end
70
125
 
71
126
  add_foreign_key "child", "parent", name: "child_ibfk_1"
@@ -88,14 +143,14 @@ describe 'Ridgepole::Client#diff -> migrate' do
88
143
  erbh(<<-ERB)
89
144
  create_table "child", force: :cascade do |t|
90
145
  t.integer "parent_id", unsigned: true
91
- t.index ["parent_id"], name: "par_id", <%= i cond(5.0, using: :btree) %>
146
+ t.index ["parent_id"], name: "par_id"
92
147
  end
93
148
 
94
149
  add_foreign_key "child", "parent", name: "child_ibfk_1"
95
150
 
96
151
  add_foreign_key "child", "parent", name: "child_ibfk_1"
97
152
 
98
- create_table "parent", <%= i cond('>= 5.1',id: :integer) %>, force: :cascade do |t|
153
+ create_table "parent", id: :integer, force: :cascade do |t|
99
154
  end
100
155
  ERB
101
156
  end
@@ -114,10 +169,10 @@ describe 'Ridgepole::Client#diff -> migrate' do
114
169
  erbh(<<-ERB)
115
170
  create_table "child", force: :cascade do |t|
116
171
  t.integer "parent_id"
117
- t.index ["parent_id"], name: "par_id", <%= i cond(5.0, using: :btree) %>
172
+ t.index ["parent_id"], name: "par_id"
118
173
  end
119
174
 
120
- create_table "parent", <%= i cond('>= 5.1',id: :integer) %>, force: :cascade do |t|
175
+ create_table "parent", id: :integer, force: :cascade do |t|
121
176
  end
122
177
  ERB
123
178
  end
@@ -156,7 +211,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
156
211
  erbh(<<-ERB)
157
212
  add_foreign_key "child", "parent", name: "child_ibfk_1"
158
213
 
159
- create_table "parent", <%= i cond('>= 5.1',id: :integer) %>, force: :cascade do |t|
214
+ create_table "parent", id: :integer, force: :cascade do |t|
160
215
  end
161
216
  ERB
162
217
  end
@@ -173,7 +228,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
173
228
  context 'when create fk without any indexes for its column' do
174
229
  let(:dsl) do
175
230
  erbh(<<-ERB)
176
- create_table "parent", <%= i cond('>= 5.1',id: :integer) %>, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
231
+ create_table "parent", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
177
232
  end
178
233
 
179
234
  create_table "child", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
@@ -195,13 +250,13 @@ describe 'Ridgepole::Client#diff -> migrate' do
195
250
  context 'when create fk with first key of multiple column indexes for its column' do
196
251
  let(:dsl) do
197
252
  erbh(<<-ERB)
198
- create_table "parent", <%= i cond('>= 5.1',id: :integer) %>, force: :cascade, <%= i cond('>= 6.1', { charset: 'utf8' }, { options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" }) %> do |t|
253
+ create_table "parent", id: :integer, force: :cascade, <%= i cond('>= 6.1', { charset: 'utf8' }, { options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" }) %> do |t|
199
254
  end
200
255
 
201
256
  create_table "child", force: :cascade, <%= i cond('>= 6.1', { charset: 'utf8' }, { options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" }) %> do |t|
202
257
  t.integer "parent_id"
203
258
  t.string "name"
204
- t.index ["parent_id", "name"], name: "par_id", <%= i cond(5.0, using: :btree) %>
259
+ t.index ["parent_id", "name"], name: "par_id"
205
260
  end
206
261
  add_foreign_key "child", "parent", name: "child_ibfk_1"
207
262
  ERB
@@ -243,10 +298,10 @@ end
243
298
  context 'when create fk on the first primary key' do
244
299
  let(:dsl) do
245
300
  erbh(<<-ERB)
246
- create_table "users", <%= i cond('>= 5.1',id: :integer) %>, force: :cascade, <%= i cond('>= 6.1', { charset: 'utf8' }, { options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" }) %> do |t|
301
+ create_table "users", id: :integer, force: :cascade, <%= i cond('>= 6.1', { charset: 'utf8' }, { options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" }) %> do |t|
247
302
  end
248
303
 
249
- create_table "employee", <%= i cond('>= 5.1',id: :integer) %>, force: :cascade, <%= i cond('>= 6.1', { charset: 'utf8' }, { options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" }) %> do |t|
304
+ create_table "employee", id: :integer, force: :cascade, <%= i cond('>= 6.1', { charset: 'utf8' }, { options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" }) %> do |t|
250
305
  end
251
306
 
252
307
  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|
@@ -270,10 +325,10 @@ end
270
325
  context 'when create fk on the second primary key' do
271
326
  let(:dsl) do
272
327
  erbh(<<-ERB)
273
- create_table "users", <%= i cond('>= 5.1',id: :integer) %>, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
328
+ create_table "users", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
274
329
  end
275
330
 
276
- create_table "employee", <%= i cond('>= 5.1',id: :integer) %>, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
331
+ create_table "employee", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
277
332
  end
278
333
 
279
334
  create_table "icons", primary_key: ["user_id", "employee_id"], force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
@@ -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,65 @@ 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
+ end
34
+ ERB
35
+ end
36
+
37
+ before { subject.diff(actual_dsl).migrate }
38
+ subject { client }
39
+
40
+ it {
41
+ delta = subject.diff(expected_dsl)
42
+ expect(delta.differ?).to be_truthy
43
+ expect(subject.dump).to match_fuzzy sorted_actual_dsl
44
+ delta.migrate
45
+ expect(subject.dump).to match_ruby expected_dsl
46
+ }
47
+
48
+ it {
49
+ delta = client(bulk_change: true).diff(expected_dsl)
50
+ expect(delta.differ?).to be_truthy
51
+ expect(subject.dump).to match_fuzzy sorted_actual_dsl
52
+ expect(delta.script).to match_fuzzy <<-RUBY
53
+ remove_foreign_key("child", name: "child_ibfk_1")
54
+ RUBY
55
+ delta.migrate
56
+ expect(subject.dump).to match_ruby expected_dsl
57
+ }
58
+ end
59
+
60
+ context 'when drop fk using `t.foreign_key`' do
61
+ let(:actual_dsl) do
62
+ erbh(<<-ERB)
63
+ create_table "parent", id: :integer, force: :cascade do |t|
64
+ end
65
+
66
+ create_table "child", force: :cascade do |t|
67
+ t.integer "parent_id"
68
+ t.index ["parent_id"], name: "par_id"
69
+ t.foreign_key "parent", name: "child_ibfk_1"
70
+ end
71
+ ERB
72
+ end
73
+
74
+ let(:sorted_actual_dsl) do
75
+ expected_dsl + <<-RUBY
76
+ add_foreign_key "child", "parent", name: "child_ibfk_1"
77
+ RUBY
78
+ end
79
+
80
+ let(:expected_dsl) do
81
+ erbh(<<-ERB)
82
+ create_table "child", force: :cascade do |t|
83
+ t.integer "parent_id"
84
+ t.index ["parent_id"], name: "par_id"
85
+ end
86
+
87
+ create_table "parent", id: :integer, force: :cascade do |t|
33
88
  end
34
89
  ERB
35
90
  end
@@ -60,16 +115,16 @@ describe 'Ridgepole::Client#diff -> migrate' do
60
115
  context 'when drop fk when drop table' do
61
116
  let(:dsl) do
62
117
  erbh(<<-ERB)
63
- create_table "users", <%= i cond('>= 5.1',id: :integer) %>, force: :cascade do |t|
118
+ create_table "users", id: :integer, force: :cascade do |t|
64
119
  t.integer "invitation_id"
65
- t.index ["invitation_id"], name: "idx_invitation_id", <%= i cond(5.0, using: :btree) %>
120
+ t.index ["invitation_id"], name: "idx_invitation_id"
66
121
  end
67
122
 
68
123
  add_foreign_key "users", "invitations", name: "users_ibfk"
69
124
 
70
- create_table "invitations", <%= i cond('>= 5.1',id: :integer) %>, force: :cascade do |t|
125
+ create_table "invitations", id: :integer, force: :cascade do |t|
71
126
  t.integer "user_id"
72
- t.index ["user_id"], name: "idx_user_id", <%= i cond(5.0, using: :btree) %>
127
+ t.index ["user_id"], name: "idx_user_id"
73
128
  end
74
129
 
75
130
  add_foreign_key "invitations", "users", name: "invitations_ibfk"
@@ -78,14 +133,14 @@ describe 'Ridgepole::Client#diff -> migrate' do
78
133
 
79
134
  let(:sorted_dsl) do
80
135
  erbh(<<-ERB)
81
- create_table "invitations", <%= i cond('>= 5.1',id: :integer) %>, force: :cascade do |t|
136
+ create_table "invitations", id: :integer, force: :cascade do |t|
82
137
  t.integer "user_id"
83
- t.index ["user_id"], name: "idx_user_id", <%= i cond(5.0, using: :btree) %>
138
+ t.index ["user_id"], name: "idx_user_id"
84
139
  end
85
140
 
86
- create_table "users", <%= i cond('>= 5.1',id: :integer) %>, force: :cascade do |t|
141
+ create_table "users", id: :integer, force: :cascade do |t|
87
142
  t.integer "invitation_id"
88
- t.index ["invitation_id"], name: "idx_invitation_id", <%= i cond(5.0, using: :btree) %>
143
+ t.index ["invitation_id"], name: "idx_invitation_id"
89
144
  end
90
145
 
91
146
  add_foreign_key "invitations", "users", name: "invitations_ibfk"
@@ -108,12 +163,12 @@ describe 'Ridgepole::Client#diff -> migrate' do
108
163
  context 'when drop fk without name' do
109
164
  let(:actual_dsl) do
110
165
  erbh(<<-ERB)
111
- create_table "parent", <%= i cond('>= 5.1',id: :integer) %>, force: :cascade do |t|
166
+ create_table "parent", id: :integer, force: :cascade do |t|
112
167
  end
113
168
 
114
169
  create_table "child", force: :cascade do |t|
115
170
  t.integer "parent_id"
116
- t.index ["parent_id"], name: "par_id", <%= i cond(5.0, using: :btree) %>
171
+ t.index ["parent_id"], name: "par_id"
117
172
  end
118
173
 
119
174
  add_foreign_key "child", "parent"
@@ -130,10 +185,10 @@ describe 'Ridgepole::Client#diff -> migrate' do
130
185
  erbh(<<-ERB)
131
186
  create_table "child", force: :cascade do |t|
132
187
  t.integer "parent_id"
133
- t.index ["parent_id"], name: "par_id", <%= i cond(5.0, using: :btree) %>
188
+ t.index ["parent_id"], name: "par_id"
134
189
  end
135
190
 
136
- create_table "parent", <%= i cond('>= 5.1',id: :integer) %>, force: :cascade do |t|
191
+ create_table "parent", id: :integer, force: :cascade do |t|
137
192
  end
138
193
  ERB
139
194
  end
@@ -164,12 +219,12 @@ describe 'Ridgepole::Client#diff -> migrate' do
164
219
  context 'when drop fk when drop table without name' do
165
220
  let(:dsl) do
166
221
  erbh(<<-ERB)
167
- create_table "parent", <%= i cond('>= 5.1',id: :integer) %>, force: :cascade do |t|
222
+ create_table "parent", id: :integer, force: :cascade do |t|
168
223
  end
169
224
 
170
225
  create_table "child", force: :cascade do |t|
171
226
  t.integer "parent_id"
172
- t.index ["parent_id"], name: "par_id", <%= i cond(5.0, using: :btree) %>
227
+ t.index ["parent_id"], name: "par_id"
173
228
  end
174
229
 
175
230
  add_foreign_key "child", "parent"
@@ -180,10 +235,10 @@ describe 'Ridgepole::Client#diff -> migrate' do
180
235
  erbh(<<-ERB)
181
236
  create_table "child", force: :cascade do |t|
182
237
  t.integer "parent_id"
183
- t.index ["parent_id"], name: "par_id", <%= i cond(5.0, using: :btree) %>
238
+ t.index ["parent_id"], name: "par_id"
184
239
  end
185
240
 
186
- create_table "parent", <%= i cond('>= 5.1',id: :integer) %>, force: :cascade do |t|
241
+ create_table "parent", id: :integer, force: :cascade do |t|
187
242
  end
188
243
 
189
244
  add_foreign_key "child", "parent"
@@ -207,10 +262,10 @@ describe 'Ridgepole::Client#diff -> migrate' do
207
262
  erbh(<<-ERB)
208
263
  create_table "child", force: :cascade do |t|
209
264
  t.integer "parent_id"
210
- t.index ["parent_id"], name: "par_id", <%= i cond(5.0, using: :btree) %>
265
+ t.index ["parent_id"], name: "par_id"
211
266
  end
212
267
 
213
- create_table "parent", <%= i cond('>= 5.1',id: :integer) %>, force: :cascade do |t|
268
+ create_table "parent", id: :integer, force: :cascade do |t|
214
269
  end
215
270
 
216
271
  add_foreign_key "child", "parent", name: "child_ibfk_1"
@@ -221,7 +276,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
221
276
  erbh(<<-ERB)
222
277
  create_table "child", force: :cascade do |t|
223
278
  t.integer "parent_id"
224
- t.index ["parent_id"], name: "par_id", <%= i cond(5.0, using: :btree) %>
279
+ t.index ["parent_id"], name: "par_id"
225
280
  end
226
281
  ERB
227
282
  end
@@ -243,10 +298,10 @@ describe 'Ridgepole::Client#diff -> migrate' do
243
298
  erbh(<<-ERB)
244
299
  create_table "child", force: :cascade do |t|
245
300
  t.integer "parent_id"
246
- t.index ["parent_id"], name: "par_id", <%= i cond(5.0, using: :btree) %>
301
+ t.index ["parent_id"], name: "par_id"
247
302
  end
248
303
 
249
- create_table "parent", <%= i cond('>= 5.1',id: :integer) %>, force: :cascade do |t|
304
+ create_table "parent", id: :integer, force: :cascade do |t|
250
305
  end
251
306
 
252
307
  add_foreign_key "child", "parent"
@@ -257,7 +312,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
257
312
  erbh(<<-ERB)
258
313
  create_table "child", force: :cascade do |t|
259
314
  t.integer "parent_id"
260
- t.index ["parent_id"], name: "par_id", <%= i cond(5.0, using: :btree) %>
315
+ t.index ["parent_id"], name: "par_id"
261
316
  end
262
317
  ERB
263
318
  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