ridgepole 0.6.6 → 0.7.0.alpha
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 +2 -7
- data/Appraisals +4 -5
- data/README.md +3 -0
- data/gemfiles/activerecord_5.0.gemfile +1 -1
- data/gemfiles/{activerecord_4.2.gemfile → activerecord_5.1.gemfile} +1 -2
- data/lib/ridgepole.rb +1 -0
- data/lib/ridgepole/client.rb +1 -3
- data/lib/ridgepole/connection_adapters.rb +11 -0
- data/lib/ridgepole/delta.rb +5 -0
- data/lib/ridgepole/diff.rb +5 -10
- data/lib/ridgepole/dsl_parser/context.rb +1 -4
- data/lib/ridgepole/dumper.rb +0 -11
- data/lib/ridgepole/schema_statements_ext.rb +1 -1
- data/lib/ridgepole/version.rb +1 -1
- data/ridgepole.gemspec +2 -2
- data/ridgepole.iml +9 -0
- data/spec/erb_helper.rb +25 -15
- data/spec/mysql/bigint_pk/bigint_pk_spec.rb +15 -15
- data/spec/mysql/bigint_pk/int_pk_spec.rb +45 -0
- data/spec/mysql/cli/config_spec.rb +7 -7
- data/spec/mysql/cli/ridgepole_spec.rb +20 -20
- data/spec/mysql/collation/collation_spec.rb +40 -41
- data/spec/mysql/comment/comment_spec.rb +19 -19
- data/spec/mysql/default_lambda/default_lambda_spec.rb +3 -3
- data/spec/mysql/diff/diff2_spec.rb +8 -5
- data/spec/mysql/diff/diff_spec.rb +8 -5
- data/spec/mysql/dump/dump_class_method_spec.rb +18 -68
- data/spec/mysql/dump/dump_some_tables_spec.rb +10 -30
- data/spec/mysql/dump/dump_spec.rb +21 -54
- data/spec/mysql/dump/dump_without_table_options_spec.rb +8 -35
- data/spec/mysql/fk/migrate_change_fk_spec.rb +8 -8
- data/spec/mysql/fk/migrate_create_fk_spec.rb +21 -35
- data/spec/mysql/fk/migrate_drop_fk_spec.rb +16 -30
- data/spec/mysql/migrate/migrate_add_column2_spec.rb +3 -5
- data/spec/mysql/migrate/migrate_add_column_order_spec.rb +21 -39
- data/spec/mysql/migrate/migrate_change_column5_spec.rb +8 -8
- data/spec/mysql/migrate/migrate_change_column6_spec.rb +18 -18
- data/spec/mysql/migrate/migrate_change_column_default_spec.rb +23 -16
- data/spec/mysql/migrate/migrate_change_column_spec.rb +34 -34
- data/spec/mysql/migrate/migrate_change_index3_spec.rb +19 -9
- data/spec/mysql/migrate/migrate_create_index_spec.rb +32 -32
- data/spec/mysql/migrate/migrate_create_table_spec.rb +0 -9
- data/spec/mysql/migrate/migrate_drop_index_spec.rb +32 -32
- data/spec/mysql/migrate/migrate_drop_table_spec.rb +30 -30
- data/spec/mysql/migrate/migrate_execute_spec.rb +68 -81
- data/spec/mysql/migrate/migrate_merge_mode_spec.rb +1 -3
- data/spec/mysql/migrate/migrate_noop_spec.rb +34 -61
- data/spec/mysql/migrate/migrate_rename_table_spec.rb +3 -24
- data/spec/mysql/migrate/migrate_same_spec.rb +12 -45
- data/spec/mysql/migrate/migrate_with_ignore_tables_spec.rb +6 -6
- data/spec/mysql/migrate/migrate_with_tables_spec.rb +2 -2
- data/spec/mysql/migrate/migrate_with_verbose_log_spec.rb +1 -6
- data/spec/mysql/migrate_/migrate_drop_index_with_alter_spec.rb +10 -10
- data/spec/mysql/text_blob_types/text_blob_types_spec.rb +3 -3
- data/spec/mysql/~default_name_fk/migrate_change_fk_spec.rb +6 -6
- data/spec/mysql/~default_name_fk/migrate_create_fk_spec.rb +10 -10
- data/spec/mysql/~default_name_fk/migrate_drop_fk_spec.rb +6 -6
- data/spec/postgresql/diff/diff_spec.rb +6 -0
- data/spec/postgresql/dump/dump_spec.rb +9 -33
- data/spec/postgresql/migrate/migrate_add_expression_index_spec.rb +3 -3
- data/spec/postgresql/migrate/migrate_bigint_spec.rb +10 -26
- data/spec/postgresql/migrate/migrate_create_table_spec.rb +0 -9
- data/spec/postgresql/migrate/migrate_create_table_with_default_proc_spec.rb +1 -1
- data/spec/postgresql/migrate/migrate_drop_column_with_index_spec.rb +2 -2
- data/spec/postgresql/migrate/migrate_drop_expression_index_spec.rb +7 -7
- data/spec/postgresql/migrate/migrate_drop_index_spec.rb +4 -4
- data/spec/postgresql/migrate/migrate_drop_table_spec.rb +3 -3
- data/spec/postgresql/migrate/migrate_ext_cols_spec.rb +0 -3
- data/spec/postgresql/migrate/migrate_same_spec.rb +9 -33
- data/spec/spec_condition.rb +15 -6
- data/spec/spec_helper.rb +2 -15
- metadata +14 -10
@@ -7,7 +7,7 @@ describe 'ridgepole' do
|
|
7
7
|
end
|
8
8
|
|
9
9
|
context 'when help' do
|
10
|
-
|
10
|
+
specify do
|
11
11
|
out, status = run_cli(:args => ['-h'])
|
12
12
|
out = out.gsub(/Usage: .*\n/, '')
|
13
13
|
|
@@ -55,7 +55,7 @@ describe 'ridgepole' do
|
|
55
55
|
end
|
56
56
|
|
57
57
|
context 'when export' do
|
58
|
-
|
58
|
+
specify 'not split' do
|
59
59
|
out, status = run_cli(:args => ['-c', conf, '-e', conf, conf])
|
60
60
|
|
61
61
|
expect(status.success?).to be_truthy
|
@@ -66,7 +66,7 @@ describe 'ridgepole' do
|
|
66
66
|
EOS
|
67
67
|
end
|
68
68
|
|
69
|
-
|
69
|
+
specify 'not split with outfile' do
|
70
70
|
Tempfile.open("#{File.basename __FILE__}.#{$$}") do |f|
|
71
71
|
out, status = run_cli(:args => ['-c', conf, '-e', '-o', f.path])
|
72
72
|
|
@@ -79,7 +79,7 @@ describe 'ridgepole' do
|
|
79
79
|
end
|
80
80
|
end
|
81
81
|
|
82
|
-
|
82
|
+
specify 'not split with output stdout' do
|
83
83
|
out, status = run_cli(:args => ['-c', conf, '-e', '-o', '-'])
|
84
84
|
|
85
85
|
expect(status.success?).to be_truthy
|
@@ -90,7 +90,7 @@ describe 'ridgepole' do
|
|
90
90
|
EOS
|
91
91
|
end
|
92
92
|
|
93
|
-
|
93
|
+
specify 'split' do
|
94
94
|
out, status = run_cli(:args => ['-c', conf, '-e', '--split'])
|
95
95
|
|
96
96
|
expect(status.success?).to be_truthy
|
@@ -102,7 +102,7 @@ describe 'ridgepole' do
|
|
102
102
|
EOS
|
103
103
|
end
|
104
104
|
|
105
|
-
|
105
|
+
specify 'split with outdir' do
|
106
106
|
Tempfile.open("#{File.basename __FILE__}.#{$$}") do |f|
|
107
107
|
out, status = run_cli(:args => ['-c', conf, '-e', '--split', '-o', f.path, conf, conf])
|
108
108
|
|
@@ -118,7 +118,7 @@ describe 'ridgepole' do
|
|
118
118
|
end
|
119
119
|
|
120
120
|
context 'when apply' do
|
121
|
-
|
121
|
+
specify 'apply' do
|
122
122
|
out, status = run_cli(:args => ['-c', conf, '-a'])
|
123
123
|
|
124
124
|
expect(status.success?).to be_truthy
|
@@ -132,7 +132,7 @@ describe 'ridgepole' do
|
|
132
132
|
EOS
|
133
133
|
end
|
134
134
|
|
135
|
-
|
135
|
+
specify 'apply with conf file' do
|
136
136
|
Tempfile.open(["#{File.basename __FILE__}.#{$$}", '.yml']) do |conf_file|
|
137
137
|
conf_file.puts <<-EOS
|
138
138
|
adapter: mysql2
|
@@ -154,7 +154,7 @@ describe 'ridgepole' do
|
|
154
154
|
end
|
155
155
|
end
|
156
156
|
|
157
|
-
|
157
|
+
specify 'apply with conf file (production)' do
|
158
158
|
Tempfile.open(["#{File.basename __FILE__}.#{$$}", '.yml']) do |conf_file|
|
159
159
|
conf_file.puts <<-EOS
|
160
160
|
development:
|
@@ -180,7 +180,7 @@ describe 'ridgepole' do
|
|
180
180
|
end
|
181
181
|
end
|
182
182
|
|
183
|
-
|
183
|
+
specify 'dry-run' do
|
184
184
|
out, status = run_cli(:args => ['-c', conf, '-a', '--dry-run'])
|
185
185
|
|
186
186
|
expect(status.success?).to be_truthy
|
@@ -196,7 +196,7 @@ describe 'ridgepole' do
|
|
196
196
|
context 'when differ true' do
|
197
197
|
let(:differ) { true }
|
198
198
|
|
199
|
-
|
199
|
+
specify 'apply' do
|
200
200
|
out, status = run_cli(:args => ['-c', conf, '-a'])
|
201
201
|
|
202
202
|
expect(status.success?).to be_truthy
|
@@ -209,7 +209,7 @@ describe 'ridgepole' do
|
|
209
209
|
EOS
|
210
210
|
end
|
211
211
|
|
212
|
-
|
212
|
+
specify 'dry-run' do
|
213
213
|
out, status = run_cli(:args => ['-c', conf, '-a', '--dry-run'])
|
214
214
|
|
215
215
|
expect(status.success?).to be_truthy
|
@@ -232,7 +232,7 @@ describe 'ridgepole' do
|
|
232
232
|
end
|
233
233
|
|
234
234
|
context 'when diff' do
|
235
|
-
|
235
|
+
specify do
|
236
236
|
out, status = run_cli(:args => ['-c', conf, '-d', conf, conf])
|
237
237
|
|
238
238
|
expect(status.success?).to be_truthy
|
@@ -246,7 +246,7 @@ describe 'ridgepole' do
|
|
246
246
|
context 'when differ true' do
|
247
247
|
let(:differ) { true }
|
248
248
|
|
249
|
-
|
249
|
+
specify do
|
250
250
|
out, status = run_cli(:args => ['-c', conf, '-d', conf, conf])
|
251
251
|
|
252
252
|
# Exit code 1 if there is a difference
|
@@ -269,7 +269,7 @@ describe 'ridgepole' do
|
|
269
269
|
end
|
270
270
|
|
271
271
|
context 'when config file' do
|
272
|
-
|
272
|
+
specify '.yml' do
|
273
273
|
Tempfile.open(["#{File.basename __FILE__}.#{$$}", '.yml']) do |conf_file|
|
274
274
|
conf_file.puts <<-EOS
|
275
275
|
adapter: mysql2
|
@@ -289,7 +289,7 @@ describe 'ridgepole' do
|
|
289
289
|
end
|
290
290
|
end
|
291
291
|
|
292
|
-
|
292
|
+
specify '.yml (file2)' do
|
293
293
|
Tempfile.open(["#{File.basename __FILE__}.#{$$}", '.yml']) do |conf_file|
|
294
294
|
conf_file.puts <<-EOS
|
295
295
|
adapter: mysql2
|
@@ -309,7 +309,7 @@ describe 'ridgepole' do
|
|
309
309
|
end
|
310
310
|
end
|
311
311
|
|
312
|
-
|
312
|
+
specify '.yml (development)' do
|
313
313
|
Tempfile.open(["#{File.basename __FILE__}.#{$$}", '.yml']) do |conf_file|
|
314
314
|
conf_file.puts <<-EOS
|
315
315
|
development:
|
@@ -333,7 +333,7 @@ describe 'ridgepole' do
|
|
333
333
|
end
|
334
334
|
end
|
335
335
|
|
336
|
-
|
336
|
+
specify '.yml (production)' do
|
337
337
|
Tempfile.open(["#{File.basename __FILE__}.#{$$}", '.yml']) do |conf_file|
|
338
338
|
conf_file.puts <<-EOS
|
339
339
|
development:
|
@@ -357,7 +357,7 @@ describe 'ridgepole' do
|
|
357
357
|
end
|
358
358
|
end
|
359
359
|
|
360
|
-
|
360
|
+
specify '.yaml' do
|
361
361
|
Tempfile.open(["#{File.basename __FILE__}.#{$$}", '.yaml']) do |conf_file|
|
362
362
|
conf_file.puts <<-EOS
|
363
363
|
adapter: mysql2
|
@@ -377,7 +377,7 @@ describe 'ridgepole' do
|
|
377
377
|
end
|
378
378
|
end
|
379
379
|
|
380
|
-
|
380
|
+
specify '.rb' do
|
381
381
|
Tempfile.open(["#{File.basename __FILE__}.#{$$}", '.rb']) do |conf_file|
|
382
382
|
conf_file.puts <<-EOS
|
383
383
|
create_table :table do
|
@@ -1,23 +1,23 @@
|
|
1
|
-
describe 'Ridgepole::Client#diff -> migrate'
|
1
|
+
describe 'Ridgepole::Client#diff -> migrate' do
|
2
2
|
context 'when change column (add collation)' do
|
3
3
|
let(:actual_dsl) {
|
4
4
|
erbh(<<-EOS)
|
5
|
-
create_table "employee_clubs", unsigned: true, force: :cascade do |t|
|
6
|
-
t.integer "emp_no",
|
7
|
-
t.integer "club_id",
|
8
|
-
t.string "string",
|
9
|
-
t.text "text", limit: 65535
|
5
|
+
create_table "employee_clubs", <%= i cond('5.1.', id: :bigint) %>, unsigned: true, force: :cascade do |t|
|
6
|
+
t.integer "emp_no", null: false
|
7
|
+
t.integer "club_id", null: false, unsigned: true
|
8
|
+
t.string "string", null: false, collation: "ascii_bin"
|
9
|
+
t.text "text", <%= i cond('5.0.', limit: 65535) %>, null: false
|
10
10
|
end
|
11
11
|
EOS
|
12
12
|
}
|
13
13
|
|
14
14
|
let(:expected_dsl) {
|
15
15
|
erbh(<<-EOS)
|
16
|
-
create_table "employee_clubs", unsigned: true, force: :cascade do |t|
|
17
|
-
t.integer "emp_no",
|
18
|
-
t.integer "club_id",
|
19
|
-
t.string "string",
|
20
|
-
t.text "text", limit: 65535
|
16
|
+
create_table "employee_clubs", <%= i cond('5.1.', id: :bigint) %>, unsigned: true, force: :cascade do |t|
|
17
|
+
t.integer "emp_no", null: false
|
18
|
+
t.integer "club_id", null: false, unsigned: true
|
19
|
+
t.string "string", null: false, collation: "ascii_bin"
|
20
|
+
t.text "text", <%= i cond('5.0.', limit: 65535) %>, null: false, collation: "utf8mb4_bin"
|
21
21
|
end
|
22
22
|
EOS
|
23
23
|
}
|
@@ -25,7 +25,7 @@ describe 'Ridgepole::Client#diff -> migrate', condition: [:mysql_awesome_enabled
|
|
25
25
|
before { subject.diff(actual_dsl).migrate }
|
26
26
|
subject { client }
|
27
27
|
|
28
|
-
|
28
|
+
specify {
|
29
29
|
delta = subject.diff(expected_dsl)
|
30
30
|
expect(delta.differ?).to be_truthy
|
31
31
|
expect(subject.dump).to match_fuzzy actual_dsl
|
@@ -37,22 +37,22 @@ describe 'Ridgepole::Client#diff -> migrate', condition: [:mysql_awesome_enabled
|
|
37
37
|
context 'when change column (delete collation)' do
|
38
38
|
let(:actual_dsl) {
|
39
39
|
erbh(<<-EOS)
|
40
|
-
create_table "employee_clubs", unsigned: true, force: :cascade do |t|
|
41
|
-
t.integer "emp_no",
|
42
|
-
t.integer "club_id",
|
43
|
-
t.string "string",
|
44
|
-
t.text "text", limit: 65535
|
40
|
+
create_table "employee_clubs", <%= i cond('5.1.', id: :bigint) %>, unsigned: true, force: :cascade do |t|
|
41
|
+
t.integer "emp_no", null: false
|
42
|
+
t.integer "club_id", null: false, unsigned: true
|
43
|
+
t.string "string", null: false, collation: "ascii_bin"
|
44
|
+
t.text "text", <%= i cond('5.0.', limit: 65535) %>, null: false, collation: "utf8mb4_bin"
|
45
45
|
end
|
46
46
|
EOS
|
47
47
|
}
|
48
48
|
|
49
49
|
let(:expected_dsl) {
|
50
50
|
erbh(<<-EOS)
|
51
|
-
create_table "employee_clubs", unsigned: true, force: :cascade do |t|
|
52
|
-
t.integer "emp_no",
|
53
|
-
t.integer "club_id",
|
54
|
-
t.string "string",
|
55
|
-
t.text "text", limit: 65535
|
51
|
+
create_table "employee_clubs", <%= i cond('5.1.', id: :bigint) %>, unsigned: true, force: :cascade do |t|
|
52
|
+
t.integer "emp_no", null: false
|
53
|
+
t.integer "club_id", null: false, unsigned: true
|
54
|
+
t.string "string", null: false, collation: "ascii_bin"
|
55
|
+
t.text "text", <%= i cond('5.0.', limit: 65535) %>, null: false
|
56
56
|
end
|
57
57
|
EOS
|
58
58
|
}
|
@@ -60,7 +60,7 @@ describe 'Ridgepole::Client#diff -> migrate', condition: [:mysql_awesome_enabled
|
|
60
60
|
before { subject.diff(actual_dsl).migrate }
|
61
61
|
subject { client }
|
62
62
|
|
63
|
-
|
63
|
+
specify {
|
64
64
|
delta = subject.diff(expected_dsl)
|
65
65
|
expect(delta.differ?).to be_truthy
|
66
66
|
expect(subject.dump).to match_fuzzy actual_dsl
|
@@ -72,22 +72,22 @@ describe 'Ridgepole::Client#diff -> migrate', condition: [:mysql_awesome_enabled
|
|
72
72
|
context 'when change column (change collation)' do
|
73
73
|
let(:actual_dsl) {
|
74
74
|
erbh(<<-EOS)
|
75
|
-
create_table "employee_clubs", unsigned: true, force: :cascade do |t|
|
76
|
-
t.integer "emp_no",
|
77
|
-
t.integer "club_id",
|
78
|
-
t.string "string",
|
79
|
-
t.text "text", limit: 65535
|
75
|
+
create_table "employee_clubs", <%= i cond('5.1.', id: :bigint) %>, unsigned: true, force: :cascade do |t|
|
76
|
+
t.integer "emp_no", null: false
|
77
|
+
t.integer "club_id", null: false, unsigned: true
|
78
|
+
t.string "string", null: false, collation: "ascii_bin"
|
79
|
+
t.text "text", <%= i cond('5.0.', limit: 65535) %>, null: false, collation: "utf8mb4_bin"
|
80
80
|
end
|
81
81
|
EOS
|
82
82
|
}
|
83
83
|
|
84
84
|
let(:expected_dsl) {
|
85
85
|
erbh(<<-EOS)
|
86
|
-
create_table "employee_clubs", unsigned: true, force: :cascade do |t|
|
87
|
-
t.integer "emp_no",
|
88
|
-
t.integer "club_id",
|
86
|
+
create_table "employee_clubs", <%= i cond('5.1.', id: :bigint) %>, unsigned: true, force: :cascade do |t|
|
87
|
+
t.integer "emp_no", null: false
|
88
|
+
t.integer "club_id", null: false, unsigned: true
|
89
89
|
t.string "string", <%= i limit(255) + {null: false, collation: "utf8mb4_bin"} %>
|
90
|
-
t.text "text", limit: 65535
|
90
|
+
t.text "text", <%= i cond('5.0.', limit: 65535) %>, null: false, collation: "ascii_bin"
|
91
91
|
end
|
92
92
|
EOS
|
93
93
|
}
|
@@ -95,7 +95,7 @@ describe 'Ridgepole::Client#diff -> migrate', condition: [:mysql_awesome_enabled
|
|
95
95
|
before { subject.diff(actual_dsl).migrate }
|
96
96
|
subject { client }
|
97
97
|
|
98
|
-
|
98
|
+
specify {
|
99
99
|
delta = subject.diff(expected_dsl)
|
100
100
|
expect(delta.differ?).to be_truthy
|
101
101
|
expect(subject.dump).to match_fuzzy actual_dsl
|
@@ -107,11 +107,11 @@ describe 'Ridgepole::Client#diff -> migrate', condition: [:mysql_awesome_enabled
|
|
107
107
|
context 'when change column (no change collation)' do
|
108
108
|
let(:actual_dsl) {
|
109
109
|
erbh(<<-EOS)
|
110
|
-
create_table "employee_clubs", unsigned: true, force: :cascade do |t|
|
111
|
-
t.integer "emp_no",
|
112
|
-
t.integer "club_id",
|
113
|
-
t.string "string",
|
114
|
-
t.text "text", limit: 65535
|
110
|
+
create_table "employee_clubs", <%= i cond('5.1.', id: :bigint) %>, unsigned: true, force: :cascade do |t|
|
111
|
+
t.integer "emp_no", null: false
|
112
|
+
t.integer "club_id", null: false, unsigned: true
|
113
|
+
t.string "string", null: false, collation: "ascii_bin"
|
114
|
+
t.text "text", <%= i cond('5.0.', limit: 65535) %>, null: false, collation: "utf8mb4_bin"
|
115
115
|
end
|
116
116
|
EOS
|
117
117
|
}
|
@@ -119,7 +119,7 @@ describe 'Ridgepole::Client#diff -> migrate', condition: [:mysql_awesome_enabled
|
|
119
119
|
before { subject.diff(actual_dsl).migrate }
|
120
120
|
subject { client }
|
121
121
|
|
122
|
-
|
122
|
+
specify {
|
123
123
|
delta = subject.diff(actual_dsl)
|
124
124
|
expect(delta.differ?).to be_falsey
|
125
125
|
expect(subject.dump).to match_fuzzy actual_dsl
|
@@ -128,13 +128,12 @@ describe 'Ridgepole::Client#diff -> migrate', condition: [:mysql_awesome_enabled
|
|
128
128
|
}
|
129
129
|
|
130
130
|
describe '#diff' do
|
131
|
-
|
131
|
+
specify {
|
132
132
|
Tempfile.open("#{File.basename __FILE__}.#{$$}") do |f|
|
133
133
|
f.puts(actual_dsl)
|
134
134
|
f.flush
|
135
135
|
|
136
136
|
opts = ['--dump-without-table-options']
|
137
|
-
opts << '--enable-mysql-awesome' if condition(:mysql_awesome_enabled)
|
138
137
|
out, status = run_ridgepole('--diff', "'#{JSON.dump(conn_spec)}'", f.path, *opts)
|
139
138
|
|
140
139
|
expect(out).to be_empty
|
@@ -1,23 +1,23 @@
|
|
1
|
-
describe 'Ridgepole::Client#diff -> migrate'
|
1
|
+
describe 'Ridgepole::Client#diff -> migrate' do
|
2
2
|
context 'when change column (add comment)' do
|
3
3
|
let(:actual_dsl) {
|
4
|
-
<<-EOS
|
4
|
+
erbh(<<-EOS)
|
5
5
|
create_table "employee_clubs", force: :cascade do |t|
|
6
6
|
t.integer "emp_no", null: false
|
7
7
|
t.integer "club_id", null: false
|
8
8
|
t.string "string", null: false
|
9
|
-
t.text "text", limit: 65535
|
9
|
+
t.text "text", <%= i cond('5.0.', limit: 65535) %>, null: false
|
10
10
|
end
|
11
11
|
EOS
|
12
12
|
}
|
13
13
|
|
14
14
|
let(:expected_dsl) {
|
15
|
-
<<-EOS
|
15
|
+
erbh(<<-EOS)
|
16
16
|
create_table "employee_clubs", force: :cascade do |t|
|
17
17
|
t.integer "emp_no", null: false, comment: "any comment"
|
18
18
|
t.integer "club_id", null: false, comment: "any comment2"
|
19
19
|
t.string "string", null: false, comment: "any comment3"
|
20
|
-
t.text "text", limit: 65535
|
20
|
+
t.text "text", <%= i cond('5.0.', limit: 65535) %>, null: false, comment: "any comment4"
|
21
21
|
end
|
22
22
|
EOS
|
23
23
|
}
|
@@ -36,23 +36,23 @@ describe 'Ridgepole::Client#diff -> migrate', condition: [:activerecord_5] do
|
|
36
36
|
|
37
37
|
context 'when change column (delete comment)' do
|
38
38
|
let(:actual_dsl) {
|
39
|
-
<<-EOS
|
39
|
+
erbh(<<-EOS)
|
40
40
|
create_table "employee_clubs", force: :cascade do |t|
|
41
41
|
t.integer "emp_no", null: false, comment: "any comment"
|
42
42
|
t.integer "club_id", null: false, comment: "any comment2"
|
43
43
|
t.string "string", null: false, comment: "any comment3"
|
44
|
-
t.text "text", limit: 65535
|
44
|
+
t.text "text", <%= i cond('5.0.', limit: 65535) %>, null: false, comment: "any comment4"
|
45
45
|
end
|
46
46
|
EOS
|
47
47
|
}
|
48
48
|
|
49
49
|
let(:expected_dsl) {
|
50
|
-
<<-EOS
|
50
|
+
erbh(<<-EOS)
|
51
51
|
create_table "employee_clubs", force: :cascade do |t|
|
52
52
|
t.integer "emp_no", null: false
|
53
53
|
t.integer "club_id", null: false
|
54
54
|
t.string "string", null: false
|
55
|
-
t.text "text", limit: 65535
|
55
|
+
t.text "text", <%= i cond('5.0.', limit: 65535) %>, null: false
|
56
56
|
end
|
57
57
|
EOS
|
58
58
|
}
|
@@ -71,23 +71,23 @@ describe 'Ridgepole::Client#diff -> migrate', condition: [:activerecord_5] do
|
|
71
71
|
|
72
72
|
context 'when change column (change comment)' do
|
73
73
|
let(:actual_dsl) {
|
74
|
-
<<-EOS
|
74
|
+
erbh(<<-EOS)
|
75
75
|
create_table "employee_clubs", force: :cascade do |t|
|
76
76
|
t.integer "emp_no", null: false, comment: "any comment"
|
77
77
|
t.integer "club_id", null: false, comment: "any comment2"
|
78
78
|
t.string "string", null: false, comment: "any comment3"
|
79
|
-
t.text "text", limit: 65535
|
79
|
+
t.text "text", <%= i cond('5.0.', limit: 65535) %>, null: false, comment: "any comment4"
|
80
80
|
end
|
81
81
|
EOS
|
82
82
|
}
|
83
83
|
|
84
84
|
let(:expected_dsl) {
|
85
|
-
<<-EOS
|
85
|
+
erbh(<<-EOS)
|
86
86
|
create_table "employee_clubs", force: :cascade do |t|
|
87
87
|
t.integer "emp_no", null: false, comment: "other comment"
|
88
88
|
t.integer "club_id", null: false, comment: "other comment2"
|
89
89
|
t.string "string", null: false, comment: "other comment3"
|
90
|
-
t.text "text", limit: 65535
|
90
|
+
t.text "text", <%= i cond('5.0.', limit: 65535) %>, null: false, comment: "other comment4"
|
91
91
|
end
|
92
92
|
EOS
|
93
93
|
}
|
@@ -106,12 +106,12 @@ describe 'Ridgepole::Client#diff -> migrate', condition: [:activerecord_5] do
|
|
106
106
|
|
107
107
|
context 'when change column (no change comment)' do
|
108
108
|
let(:actual_dsl) {
|
109
|
-
<<-EOS
|
109
|
+
erbh(<<-EOS)
|
110
110
|
create_table "employee_clubs", force: :cascade do |t|
|
111
111
|
t.integer "emp_no", null: false, comment: "any comment"
|
112
112
|
t.integer "club_id", null: false, comment: "any comment2"
|
113
113
|
t.string "string", null: false, comment: "any comment3"
|
114
|
-
t.text "text", limit: 65535
|
114
|
+
t.text "text", <%= i cond('5.0.', limit: 65535) %>, null: false, comment: "any comment4"
|
115
115
|
end
|
116
116
|
EOS
|
117
117
|
}
|
@@ -130,12 +130,12 @@ describe 'Ridgepole::Client#diff -> migrate', condition: [:activerecord_5] do
|
|
130
130
|
|
131
131
|
context 'when create table (with comment)' do
|
132
132
|
let(:expected_dsl) {
|
133
|
-
<<-EOS
|
133
|
+
erbh(<<-EOS)
|
134
134
|
create_table "employee_clubs", force: :cascade, comment: "table comment" do |t|
|
135
135
|
t.integer "emp_no", null: false, comment: "other comment"
|
136
136
|
t.integer "club_id", null: false, comment: "other comment2"
|
137
137
|
t.string "string", null: false, comment: "other comment3"
|
138
|
-
t.text "text", limit: 65535
|
138
|
+
t.text "text", <%= i cond('5.0.', limit: 65535) %>, null: false, comment: "other comment4"
|
139
139
|
end
|
140
140
|
EOS
|
141
141
|
}
|
@@ -153,12 +153,12 @@ describe 'Ridgepole::Client#diff -> migrate', condition: [:activerecord_5] do
|
|
153
153
|
|
154
154
|
context 'when drop table (with comment)' do
|
155
155
|
let(:actual_dsl) {
|
156
|
-
<<-EOS
|
156
|
+
erbh(<<-EOS)
|
157
157
|
create_table "employee_clubs", force: :cascade, comment: "table comment" do |t|
|
158
158
|
t.integer "emp_no", null: false, comment: "other comment"
|
159
159
|
t.integer "club_id", null: false, comment: "other comment2"
|
160
160
|
t.string "string", null: false, comment: "other comment3"
|
161
|
-
t.text "text", limit: 65535
|
161
|
+
t.text "text", <%= i cond('5.0.', limit: 65535) %>, null: false, comment: "other comment4"
|
162
162
|
end
|
163
163
|
EOS
|
164
164
|
}
|