ridgepole 0.7.1 → 0.7.2.beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +4 -3
- data/Appraisals +8 -0
- data/README.md +2 -0
- data/docker-compose.yml +2 -2
- data/gemfiles/activerecord_5.2.gemfile +11 -0
- data/lib/ridgepole/ext/schema_dumper.rb +1 -1
- data/lib/ridgepole/schema_statements_ext.rb +2 -2
- data/lib/ridgepole/version.rb +1 -1
- data/ridgepole.gemspec +1 -0
- data/spec/erb_helper.rb +3 -1
- data/spec/mysql/_migrate/migrate_change_table_option_spec.rb +5 -5
- data/spec/mysql/bigint_pk/int_pk_spec.rb +2 -2
- data/spec/mysql/collation/collation_spec.rb +15 -15
- data/spec/mysql/comment/comment_spec.rb +10 -10
- data/spec/mysql/default_lambda/default_lambda_spec.rb +2 -2
- data/spec/mysql/diff/diff2_spec.rb +4 -4
- data/spec/mysql/diff/diff_spec.rb +4 -4
- data/spec/mysql/dump/dump_class_method_spec.rb +3 -3
- data/spec/mysql/dump/dump_some_tables_spec.rb +2 -2
- data/spec/mysql/dump/dump_spec.rb +3 -3
- data/spec/mysql/dump/dump_unknown_column_type_spec.rb +1 -1
- data/spec/mysql/dump/dump_without_table_options_spec.rb +2 -2
- data/spec/mysql/fk/migrate_change_fk_spec.rb +16 -16
- data/spec/mysql/fk/migrate_create_fk_spec.rb +14 -14
- data/spec/mysql/fk/migrate_drop_fk_spec.rb +18 -18
- data/spec/mysql/migrate/migrate_add_column2_spec.rb +8 -8
- data/spec/mysql/migrate/migrate_add_column_order_spec.rb +12 -12
- data/spec/mysql/migrate/migrate_add_column_spec.rb +4 -4
- data/spec/mysql/migrate/migrate_add_column_with_alter_extra_spec.rb +2 -2
- data/spec/mysql/migrate/migrate_add_column_with_script_spec.rb +2 -2
- data/spec/mysql/migrate/migrate_change_column2_spec.rb +2 -2
- data/spec/mysql/migrate/migrate_change_column3_spec.rb +14 -14
- data/spec/mysql/migrate/migrate_change_column5_spec.rb +4 -4
- data/spec/mysql/migrate/migrate_change_column6_spec.rb +11 -11
- data/spec/mysql/migrate/migrate_change_column7_spec.rb +2 -2
- data/spec/mysql/migrate/migrate_change_column_default_spec.rb +20 -20
- data/spec/mysql/migrate/migrate_change_column_float_spec.rb +9 -4
- data/spec/mysql/migrate/migrate_change_column_spec.rb +7 -7
- data/spec/mysql/migrate/migrate_change_index2_spec.rb +2 -2
- data/spec/mysql/migrate/migrate_change_index3_spec.rb +4 -4
- data/spec/mysql/migrate/migrate_change_index4_spec.rb +6 -6
- data/spec/mysql/migrate/migrate_change_index5_spec.rb +2 -2
- data/spec/mysql/migrate/migrate_change_index6_spec.rb +2 -2
- data/spec/mysql/migrate/migrate_change_index7_spec.rb +7 -7
- data/spec/mysql/migrate/migrate_change_index8_spec.rb +7 -7
- data/spec/mysql/migrate/migrate_change_index_spec.rb +3 -3
- data/spec/mysql/migrate/migrate_change_table_option_spec.rb +4 -4
- data/spec/mysql/migrate/migrate_check_relation_column_type_spec.rb +8 -8
- data/spec/mysql/migrate/migrate_create_index2_spec.rb +2 -2
- data/spec/mysql/migrate/migrate_create_index_spec.rb +4 -4
- data/spec/mysql/migrate/migrate_create_table_spec.rb +2 -2
- data/spec/mysql/migrate/migrate_create_table_with_index_spec.rb +2 -2
- data/spec/mysql/migrate/migrate_create_table_with_script_spec.rb +2 -2
- data/spec/mysql/migrate/migrate_drop_column_and_index2_spec.rb +4 -4
- data/spec/mysql/migrate/migrate_drop_column_and_index_spec.rb +6 -6
- data/spec/mysql/migrate/migrate_drop_column_and_unique_index_spec.rb +4 -4
- data/spec/mysql/migrate/migrate_drop_column_spec.rb +4 -4
- data/spec/mysql/migrate/migrate_drop_index_spec.rb +4 -4
- data/spec/mysql/migrate/migrate_drop_table_spec.rb +2 -2
- data/spec/mysql/migrate/migrate_empty_spec.rb +2 -2
- data/spec/mysql/migrate/migrate_execute_spec.rb +23 -23
- data/spec/mysql/migrate/migrate_log_file_spec.rb +2 -2
- data/spec/mysql/migrate/migrate_merge_mode_spec.rb +2 -2
- data/spec/mysql/migrate/migrate_noop_spec.rb +27 -27
- data/spec/mysql/migrate/migrate_primary_key_spec.rb +2 -2
- data/spec/mysql/migrate/migrate_rename_column_spec.rb +4 -4
- data/spec/mysql/migrate/migrate_rename_table_spec.rb +4 -4
- data/spec/mysql/migrate/migrate_same_default_null_spec.rb +4 -4
- data/spec/mysql/migrate/migrate_same_spec.rb +5 -5
- data/spec/mysql/migrate/migrate_script_error_spec.rb +1 -1
- data/spec/mysql/migrate/migrate_skip_drop_table_spec.rb +2 -2
- data/spec/mysql/migrate/migrate_skip_rename_column_spec.rb +2 -2
- data/spec/mysql/migrate/migrate_skip_rename_table_spec.rb +2 -2
- data/spec/mysql/migrate/migrate_with_ignore_tables_spec.rb +2 -2
- data/spec/mysql/migrate/migrate_with_pre_post_query_spec.rb +2 -2
- data/spec/mysql/migrate/migrate_with_tables_spec.rb +2 -2
- data/spec/mysql/migrate/migrate_with_verbose_log_spec.rb +2 -2
- data/spec/mysql/migrate_/migrate_create_index_with_alter_spec.rb +2 -2
- data/spec/mysql/migrate_/migrate_drop_index_with_alter_spec.rb +2 -2
- data/spec/mysql/text_blob_types/text_blob_types_spec.rb +1 -1
- data/spec/mysql/~default_name_fk/migrate_change_fk_spec.rb +4 -4
- data/spec/mysql/~default_name_fk/migrate_create_fk_spec.rb +9 -9
- data/spec/mysql/~default_name_fk/migrate_drop_fk_spec.rb +6 -6
- data/spec/mysql/~dump_auto_increment/migrate_create_table_with_index_spec.rb +2 -2
- data/spec/mysql57/json/add_json_column_spec.rb +2 -2
- data/spec/mysql57/json/change_json_column_spec.rb +6 -6
- data/spec/mysql57/json/drop_json_column_spec.rb +2 -2
- data/spec/mysql57/virtual/add_virtual_column_spec.rb +2 -2
- data/spec/mysql57/virtual/change_virtual_column_spec.rb +2 -2
- data/spec/mysql57/virtual/drop_virtual_column_spec.rb +2 -2
- data/spec/postgresql/dump/dump_spec.rb +3 -3
- data/spec/postgresql/fk/migrate_change_fk_spec.rb +2 -2
- data/spec/postgresql/fk/migrate_create_fk_spec.rb +8 -8
- data/spec/postgresql/fk/migrate_drop_fk_spec.rb +4 -4
- data/spec/postgresql/migrate/migrate_add_column_spec.rb +6 -6
- data/spec/postgresql/migrate/migrate_bigint_spec.rb +2 -2
- data/spec/postgresql/migrate/migrate_change_column_default_spec.rb +2 -2
- data/spec/postgresql/migrate/migrate_change_column_spec.rb +4 -4
- data/spec/postgresql/migrate/migrate_change_index_spec.rb +3 -3
- data/spec/postgresql/migrate/migrate_check_relation_column_type_spec.rb +4 -4
- data/spec/postgresql/migrate/migrate_create_table_spec.rb +2 -2
- data/spec/postgresql/migrate/migrate_create_table_with_default_proc_spec.rb +8 -8
- data/spec/postgresql/migrate/migrate_drop_column_spec.rb +4 -4
- data/spec/postgresql/migrate/migrate_drop_column_with_index_spec.rb +6 -6
- data/spec/postgresql/migrate/migrate_drop_index_spec.rb +4 -4
- data/spec/postgresql/migrate/migrate_drop_table_spec.rb +2 -2
- data/spec/postgresql/migrate/migrate_ext_cols_spec.rb +2 -2
- data/spec/postgresql/migrate/migrate_references_spec.rb +6 -6
- data/spec/postgresql/migrate/migrate_rename_column_spec.rb +4 -4
- data/spec/postgresql/migrate/migrate_rename_table_spec.rb +4 -4
- data/spec/postgresql/migrate/migrate_same_spec.rb +5 -5
- data/spec/postgresql/~default_name_fk/migrate_change_fk_spec.rb +1 -1
- data/spec/postgresql/~default_name_fk/migrate_create_fk_spec.rb +4 -4
- data/spec/postgresql/~default_name_fk/migrate_drop_fk_spec.rb +2 -2
- data/spec/spec_condition.rb +7 -0
- data/spec/spec_helper.rb +1 -0
- metadata +19 -4
|
@@ -123,15 +123,15 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
|
123
123
|
it {
|
|
124
124
|
delta = subject.diff(expected_dsl)
|
|
125
125
|
expect(delta.differ?).to be_truthy
|
|
126
|
-
expect(subject.dump).to
|
|
126
|
+
expect(subject.dump).to match_ruby actual_dsl
|
|
127
127
|
delta.migrate
|
|
128
|
-
expect(subject.dump).to
|
|
128
|
+
expect(subject.dump).to match_ruby expected_dsl
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
it {
|
|
132
132
|
delta = client(:bulk_change => true).diff(expected_dsl)
|
|
133
133
|
expect(delta.differ?).to be_truthy
|
|
134
|
-
expect(subject.dump).to
|
|
134
|
+
expect(subject.dump).to match_ruby actual_dsl
|
|
135
135
|
expect(delta.script).to match_fuzzy <<-EOS
|
|
136
136
|
change_table("dept_emp", {:bulk => true}) do |t|
|
|
137
137
|
t.remove("from_date")
|
|
@@ -150,7 +150,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
|
150
150
|
end
|
|
151
151
|
EOS
|
|
152
152
|
delta.migrate
|
|
153
|
-
expect(subject.dump).to
|
|
153
|
+
expect(subject.dump).to match_ruby expected_dsl
|
|
154
154
|
}
|
|
155
155
|
end
|
|
156
156
|
end
|
|
@@ -129,15 +129,15 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
|
129
129
|
it {
|
|
130
130
|
delta = subject.diff(expected_dsl)
|
|
131
131
|
expect(delta.differ?).to be_truthy
|
|
132
|
-
expect(subject.dump).to
|
|
132
|
+
expect(subject.dump).to match_ruby actual_dsl
|
|
133
133
|
delta.migrate
|
|
134
|
-
expect(subject.dump).to
|
|
134
|
+
expect(subject.dump).to match_ruby expected_dsl
|
|
135
135
|
}
|
|
136
136
|
|
|
137
137
|
it {
|
|
138
138
|
delta = client(:bulk_change => true).diff(expected_dsl)
|
|
139
139
|
expect(delta.differ?).to be_truthy
|
|
140
|
-
expect(subject.dump).to
|
|
140
|
+
expect(subject.dump).to match_ruby actual_dsl
|
|
141
141
|
expect(delta.script).to match_fuzzy <<-EOS
|
|
142
142
|
change_table("clubs", {:bulk => true}) do |t|
|
|
143
143
|
t.remove_index({:name=>"idx_name"})
|
|
@@ -152,7 +152,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
|
152
152
|
end
|
|
153
153
|
EOS
|
|
154
154
|
delta.migrate
|
|
155
|
-
expect(subject.dump).to
|
|
155
|
+
expect(subject.dump).to match_ruby expected_dsl
|
|
156
156
|
}
|
|
157
157
|
end
|
|
158
158
|
end
|
|
@@ -113,9 +113,9 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
|
113
113
|
it {
|
|
114
114
|
delta = subject.diff(expected_dsl)
|
|
115
115
|
expect(delta.differ?).to be_truthy
|
|
116
|
-
expect(subject.dump).to
|
|
116
|
+
expect(subject.dump).to match_ruby actual_dsl
|
|
117
117
|
delta.migrate
|
|
118
|
-
expect(subject.dump).to
|
|
118
|
+
expect(subject.dump).to match_ruby expected_dsl
|
|
119
119
|
}
|
|
120
120
|
end
|
|
121
121
|
end
|
|
@@ -68,9 +68,9 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
|
68
68
|
it {
|
|
69
69
|
delta = subject.diff(expected_dsl)
|
|
70
70
|
expect(delta.differ?).to be_truthy
|
|
71
|
-
expect(subject.dump).to
|
|
71
|
+
expect(subject.dump).to match_ruby actual_dsl
|
|
72
72
|
delta.migrate
|
|
73
|
-
expect(subject.dump).to
|
|
73
|
+
expect(subject.dump).to match_ruby expected_dsl
|
|
74
74
|
}
|
|
75
75
|
end
|
|
76
76
|
end
|
|
@@ -2,11 +2,11 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
|
2
2
|
context 'when execute' do
|
|
3
3
|
let(:dsl) {
|
|
4
4
|
erbh(<<-EOS)
|
|
5
|
-
create_table "authors", <%= i cond(5.1,
|
|
5
|
+
create_table "authors", <%= i cond('>= 5.1',id: :integer) + {force: :cascade} %> do |t|
|
|
6
6
|
t.string "name", null: false
|
|
7
7
|
end
|
|
8
8
|
|
|
9
|
-
create_table "books", <%= i cond(5.1,
|
|
9
|
+
create_table "books", <%= i cond('>= 5.1',id: :integer) + {force: :cascad} %>e do |t|
|
|
10
10
|
t.string "title", null: false
|
|
11
11
|
t.integer "author_id", null: false
|
|
12
12
|
t.index ["author_id"], name: "idx_author_id", <%= i cond(5.0, using: :btree) %>
|
|
@@ -16,11 +16,11 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
|
16
16
|
|
|
17
17
|
let(:dsl_with_execute) {
|
|
18
18
|
erbh(<<-EOS)
|
|
19
|
-
create_table "authors", <%= i cond(5.1,
|
|
19
|
+
create_table "authors", <%= i cond('>= 5.1',id: :integer) + {force: :cascade} %> do |t|
|
|
20
20
|
t.string "name", null: false
|
|
21
21
|
end
|
|
22
22
|
|
|
23
|
-
create_table "books", <%= i cond(5.1,
|
|
23
|
+
create_table "books", <%= i cond('>= 5.1',id: :integer) + {force: :cascad} %>e do |t|
|
|
24
24
|
t.string "title", null: false
|
|
25
25
|
t.integer "author_id", null: false
|
|
26
26
|
t.index ["author_id"], name: "idx_author_id", <%= i cond(5.0, using: :btree) %>
|
|
@@ -38,7 +38,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
|
38
38
|
it {
|
|
39
39
|
delta = subject.diff(dsl_with_execute)
|
|
40
40
|
expect(delta.differ?).to be_truthy
|
|
41
|
-
expect(subject.dump).to
|
|
41
|
+
expect(subject.dump).to match_ruby dsl
|
|
42
42
|
|
|
43
43
|
expect(show_create_table(:books)).to match_fuzzy erbh(<<-EOS)
|
|
44
44
|
CREATE TABLE `books` (
|
|
@@ -72,11 +72,11 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
|
72
72
|
context 'when not execute' do
|
|
73
73
|
let(:dsl) {
|
|
74
74
|
erbh(<<-EOS)
|
|
75
|
-
create_table "authors", <%= i cond(5.1,
|
|
75
|
+
create_table "authors", <%= i cond('>= 5.1',id: :integer) + {force: :cascade} %> do |t|
|
|
76
76
|
t.string "name", null: false
|
|
77
77
|
end
|
|
78
78
|
|
|
79
|
-
create_table "books", <%= i cond(5.1,
|
|
79
|
+
create_table "books", <%= i cond('>= 5.1',id: :integer) + {force: :cascad} %>e do |t|
|
|
80
80
|
t.string "title", null: false
|
|
81
81
|
t.integer "author_id", null: false
|
|
82
82
|
t.index ["author_id"], name: "idx_author_id", <%= i cond(5.0, using: :btree) %>
|
|
@@ -87,11 +87,11 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
|
87
87
|
|
|
88
88
|
let(:dsl_with_execute) {
|
|
89
89
|
erbh(<<-EOS)
|
|
90
|
-
create_table "authors", <%= i cond(5.1,
|
|
90
|
+
create_table "authors", <%= i cond('>= 5.1',id: :integer) + {force: :cascade} %> do |t|
|
|
91
91
|
t.string "name", null: false
|
|
92
92
|
end
|
|
93
93
|
|
|
94
|
-
create_table "books", <%= i cond(5.1,
|
|
94
|
+
create_table "books", <%= i cond('>= 5.1',id: :integer) + {force: :cascad} %>e do |t|
|
|
95
95
|
t.string "title", null: false
|
|
96
96
|
t.integer "author_id", null: false
|
|
97
97
|
t.index ["author_id"], name: "idx_author_id", <%= i cond(5.0, using: :btree) %>
|
|
@@ -111,7 +111,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
|
111
111
|
it {
|
|
112
112
|
delta = subject.diff(dsl_with_execute)
|
|
113
113
|
expect(delta.differ?).to be_truthy
|
|
114
|
-
expect(subject.dump).to
|
|
114
|
+
expect(subject.dump).to match_ruby dsl
|
|
115
115
|
|
|
116
116
|
expect(show_create_table(:books)).to match_fuzzy erbh(<<-EOS)
|
|
117
117
|
CREATE TABLE `books` (
|
|
@@ -126,7 +126,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
|
126
126
|
|
|
127
127
|
migrated, out = delta.migrate
|
|
128
128
|
expect(migrated).to be_falsey
|
|
129
|
-
expect(subject.dump).to
|
|
129
|
+
expect(subject.dump).to match_ruby dsl
|
|
130
130
|
|
|
131
131
|
expect(show_create_table(:books)).to match_fuzzy erbh(<<-EOS)
|
|
132
132
|
CREATE TABLE `books` (
|
|
@@ -144,11 +144,11 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
|
144
144
|
context 'when execute (noop)' do
|
|
145
145
|
let(:dsl) {
|
|
146
146
|
erbh(<<-EOS)
|
|
147
|
-
create_table "authors", <%= i cond(5.1,
|
|
147
|
+
create_table "authors", <%= i cond('>= 5.1',id: :integer) + {force: :cascade} %> do |t|
|
|
148
148
|
t.string "name", null: false
|
|
149
149
|
end
|
|
150
150
|
|
|
151
|
-
create_table "books", <%= i cond(5.1,
|
|
151
|
+
create_table "books", <%= i cond('>= 5.1',id: :integer) + {force: :cascad} %>e do |t|
|
|
152
152
|
t.string "title", null: false
|
|
153
153
|
t.integer "author_id", null: false
|
|
154
154
|
t.index ["author_id"], name: "idx_author_id", <%= i cond(5.0, using: :btree) %>
|
|
@@ -158,11 +158,11 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
|
158
158
|
|
|
159
159
|
let(:dsl_with_execute) {
|
|
160
160
|
erbh(<<-EOS)
|
|
161
|
-
create_table "authors", <%= i cond(5.1,
|
|
161
|
+
create_table "authors", <%= i cond('>= 5.1',id: :integer) + {force: :cascade} %> do |t|
|
|
162
162
|
t.string "name", null: false
|
|
163
163
|
end
|
|
164
164
|
|
|
165
|
-
create_table "books", <%= i cond(5.1,
|
|
165
|
+
create_table "books", <%= i cond('>= 5.1',id: :integer) + {force: :cascad} %>e do |t|
|
|
166
166
|
t.string "title", null: false
|
|
167
167
|
t.integer "author_id", null: false
|
|
168
168
|
t.index ["author_id"], name: "idx_author_id", <%= i cond(5.0, using: :btree) %>
|
|
@@ -180,7 +180,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
|
180
180
|
it {
|
|
181
181
|
delta = subject.diff(dsl_with_execute)
|
|
182
182
|
expect(delta.differ?).to be_truthy
|
|
183
|
-
expect(subject.dump).to
|
|
183
|
+
expect(subject.dump).to match_ruby dsl
|
|
184
184
|
|
|
185
185
|
expect(show_create_table(:books)).to match_fuzzy erbh(<<-EOS)
|
|
186
186
|
CREATE TABLE `books` (
|
|
@@ -194,7 +194,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
|
194
194
|
|
|
195
195
|
migrated, sql = delta.migrate(:noop => true)
|
|
196
196
|
expect(migrated).to be_truthy
|
|
197
|
-
expect(subject.dump).to
|
|
197
|
+
expect(subject.dump).to match_ruby dsl
|
|
198
198
|
|
|
199
199
|
expect(sql).to match_fuzzy "ALTER TABLE books ADD CONSTRAINT fk_author FOREIGN KEY (author_id) REFERENCES authors (id)"
|
|
200
200
|
|
|
@@ -213,11 +213,11 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
|
213
213
|
context 'when not execute (noop)' do
|
|
214
214
|
let(:dsl) {
|
|
215
215
|
erbh(<<-EOS)
|
|
216
|
-
create_table "authors", <%= i cond(5.1,
|
|
216
|
+
create_table "authors", <%= i cond('>= 5.1',id: :integer) + {force: :cascade} %> do |t|
|
|
217
217
|
t.string "name", null: false
|
|
218
218
|
end
|
|
219
219
|
|
|
220
|
-
create_table "books", <%= i cond(5.1,
|
|
220
|
+
create_table "books", <%= i cond('>= 5.1',id: :integer) + {force: :cascad} %>e do |t|
|
|
221
221
|
t.string "title", null: false
|
|
222
222
|
t.integer "author_id", null: false
|
|
223
223
|
t.index ["author_id"], name: "idx_author_id", <%= i cond(5.0, using: :btree) %>
|
|
@@ -228,11 +228,11 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
|
228
228
|
|
|
229
229
|
let(:dsl_with_execute) {
|
|
230
230
|
erbh(<<-EOS)
|
|
231
|
-
create_table "authors", <%= i cond(5.1,
|
|
231
|
+
create_table "authors", <%= i cond('>= 5.1',id: :integer) + {force: :cascade} %> do |t|
|
|
232
232
|
t.string "name", null: false
|
|
233
233
|
end
|
|
234
234
|
|
|
235
|
-
create_table "books", <%= i cond(5.1,
|
|
235
|
+
create_table "books", <%= i cond('>= 5.1',id: :integer) + {force: :cascad} %>e do |t|
|
|
236
236
|
t.string "title", null: false
|
|
237
237
|
t.integer "author_id", null: false
|
|
238
238
|
t.index ["author_id"], name: "idx_author_id", <%= i cond(5.0, using: :btree) %>
|
|
@@ -252,7 +252,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
|
252
252
|
it {
|
|
253
253
|
delta = subject.diff(dsl_with_execute)
|
|
254
254
|
expect(delta.differ?).to be_truthy
|
|
255
|
-
expect(subject.dump).to
|
|
255
|
+
expect(subject.dump).to match_ruby dsl
|
|
256
256
|
|
|
257
257
|
expect(show_create_table(:books)).to match_fuzzy erbh(<<-EOS)
|
|
258
258
|
CREATE TABLE `books` (
|
|
@@ -267,7 +267,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
|
267
267
|
|
|
268
268
|
migrated, sql = delta.migrate(:noop => true)
|
|
269
269
|
expect(migrated).to be_falsey
|
|
270
|
-
expect(subject.dump).to
|
|
270
|
+
expect(subject.dump).to match_ruby dsl
|
|
271
271
|
|
|
272
272
|
expect(sql).to match_fuzzy ""
|
|
273
273
|
|
|
@@ -113,9 +113,9 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
|
113
113
|
tempfile("#{File.basename __FILE__}.#{$$}") do |path|
|
|
114
114
|
delta = client(log_file: path).diff(expected_dsl)
|
|
115
115
|
expect(delta.differ?).to be_truthy
|
|
116
|
-
expect(client.dump).to
|
|
116
|
+
expect(client.dump).to match_ruby actual_dsl
|
|
117
117
|
delta.migrate
|
|
118
|
-
expect(client.dump).to
|
|
118
|
+
expect(client.dump).to match_ruby expected_dsl
|
|
119
119
|
expect(File.size(path)).to be > 0
|
|
120
120
|
end
|
|
121
121
|
}
|
|
@@ -134,10 +134,10 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
|
134
134
|
it {
|
|
135
135
|
delta = subject.diff(expected_dsl.gsub(/create_table "clubs".+\n\s*t\..+\n\s*end/, ""))
|
|
136
136
|
expect(delta.differ?).to be_truthy
|
|
137
|
-
expect(subject.dump).to
|
|
137
|
+
expect(subject.dump).to match_ruby actual_dsl
|
|
138
138
|
delta.migrate
|
|
139
139
|
# `clubs` table is not deleted
|
|
140
|
-
expect(subject.dump).to
|
|
140
|
+
expect(subject.dump).to match_ruby expected_dsl
|
|
141
141
|
}
|
|
142
142
|
end
|
|
143
143
|
end
|
|
@@ -77,25 +77,25 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
|
77
77
|
expect(delta.differ?).to be_truthy
|
|
78
78
|
migrated, sql = delta.migrate(:noop => true)
|
|
79
79
|
expect(migrated).to be_truthy
|
|
80
|
-
expect(subject.dump).to
|
|
80
|
+
expect(subject.dump).to match_ruby actual_dsl
|
|
81
81
|
|
|
82
82
|
expect(sql).to match_fuzzy erbh(<<-EOS)
|
|
83
|
-
CREATE TABLE `clubs` (`id` <%= cond(5.1,
|
|
83
|
+
CREATE TABLE `clubs` (`id` <%= cond('>= 5.1','bigint NOT NULL', 'int') %> AUTO_INCREMENT PRIMARY KEY, `name` varchar(255) DEFAULT '' NOT NULL) <%= cond('< 5.2.0.beta2', 'ENGINE=InnoDB') %>
|
|
84
84
|
CREATE UNIQUE INDEX `idx_name` USING btree ON `clubs` (`name`)
|
|
85
|
-
CREATE TABLE `departments` (`dept_no` <%= cond(5.1,
|
|
85
|
+
CREATE TABLE `departments` (`dept_no` <%= cond('>= 5.1','bigint NOT NULL', 'int') %> AUTO_INCREMENT PRIMARY KEY, `dept_name` varchar(40) NOT NULL) <%= cond('< 5.2.0.beta2', 'ENGINE=InnoDB') %>
|
|
86
86
|
CREATE UNIQUE INDEX `dept_name` USING btree ON `departments` (`dept_name`)
|
|
87
|
-
CREATE TABLE `dept_emp` (`emp_no` int NOT NULL, `dept_no` varchar(4) NOT NULL, `from_date` date NOT NULL, `to_date` date NOT NULL) ENGINE=InnoDB
|
|
87
|
+
CREATE TABLE `dept_emp` (`emp_no` int NOT NULL, `dept_no` varchar(4) NOT NULL, `from_date` date NOT NULL, `to_date` date NOT NULL) <%= cond('< 5.2.0.beta2', 'ENGINE=InnoDB') %>
|
|
88
88
|
CREATE INDEX `dept_no` USING btree ON `dept_emp` (`dept_no`)
|
|
89
89
|
CREATE INDEX `emp_no` USING btree ON `dept_emp` (`emp_no`)
|
|
90
|
-
CREATE TABLE `dept_manager` (`dept_no` varchar(4) NOT NULL, `emp_no` int NOT NULL, `from_date` date NOT NULL, `to_date` date NOT NULL) ENGINE=InnoDB
|
|
90
|
+
CREATE TABLE `dept_manager` (`dept_no` varchar(4) NOT NULL, `emp_no` int NOT NULL, `from_date` date NOT NULL, `to_date` date NOT NULL) <%= cond('< 5.2.0.beta2', 'ENGINE=InnoDB') %>
|
|
91
91
|
CREATE INDEX `dept_no` USING btree ON `dept_manager` (`dept_no`)
|
|
92
92
|
CREATE INDEX `emp_no` USING btree ON `dept_manager` (`emp_no`)
|
|
93
|
-
CREATE TABLE `employee_clubs` (`id` <%= cond(5.1,
|
|
93
|
+
CREATE TABLE `employee_clubs` (`id` <%= cond('>= 5.1','bigint NOT NULL', 'int') %> AUTO_INCREMENT PRIMARY KEY, `emp_no` int unsigned NOT NULL, `club_id` int unsigned NOT NULL) <%= cond('< 5.2.0.beta2', 'ENGINE=InnoDB') %>
|
|
94
94
|
CREATE INDEX `idx_emp_no_club_id` USING btree ON `employee_clubs` (`emp_no`, `club_id`)
|
|
95
|
-
CREATE TABLE `employees` (`emp_no` <%= cond(5.1,
|
|
96
|
-
CREATE TABLE `salaries` (`emp_no` int NOT NULL, `salary` int NOT NULL, `from_date` date NOT NULL, `to_date` date NOT NULL) ENGINE=InnoDB
|
|
95
|
+
CREATE TABLE `employees` (`emp_no` <%= cond('>= 5.1','bigint NOT NULL', 'int') %> AUTO_INCREMENT PRIMARY KEY, `birth_date` date NOT NULL, `first_name` varchar(14) NOT NULL, `last_name` varchar(16) NOT NULL, `gender` varchar(1) NOT NULL, `hire_date` date NOT NULL) <%= cond('< 5.2.0.beta2', 'ENGINE=InnoDB') %>
|
|
96
|
+
CREATE TABLE `salaries` (`emp_no` int NOT NULL, `salary` int NOT NULL, `from_date` date NOT NULL, `to_date` date NOT NULL) <%= cond('< 5.2.0.beta2', 'ENGINE=InnoDB') %>
|
|
97
97
|
CREATE INDEX `emp_no` USING btree ON `salaries` (`emp_no`)
|
|
98
|
-
CREATE TABLE `titles` (`emp_no` int NOT NULL, `title` varchar(50) NOT NULL, `from_date` date NOT NULL, `to_date` date) ENGINE=InnoDB
|
|
98
|
+
CREATE TABLE `titles` (`emp_no` int NOT NULL, `title` varchar(50) NOT NULL, `from_date` date NOT NULL, `to_date` date) <%= cond('< 5.2.0.beta2', 'ENGINE=InnoDB') %>
|
|
99
99
|
CREATE INDEX `emp_no` USING btree ON `titles` (`emp_no`)
|
|
100
100
|
EOS
|
|
101
101
|
}
|
|
@@ -105,24 +105,24 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
|
105
105
|
expect(delta.differ?).to be_truthy
|
|
106
106
|
migrated, sql = delta.migrate(:noop => true)
|
|
107
107
|
expect(migrated).to be_truthy
|
|
108
|
-
expect(subject.dump).to
|
|
108
|
+
expect(subject.dump).to match_ruby actual_dsl
|
|
109
109
|
|
|
110
110
|
# XXX:
|
|
111
111
|
expect(sql.gsub('`', '')).to match_fuzzy erbh(<<-EOS).gsub('`', '')
|
|
112
|
-
CREATE TABLE `clubs` (`id` <%= cond(5.1,
|
|
112
|
+
CREATE TABLE `clubs` (`id` <%= cond('>= 5.1','bigint NOT NULL', 'int') %> AUTO_INCREMENT PRIMARY KEY, `name` varchar(255) DEFAULT '' NOT NULL) <%= cond('< 5.2.0.beta2', 'ENGINE=InnoDB') %>
|
|
113
113
|
ALTER TABLE `clubs` ADD UNIQUE INDEX `idx_name` USING btree (`name`)
|
|
114
|
-
CREATE TABLE `departments` (`dept_no` <%= cond(5.1,
|
|
114
|
+
CREATE TABLE `departments` (`dept_no` <%= cond('>= 5.1','bigint NOT NULL', 'int') %> AUTO_INCREMENT PRIMARY KEY, `dept_name` varchar(40) NOT NULL) <%= cond('< 5.2.0.beta2', 'ENGINE=InnoDB') %>
|
|
115
115
|
ALTER TABLE `departments` ADD UNIQUE INDEX `dept_name` USING btree (`dept_name`)
|
|
116
|
-
CREATE TABLE `dept_emp` (`emp_no` int NOT NULL, `dept_no` varchar(4) NOT NULL, `from_date` date NOT NULL, `to_date` date NOT NULL) ENGINE=InnoDB
|
|
116
|
+
CREATE TABLE `dept_emp` (`emp_no` int NOT NULL, `dept_no` varchar(4) NOT NULL, `from_date` date NOT NULL, `to_date` date NOT NULL) <%= cond('< 5.2.0.beta2', 'ENGINE=InnoDB') %>
|
|
117
117
|
ALTER TABLE `dept_emp` ADD INDEX `dept_no` USING btree (`dept_no`), ADD INDEX `emp_no` USING btree (`emp_no`)
|
|
118
|
-
CREATE TABLE `dept_manager` (`dept_no` varchar(4) NOT NULL, `emp_no` int NOT NULL, `from_date` date NOT NULL, `to_date` date NOT NULL) ENGINE=InnoDB
|
|
118
|
+
CREATE TABLE `dept_manager` (`dept_no` varchar(4) NOT NULL, `emp_no` int NOT NULL, `from_date` date NOT NULL, `to_date` date NOT NULL) <%= cond('< 5.2.0.beta2', 'ENGINE=InnoDB') %>
|
|
119
119
|
ALTER TABLE `dept_manager` ADD INDEX `dept_no` USING btree (`dept_no`), ADD INDEX `emp_no` USING btree (`emp_no`)
|
|
120
|
-
CREATE TABLE `employee_clubs` (`id` <%= cond(5.1,
|
|
120
|
+
CREATE TABLE `employee_clubs` (`id` <%= cond('>= 5.1','bigint NOT NULL', 'int') %> AUTO_INCREMENT PRIMARY KEY, `emp_no` int unsigned NOT NULL, `club_id` int unsigned NOT NULL) <%= cond('< 5.2.0.beta2', 'ENGINE=InnoDB') %>
|
|
121
121
|
ALTER TABLE `employee_clubs` ADD INDEX `idx_emp_no_club_id` USING btree (`emp_no`, `club_id`)
|
|
122
|
-
CREATE TABLE `employees` (`emp_no` <%= cond(5.1,
|
|
123
|
-
CREATE TABLE `salaries` (`emp_no` int NOT NULL, `salary` int NOT NULL, `from_date` date NOT NULL, `to_date` date NOT NULL) ENGINE=InnoDB
|
|
122
|
+
CREATE TABLE `employees` (`emp_no` <%= cond('>= 5.1','bigint NOT NULL', 'int') %> AUTO_INCREMENT PRIMARY KEY, `birth_date` date NOT NULL, `first_name` varchar(14) NOT NULL, `last_name` varchar(16) NOT NULL, `gender` varchar(1) NOT NULL, `hire_date` date NOT NULL) <%= cond('< 5.2.0.beta2', 'ENGINE=InnoDB') %>
|
|
123
|
+
CREATE TABLE `salaries` (`emp_no` int NOT NULL, `salary` int NOT NULL, `from_date` date NOT NULL, `to_date` date NOT NULL) <%= cond('< 5.2.0.beta2', 'ENGINE=InnoDB') %>
|
|
124
124
|
ALTER TABLE `salaries` ADD INDEX `emp_no` USING btree (`emp_no`)
|
|
125
|
-
CREATE TABLE `titles` (`emp_no` int NOT NULL, `title` varchar(50) NOT NULL, `from_date` date NOT NULL, `to_date` date) ENGINE=InnoDB
|
|
125
|
+
CREATE TABLE `titles` (`emp_no` int NOT NULL, `title` varchar(50) NOT NULL, `from_date` date NOT NULL, `to_date` date) <%= cond('< 5.2.0.beta2', 'ENGINE=InnoDB') %>
|
|
126
126
|
ALTER TABLE `titles` ADD INDEX `emp_no` USING btree (`emp_no`)
|
|
127
127
|
EOS
|
|
128
128
|
}
|
|
@@ -206,25 +206,25 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
|
206
206
|
expect(delta.differ?).to be_truthy
|
|
207
207
|
migrated, sql = delta.migrate(:noop => true)
|
|
208
208
|
expect(migrated).to be_truthy
|
|
209
|
-
expect(subject.dump).to
|
|
209
|
+
expect(subject.dump).to match_ruby actual_dsl
|
|
210
210
|
|
|
211
211
|
expect(sql).to match_fuzzy erbh(<<-EOS)
|
|
212
|
-
CREATE TABLE `clubs` (`id` <%= cond(5.1,
|
|
212
|
+
CREATE TABLE `clubs` (`id` <%= cond('>= 5.1','bigint NOT NULL', 'int') %> AUTO_INCREMENT PRIMARY KEY, `name` varchar(255) DEFAULT '' NOT NULL) <%= cond('< 5.2.0.beta2', 'ENGINE=InnoDB') %>
|
|
213
213
|
CREATE UNIQUE INDEX `idx_name` USING btree ON `clubs` (`name`)
|
|
214
|
-
CREATE TABLE `departments` (`dept_no` <%= cond(5.1,
|
|
214
|
+
CREATE TABLE `departments` (`dept_no` <%= cond('>= 5.1','bigint NOT NULL', 'int') %> AUTO_INCREMENT PRIMARY KEY, `dept_name` varchar(40) NOT NULL) <%= cond('< 5.2.0.beta2', 'ENGINE=InnoDB') %>
|
|
215
215
|
CREATE UNIQUE INDEX `dept_name` USING btree ON `departments` (`dept_name`)
|
|
216
|
-
CREATE TABLE `dept_emp` (`emp_no` int NOT NULL, `dept_no` varchar(4) NOT NULL, `from_date` date NOT NULL, `to_date` date NOT NULL) ENGINE=InnoDB
|
|
216
|
+
CREATE TABLE `dept_emp` (`emp_no` int NOT NULL, `dept_no` varchar(4) NOT NULL, `from_date` date NOT NULL, `to_date` date NOT NULL) <%= cond('< 5.2.0.beta2', 'ENGINE=InnoDB') %>
|
|
217
217
|
CREATE INDEX `dept_no` USING btree ON `dept_emp` (`dept_no`)
|
|
218
218
|
CREATE INDEX `emp_no` USING btree ON `dept_emp` (`emp_no`)
|
|
219
|
-
CREATE TABLE `dept_manager` (`dept_no` varchar(4) NOT NULL, `emp_no` int NOT NULL, `from_date` date NOT NULL, `to_date` date NOT NULL) ENGINE=InnoDB
|
|
219
|
+
CREATE TABLE `dept_manager` (`dept_no` varchar(4) NOT NULL, `emp_no` int NOT NULL, `from_date` date NOT NULL, `to_date` date NOT NULL) <%= cond('< 5.2.0.beta2', 'ENGINE=InnoDB') %>
|
|
220
220
|
CREATE INDEX `dept_no` USING btree ON `dept_manager` (`dept_no`)
|
|
221
221
|
CREATE INDEX `emp_no` USING btree ON `dept_manager` (`emp_no`)
|
|
222
|
-
CREATE TABLE `employee_clubs` (`id` <%= cond(5.1,
|
|
222
|
+
CREATE TABLE `employee_clubs` (`id` <%= cond('>= 5.1','bigint NOT NULL', 'int') %> AUTO_INCREMENT PRIMARY KEY, `emp_no` int unsigned NOT NULL, `club_id` int unsigned NOT NULL) <%= cond('< 5.2.0.beta2', 'ENGINE=InnoDB') %>
|
|
223
223
|
CREATE INDEX `idx_emp_no_club_id` USING btree ON `employee_clubs` (`emp_no`, `club_id`)
|
|
224
|
-
CREATE TABLE `employees` (`emp_no` <%= cond(5.1,
|
|
225
|
-
CREATE TABLE `salaries` (`emp_no` int NOT NULL, `salary` int NOT NULL, `from_date` date NOT NULL, `to_date` date NOT NULL) ENGINE=InnoDB
|
|
224
|
+
CREATE TABLE `employees` (`emp_no` <%= cond('>= 5.1','bigint NOT NULL', 'int') %> AUTO_INCREMENT PRIMARY KEY, `birth_date` date NOT NULL, `first_name` varchar(14) NOT NULL, `last_name` varchar(16) NOT NULL, `gender` varchar(1) NOT NULL, `hire_date` date NOT NULL) <%= cond('< 5.2.0.beta2', 'ENGINE=InnoDB') %>
|
|
225
|
+
CREATE TABLE `salaries` (`emp_no` int NOT NULL, `salary` int NOT NULL, `from_date` date NOT NULL, `to_date` date NOT NULL) <%= cond('< 5.2.0.beta2', 'ENGINE=InnoDB') %>
|
|
226
226
|
CREATE INDEX `emp_no` USING btree ON `salaries` (`emp_no`)
|
|
227
|
-
CREATE TABLE `titles` (`emp_no` int NOT NULL, `title` varchar(50) NOT NULL, `from_date` date NOT NULL, `to_date` date) ENGINE=InnoDB
|
|
227
|
+
CREATE TABLE `titles` (`emp_no` int NOT NULL, `title` varchar(50) NOT NULL, `from_date` date NOT NULL, `to_date` date) <%= cond('< 5.2.0.beta2', 'ENGINE=InnoDB') %>
|
|
228
228
|
CREATE INDEX `emp_no` USING btree ON `titles` (`emp_no`)
|
|
229
229
|
EOS
|
|
230
230
|
}
|
|
@@ -28,7 +28,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
|
28
28
|
delta = subject.diff(expected_dsl)
|
|
29
29
|
expect(delta.differ?).to be_falsey
|
|
30
30
|
delta.migrate
|
|
31
|
-
expect(subject.dump).to
|
|
31
|
+
expect(subject.dump).to match_ruby actual_dsl
|
|
32
32
|
}
|
|
33
33
|
end
|
|
34
34
|
|
|
@@ -51,7 +51,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
|
51
51
|
delta = subject.diff(expected_dsl)
|
|
52
52
|
expect(delta.differ?).to be_truthy
|
|
53
53
|
delta.migrate
|
|
54
|
-
expect(subject.dump).to
|
|
54
|
+
expect(subject.dump).to match_ruby expected_dsl
|
|
55
55
|
}
|
|
56
56
|
end
|
|
57
57
|
end
|
|
@@ -130,15 +130,15 @@ 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
|
|
133
|
+
expect(subject.dump).to match_ruby actual_dsl
|
|
134
134
|
delta.migrate
|
|
135
|
-
expect(subject.dump).to
|
|
135
|
+
expect(subject.dump).to match_ruby expected_dsl.gsub(/\s*,\s*renamed_from:.*$/, '')
|
|
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
|
|
141
|
+
expect(subject.dump).to match_ruby actual_dsl
|
|
142
142
|
expect(delta.script).to match_fuzzy <<-EOS
|
|
143
143
|
change_table("dept_emp", {:bulk => true}) do |t|
|
|
144
144
|
t.rename("from_date", "from_date2")
|
|
@@ -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
|
|
156
|
+
expect(subject.dump).to match_ruby expected_dsl.gsub(/\s*,\s*renamed_from:.*$/, '')
|
|
157
157
|
}
|
|
158
158
|
end
|
|
159
159
|
|
|
@@ -130,9 +130,9 @@ 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
|
|
133
|
+
expect(subject.dump).to match_ruby actual_dsl
|
|
134
134
|
delta.migrate
|
|
135
|
-
expect(subject.dump).to
|
|
135
|
+
expect(subject.dump).to match_ruby expected_dsl.gsub(/, renamed_from: ('employees'|:titles)/, '')
|
|
136
136
|
}
|
|
137
137
|
end
|
|
138
138
|
|
|
@@ -187,9 +187,9 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
|
187
187
|
it {
|
|
188
188
|
delta = subject.diff(expected_dsl)
|
|
189
189
|
expect(delta.differ?).to be_truthy
|
|
190
|
-
expect(subject.dump).to
|
|
190
|
+
expect(subject.dump).to match_ruby actual_dsl
|
|
191
191
|
delta.migrate(noop: true)
|
|
192
|
-
expect(subject.dump).to
|
|
192
|
+
expect(subject.dump).to match_ruby actual_dsl
|
|
193
193
|
}
|
|
194
194
|
end
|
|
195
195
|
|