ridgepole 0.7.3.beta → 0.7.3.beta2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +38 -0
- data/Appraisals +2 -2
- data/README.md +3 -9
- data/Rakefile +7 -1
- data/bin/ridgepole +97 -108
- data/gemfiles/activerecord_5.2.gemfile +1 -1
- data/lib/ridgepole/cli/config.rb +43 -43
- data/lib/ridgepole/client.rb +65 -63
- data/lib/ridgepole/default_limit.rb +26 -24
- data/lib/ridgepole/delta.rb +367 -369
- data/lib/ridgepole/diff.rb +366 -377
- data/lib/ridgepole/dsl_parser.rb +22 -20
- data/lib/ridgepole/dsl_parser/context.rb +95 -93
- data/lib/ridgepole/dsl_parser/table_definition.rb +125 -123
- data/lib/ridgepole/dumper.rb +73 -71
- data/lib/ridgepole/execute_expander.rb +55 -55
- data/lib/ridgepole/ext/abstract_mysql_adapter/dump_auto_increment.rb +3 -3
- data/lib/ridgepole/ext/abstract_mysql_adapter/use_alter_index.rb +1 -1
- data/lib/ridgepole/ext/pp_sort_hash.rb +14 -14
- data/lib/ridgepole/ext/schema_dumper.rb +1 -1
- data/lib/ridgepole/external_sql_executer.rb +20 -20
- data/lib/ridgepole/logger.rb +17 -15
- data/lib/ridgepole/migration_ext.rb +6 -8
- data/lib/ridgepole/schema_statements_ext.rb +3 -3
- data/lib/ridgepole/version.rb +1 -1
- data/ridgepole.gemspec +11 -10
- data/spec/cli_helper.rb +2 -2
- data/spec/erb_helper.rb +6 -2
- data/spec/hide_pending_formatter.rb +5 -4
- data/spec/mysql/_migrate/migrate_change_table_option_spec.rb +8 -8
- data/spec/mysql/bigint_pk/bigint_pk_spec.rb +8 -8
- data/spec/mysql/bigint_pk/int_pk_spec.rb +13 -13
- data/spec/mysql/cli/config_spec.rb +52 -53
- data/spec/mysql/cli/ridgepole_spec.rb +111 -111
- data/spec/mysql/collation/collation_spec.rb +39 -39
- data/spec/mysql/comment/comment_spec.rb +36 -36
- data/spec/mysql/default_lambda/default_lambda_spec.rb +30 -30
- data/spec/mysql/diff/diff2_spec.rb +18 -18
- data/spec/mysql/diff/diff_spec.rb +11 -11
- data/spec/mysql/dump/dump_class_method_spec.rb +2 -2
- data/spec/mysql/dump/dump_some_tables_spec.rb +14 -14
- data/spec/mysql/dump/dump_spec.rb +2 -2
- data/spec/mysql/dump/dump_unknown_column_type_spec.rb +3 -3
- data/spec/mysql/dump/dump_without_table_options_spec.rb +8 -8
- data/spec/mysql/fk/migrate_change_fk_spec.rb +40 -40
- data/spec/mysql/fk/migrate_create_fk_spec.rb +40 -40
- data/spec/mysql/fk/migrate_drop_fk_spec.rb +60 -60
- data/spec/mysql/migrate/check_orphan_index_spec.rb +6 -6
- data/spec/mysql/migrate/migrate_add_column2_spec.rb +43 -43
- data/spec/mysql/migrate/migrate_add_column_order_spec.rb +50 -50
- data/spec/mysql/migrate/migrate_add_column_spec.rb +11 -11
- data/spec/mysql/migrate/migrate_add_column_with_alter_extra_spec.rb +8 -8
- data/spec/mysql/migrate/migrate_add_column_with_script_spec.rb +11 -11
- data/spec/mysql/migrate/migrate_change_column2_spec.rb +20 -20
- data/spec/mysql/migrate/migrate_change_column3_spec.rb +60 -60
- data/spec/mysql/migrate/migrate_change_column4_spec.rb +16 -16
- data/spec/mysql/migrate/migrate_change_column5_spec.rb +24 -24
- data/spec/mysql/migrate/migrate_change_column6_spec.rb +40 -40
- data/spec/mysql/migrate/migrate_change_column7_spec.rb +4 -4
- data/spec/mysql/migrate/migrate_change_column8_spec.rb +9 -9
- data/spec/mysql/migrate/migrate_change_column_default_spec.rb +48 -48
- data/spec/mysql/migrate/migrate_change_column_float_spec.rb +16 -16
- data/spec/mysql/migrate/migrate_change_column_spec.rb +11 -11
- data/spec/mysql/migrate/migrate_change_index2_spec.rb +20 -20
- data/spec/mysql/migrate/migrate_change_index3_spec.rb +43 -43
- data/spec/mysql/migrate/migrate_change_index4_spec.rb +24 -24
- data/spec/mysql/migrate/migrate_change_index5_spec.rb +16 -16
- data/spec/mysql/migrate/migrate_change_index6_spec.rb +12 -12
- data/spec/mysql/migrate/migrate_change_index7_spec.rb +20 -20
- data/spec/mysql/migrate/migrate_change_index8_spec.rb +20 -20
- data/spec/mysql/migrate/migrate_change_index_spec.rb +17 -17
- data/spec/mysql/migrate/migrate_change_table_comment_spec.rb +10 -10
- data/spec/mysql/migrate/migrate_change_table_option_spec.rb +18 -18
- data/spec/mysql/migrate/migrate_check_relation_column_type_spec.rb +37 -37
- data/spec/mysql/migrate/migrate_create_index2_spec.rb +12 -12
- data/spec/mysql/migrate/migrate_create_index_spec.rb +11 -11
- data/spec/mysql/migrate/migrate_create_table_spec.rb +8 -8
- data/spec/mysql/migrate/migrate_create_table_with_index_spec.rb +6 -6
- data/spec/mysql/migrate/migrate_create_table_with_options_spec.rb +12 -12
- data/spec/mysql/migrate/migrate_create_table_with_script_spec.rb +11 -11
- data/spec/mysql/migrate/migrate_drop_column_and_index2_spec.rb +9 -9
- data/spec/mysql/migrate/migrate_drop_column_and_index_spec.rb +12 -12
- data/spec/mysql/migrate/migrate_drop_column_and_unique_index_spec.rb +10 -10
- data/spec/mysql/migrate/migrate_drop_column_spec.rb +11 -11
- data/spec/mysql/migrate/migrate_drop_index_spec.rb +11 -11
- data/spec/mysql/migrate/migrate_drop_table_spec.rb +8 -8
- data/spec/mysql/migrate/migrate_duplicate_index_spec.rb +6 -6
- data/spec/mysql/migrate/migrate_duplicate_table_spec.rb +6 -6
- data/spec/mysql/migrate/migrate_empty_spec.rb +4 -4
- data/spec/mysql/migrate/migrate_execute_spec.rb +55 -55
- data/spec/mysql/migrate/migrate_log_file_spec.rb +9 -9
- data/spec/mysql/migrate/migrate_merge_mode_spec.rb +9 -9
- data/spec/mysql/migrate/migrate_noop_spec.rb +19 -19
- data/spec/mysql/migrate/migrate_primary_key_spec.rb +18 -18
- data/spec/mysql/migrate/migrate_rename_column_spec.rb +17 -17
- data/spec/mysql/migrate/migrate_rename_table_spec.rb +26 -26
- data/spec/mysql/migrate/migrate_same_default_null_spec.rb +16 -16
- data/spec/mysql/migrate/migrate_same_spec.rb +4 -4
- data/spec/mysql/migrate/migrate_script_error_spec.rb +8 -8
- data/spec/mysql/migrate/migrate_skip_column_comment_change_spec.rb +8 -8
- data/spec/mysql/migrate/migrate_skip_drop_table_spec.rb +9 -9
- data/spec/mysql/migrate/migrate_skip_rename_column_spec.rb +8 -8
- data/spec/mysql/migrate/migrate_skip_rename_table_spec.rb +9 -9
- data/spec/mysql/migrate/migrate_with_ignore_tables_spec.rb +64 -64
- data/spec/mysql/migrate/migrate_with_pre_post_query_spec.rb +12 -12
- data/spec/mysql/migrate/migrate_with_tables_spec.rb +29 -29
- data/spec/mysql/migrate/migrate_with_verbose_log_spec.rb +18 -18
- data/spec/mysql/migrate_/migrate_create_index_with_alter_spec.rb +8 -8
- data/spec/mysql/migrate_/migrate_drop_index_with_alter_spec.rb +8 -8
- data/spec/mysql/text_blob_types/text_blob_types_spec.rb +8 -8
- data/spec/mysql/~default_name_fk/migrate_change_fk_spec.rb +12 -12
- data/spec/mysql/~default_name_fk/migrate_create_fk_spec.rb +30 -30
- data/spec/mysql/~default_name_fk/migrate_drop_fk_spec.rb +22 -22
- data/spec/mysql/~dump_auto_increment/migrate_create_table_with_index_spec.rb +7 -7
- data/spec/mysql57/json/add_json_column_spec.rb +8 -8
- data/spec/mysql57/json/change_json_column_spec.rb +24 -24
- data/spec/mysql57/json/drop_json_column_spec.rb +8 -8
- data/spec/mysql57/virtual/add_virtual_column_spec.rb +9 -9
- data/spec/mysql57/virtual/change_virtual_column_spec.rb +9 -9
- data/spec/mysql57/virtual/drop_virtual_column_spec.rb +9 -9
- data/spec/postgresql/diff/diff_spec.rb +18 -18
- data/spec/postgresql/dump/dump_spec.rb +2 -2
- data/spec/postgresql/fk/migrate_change_fk_spec.rb +24 -24
- data/spec/postgresql/fk/migrate_create_fk_spec.rb +40 -40
- data/spec/postgresql/fk/migrate_drop_fk_spec.rb +44 -44
- data/spec/postgresql/migrate/migrate_add_column_spec.rb +21 -21
- data/spec/postgresql/migrate/migrate_add_expression_index_spec.rb +2 -2
- data/spec/postgresql/migrate/migrate_bigint_spec.rb +12 -12
- data/spec/postgresql/migrate/migrate_change_column_default_spec.rb +8 -8
- data/spec/postgresql/migrate/migrate_change_column_spec.rb +19 -19
- data/spec/postgresql/migrate/migrate_change_index_spec.rb +13 -13
- data/spec/postgresql/migrate/migrate_check_relation_column_type_spec.rb +19 -19
- data/spec/postgresql/migrate/migrate_create_table_spec.rb +8 -8
- data/spec/postgresql/migrate/migrate_create_table_with_default_proc_spec.rb +18 -18
- data/spec/postgresql/migrate/migrate_drop_column_spec.rb +11 -11
- data/spec/postgresql/migrate/migrate_drop_column_with_index_spec.rb +12 -12
- data/spec/postgresql/migrate/migrate_drop_expression_index_spec.rb +8 -8
- data/spec/postgresql/migrate/migrate_drop_index_spec.rb +11 -11
- data/spec/postgresql/migrate/migrate_drop_table_spec.rb +8 -8
- data/spec/postgresql/migrate/migrate_ext_cols_spec.rb +8 -8
- data/spec/postgresql/migrate/migrate_primary_key_spec.rb +97 -0
- data/spec/postgresql/migrate/migrate_references_spec.rb +24 -24
- data/spec/postgresql/migrate/migrate_rename_column_spec.rb +11 -11
- data/spec/postgresql/migrate/migrate_rename_table_spec.rb +16 -16
- data/spec/postgresql/migrate/migrate_same_spec.rb +4 -4
- data/spec/postgresql/~default_name_fk/migrate_change_fk_spec.rb +12 -12
- data/spec/postgresql/~default_name_fk/migrate_create_fk_spec.rb +30 -30
- data/spec/postgresql/~default_name_fk/migrate_drop_fk_spec.rb +22 -22
- data/spec/processing_for_travis.rb +1 -1
- data/spec/spec_condition.rb +2 -2
- data/spec/spec_const.rb +9 -9
- data/spec/spec_helper.rb +21 -23
- metadata +54 -37
@@ -1,7 +1,7 @@
|
|
1
1
|
describe 'Ridgepole::Client#diff -> migrate' do
|
2
2
|
context 'when add column' do
|
3
|
-
let(:actual_dsl)
|
4
|
-
erbh(<<-
|
3
|
+
let(:actual_dsl) do
|
4
|
+
erbh(<<-ERB)
|
5
5
|
create_table "clubs", force: :cascade do |t|
|
6
6
|
t.string "name", default: "", null: false
|
7
7
|
t.index ["name"], name: "idx_name", unique: true, <%= i cond(5.0, using: :btree) %>
|
@@ -59,11 +59,11 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
59
59
|
t.date "to_date"
|
60
60
|
t.index ["emp_no"], name: "emp_no", <%= i cond(5.0, using: :btree) %>
|
61
61
|
end
|
62
|
-
|
63
|
-
|
62
|
+
ERB
|
63
|
+
end
|
64
64
|
|
65
|
-
let(:expected_dsl)
|
66
|
-
erbh(<<-
|
65
|
+
let(:expected_dsl) do
|
66
|
+
erbh(<<-ERB)
|
67
67
|
create_table "clubs", force: :cascade do |t|
|
68
68
|
t.string "name", default: "", null: false
|
69
69
|
t.index ["name"], name: "idx_name", unique: true, <%= i cond(5.0, using: :btree) %>
|
@@ -124,8 +124,8 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
124
124
|
t.date "to_date"
|
125
125
|
t.index ["emp_no"], name: "emp_no", <%= i cond(5.0, using: :btree) %>
|
126
126
|
end
|
127
|
-
|
128
|
-
|
127
|
+
ERB
|
128
|
+
end
|
129
129
|
|
130
130
|
before { subject.diff(actual_dsl).migrate }
|
131
131
|
subject { client }
|
@@ -139,10 +139,10 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
139
139
|
}
|
140
140
|
|
141
141
|
it {
|
142
|
-
delta = client(:
|
142
|
+
delta = client(bulk_change: true).diff(expected_dsl)
|
143
143
|
expect(delta.differ?).to be_truthy
|
144
144
|
expect(subject.dump).to match_ruby actual_dsl
|
145
|
-
expect(delta.script).to match_fuzzy erbh(<<-
|
145
|
+
expect(delta.script).to match_fuzzy erbh(<<-ERB)
|
146
146
|
change_table("employee_clubs", {:bulk=>true}) do |t|
|
147
147
|
t.column("any_col", :string, {:null=>false, :after=>"club_id", :limit=>255})
|
148
148
|
end
|
@@ -151,7 +151,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
151
151
|
t.column("age", :integer, {:null=>false, :after=>"hire_date", :limit=>4})
|
152
152
|
t.column("updated_at", :date, {:after=>"age"})
|
153
153
|
end
|
154
|
-
|
154
|
+
ERB
|
155
155
|
delta.migrate
|
156
156
|
expect(subject.dump).to match_ruby expected_dsl
|
157
157
|
}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
describe 'Ridgepole::Client#diff -> migrate' do
|
2
2
|
context 'when add column' do
|
3
|
-
let(:actual_dsl)
|
4
|
-
erbh(<<-
|
3
|
+
let(:actual_dsl) do
|
4
|
+
erbh(<<-ERB)
|
5
5
|
create_table "clubs", force: :cascade do |t|
|
6
6
|
t.string "name", default: "", null: false
|
7
7
|
t.index ["name"], name: "idx_name", unique: true, <%= i cond(5.0, using: :btree) %>
|
@@ -59,11 +59,11 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
59
59
|
t.date "to_date"
|
60
60
|
t.index ["emp_no"], name: "emp_no", <%= i cond(5.0, using: :btree) %>
|
61
61
|
end
|
62
|
-
|
63
|
-
|
62
|
+
ERB
|
63
|
+
end
|
64
64
|
|
65
|
-
let(:expected_dsl)
|
66
|
-
erbh(<<-
|
65
|
+
let(:expected_dsl) do
|
66
|
+
erbh(<<-ERB)
|
67
67
|
create_table "clubs", force: :cascade do |t|
|
68
68
|
t.string "name", default: "", null: false
|
69
69
|
t.index ["name"], name: "idx_name", unique: true, <%= i cond(5.0, using: :btree) %>
|
@@ -124,8 +124,8 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
124
124
|
t.date "to_date"
|
125
125
|
t.index ["emp_no"], name: "emp_no", <%= i cond(5.0, using: :btree) %>
|
126
126
|
end
|
127
|
-
|
128
|
-
|
127
|
+
ERB
|
128
|
+
end
|
129
129
|
|
130
130
|
before { subject.diff(actual_dsl).migrate }
|
131
131
|
subject { client }
|
@@ -1,7 +1,7 @@
|
|
1
1
|
describe 'Ridgepole::Client#diff -> migrate' do
|
2
2
|
context 'when add column' do
|
3
|
-
let(:actual_dsl)
|
4
|
-
erbh(<<-
|
3
|
+
let(:actual_dsl) do
|
4
|
+
erbh(<<-ERB)
|
5
5
|
create_table "clubs", force: :cascade do |t|
|
6
6
|
t.string "name", default: "", null: false
|
7
7
|
t.index ["name"], name: "idx_name", unique: true, <%= i cond(5.0, using: :btree) %>
|
@@ -59,11 +59,11 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
59
59
|
t.date "to_date"
|
60
60
|
t.index ["emp_no"], name: "emp_no", <%= i cond(5.0, using: :btree) %>
|
61
61
|
end
|
62
|
-
|
63
|
-
|
62
|
+
ERB
|
63
|
+
end
|
64
64
|
|
65
|
-
let(:expected_dsl)
|
66
|
-
erbh(<<-
|
65
|
+
let(:expected_dsl) do
|
66
|
+
erbh(<<-ERB)
|
67
67
|
create_table "clubs", force: :cascade do |t|
|
68
68
|
t.string "name", default: "", null: false
|
69
69
|
t.index ["name"], name: "idx_name", unique: true, <%= i cond(5.0, using: :btree) %>
|
@@ -124,8 +124,8 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
124
124
|
t.date "to_date"
|
125
125
|
t.index ["emp_no"], name: "emp_no", <%= i cond(5.0, using: :btree) %>
|
126
126
|
end
|
127
|
-
|
128
|
-
|
127
|
+
ERB
|
128
|
+
end
|
129
129
|
|
130
130
|
before { subject.diff(actual_dsl).migrate }
|
131
131
|
subject { client }
|
@@ -135,12 +135,12 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
135
135
|
expect(delta.differ?).to be_truthy
|
136
136
|
expect(subject.dump).to match_ruby actual_dsl
|
137
137
|
|
138
|
-
script = <<-
|
138
|
+
script = <<-SHELL
|
139
139
|
echo "$1" | #{MYSQL_CLI} #{TEST_SCHEMA}
|
140
|
-
|
140
|
+
SHELL
|
141
141
|
|
142
142
|
tempfile(File.basename(__FILE__), script) do |path|
|
143
|
-
FileUtils.chmod(
|
143
|
+
FileUtils.chmod(0o755, path)
|
144
144
|
delta.migrate(external_script: path)
|
145
145
|
end
|
146
146
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
describe 'Ridgepole::Client#diff -> migrate' do
|
2
2
|
context 'when change column (no change)' do
|
3
|
-
let(:actual_dsl)
|
4
|
-
erbh(<<-
|
3
|
+
let(:actual_dsl) do
|
4
|
+
erbh(<<-ERB)
|
5
5
|
create_table "employees", primary_key: "emp_no", force: :cascade do |t|
|
6
6
|
t.date "birth_date", null: false
|
7
7
|
t.string "first_name", limit: 14, null: false
|
@@ -10,11 +10,11 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
10
10
|
t.date "hire_date", null: false
|
11
11
|
t.index ["gender"], name: "gender", <%= i cond(5.0, using: :btree) %>
|
12
12
|
end
|
13
|
-
|
14
|
-
|
13
|
+
ERB
|
14
|
+
end
|
15
15
|
|
16
|
-
let(:expected_dsl)
|
17
|
-
erbh(<<-
|
16
|
+
let(:expected_dsl) do
|
17
|
+
erbh(<<-ERB)
|
18
18
|
create_table :employees, primary_key: :emp_no, force: :cascade do |t|
|
19
19
|
t.date "birth_date", null: false
|
20
20
|
t.string "first_name", limit: 14, null: false
|
@@ -23,8 +23,8 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
23
23
|
t.date :hire_date, null: false
|
24
24
|
t.index :gender, name: :gender, <%= i cond(5.0, using: :btree) %>
|
25
25
|
end
|
26
|
-
|
27
|
-
|
26
|
+
ERB
|
27
|
+
end
|
28
28
|
|
29
29
|
before { subject.diff(actual_dsl).migrate }
|
30
30
|
subject { client }
|
@@ -36,8 +36,8 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
36
36
|
end
|
37
37
|
|
38
38
|
context 'when change column (change)' do
|
39
|
-
let(:actual_dsl)
|
40
|
-
erbh(<<-
|
39
|
+
let(:actual_dsl) do
|
40
|
+
erbh(<<-ERB)
|
41
41
|
create_table "employees", primary_key: "emp_no", force: :cascade do |t|
|
42
42
|
t.date "birth_date", null: false
|
43
43
|
t.string "first_name", limit: 14, null: false
|
@@ -46,11 +46,11 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
46
46
|
t.date "hire_date", null: false
|
47
47
|
t.index ["gender"], name: "gender", <%= i cond(5.0, using: :btree) %>
|
48
48
|
end
|
49
|
-
|
50
|
-
|
49
|
+
ERB
|
50
|
+
end
|
51
51
|
|
52
|
-
let(:dsl)
|
53
|
-
erbh(<<-
|
52
|
+
let(:dsl) do
|
53
|
+
erbh(<<-ERB)
|
54
54
|
create_table :employees, primary_key: :emp_no, force: :cascade do |t|
|
55
55
|
t.date "birth_date", null: false
|
56
56
|
t.string "first_name", limit: 14, null: false
|
@@ -59,11 +59,11 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
59
59
|
t.date :hire_date2, null: false
|
60
60
|
t.index :last_name, name: :last_name, <%= i cond(5.0, using: :btree) %>
|
61
61
|
end
|
62
|
-
|
63
|
-
|
62
|
+
ERB
|
63
|
+
end
|
64
64
|
|
65
|
-
let(:expected_dsl)
|
66
|
-
erbh(<<-
|
65
|
+
let(:expected_dsl) do
|
66
|
+
erbh(<<-ERB)
|
67
67
|
create_table "employees", primary_key: "emp_no", force: :cascade do |t|
|
68
68
|
t.date "birth_date", null: false
|
69
69
|
t.string "first_name", limit: 14, null: false
|
@@ -72,8 +72,8 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
72
72
|
t.date "hire_date2", null: false
|
73
73
|
t.index ["last_name"], name: "last_name", <%= i cond(5.0, using: :btree) %>
|
74
74
|
end
|
75
|
-
|
76
|
-
|
75
|
+
ERB
|
76
|
+
end
|
77
77
|
|
78
78
|
before { subject.diff(actual_dsl).migrate }
|
79
79
|
subject { client }
|
@@ -1,7 +1,7 @@
|
|
1
1
|
describe 'Ridgepole::Client#diff -> migrate' do
|
2
2
|
context 'when use timestamps (no change)' do
|
3
|
-
let(:actual_dsl)
|
4
|
-
<<-
|
3
|
+
let(:actual_dsl) do
|
4
|
+
<<-RUBY
|
5
5
|
create_table "employees", primary_key: "emp_no", force: :cascade do |t|
|
6
6
|
t.date "birth_date", null: false
|
7
7
|
t.string "first_name", limit: 14, null: false
|
@@ -11,11 +11,11 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
11
11
|
t.datetime "created_at", null: false
|
12
12
|
t.datetime "updated_at", null: false
|
13
13
|
end
|
14
|
-
|
15
|
-
|
14
|
+
RUBY
|
15
|
+
end
|
16
16
|
|
17
|
-
let(:expected_dsl)
|
18
|
-
<<-
|
17
|
+
let(:expected_dsl) do
|
18
|
+
<<-RUBY
|
19
19
|
create_table "employees", primary_key: "emp_no", force: :cascade do |t|
|
20
20
|
t.date "birth_date", null: false
|
21
21
|
t.string "first_name", limit: 14, null: false
|
@@ -24,8 +24,8 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
24
24
|
t.date "hire_date", null: false
|
25
25
|
t.timestamps
|
26
26
|
end
|
27
|
-
|
28
|
-
|
27
|
+
RUBY
|
28
|
+
end
|
29
29
|
|
30
30
|
before { subject.diff(actual_dsl).migrate }
|
31
31
|
subject { client }
|
@@ -37,8 +37,8 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
37
37
|
end
|
38
38
|
|
39
39
|
context 'when use timestamps (change)' do
|
40
|
-
let(:actual_dsl)
|
41
|
-
erbh(<<-
|
40
|
+
let(:actual_dsl) do
|
41
|
+
erbh(<<-ERB)
|
42
42
|
create_table "employees", primary_key: "emp_no", force: :cascade do |t|
|
43
43
|
t.date "birth_date", null: false
|
44
44
|
t.string "first_name", limit: 14, null: false
|
@@ -46,11 +46,11 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
46
46
|
t.string "gender", limit: 1, null: false
|
47
47
|
t.date "hire_date", null: false
|
48
48
|
end
|
49
|
-
|
50
|
-
|
49
|
+
ERB
|
50
|
+
end
|
51
51
|
|
52
|
-
let(:dsl)
|
53
|
-
<<-
|
52
|
+
let(:dsl) do
|
53
|
+
<<-RUBY
|
54
54
|
create_table "employees", primary_key: "emp_no", force: :cascade do |t|
|
55
55
|
t.date "birth_date", null: false
|
56
56
|
t.string "first_name", limit: 14, null: false
|
@@ -59,11 +59,11 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
59
59
|
t.date "hire_date", null: false
|
60
60
|
t.timestamps
|
61
61
|
end
|
62
|
-
|
63
|
-
|
62
|
+
RUBY
|
63
|
+
end
|
64
64
|
|
65
|
-
let(:expected_dsl)
|
66
|
-
erbh(<<-
|
65
|
+
let(:expected_dsl) do
|
66
|
+
erbh(<<-ERB)
|
67
67
|
create_table "employees", primary_key: "emp_no", force: :cascade do |t|
|
68
68
|
t.date "birth_date", null: false
|
69
69
|
t.string "first_name", limit: 14, null: false
|
@@ -73,8 +73,8 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
73
73
|
t.datetime "created_at", null: false
|
74
74
|
t.datetime "updated_at", null: false
|
75
75
|
end
|
76
|
-
|
77
|
-
|
76
|
+
ERB
|
77
|
+
end
|
78
78
|
|
79
79
|
before { subject.diff(actual_dsl).migrate }
|
80
80
|
subject { client }
|
@@ -89,8 +89,8 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
89
89
|
end
|
90
90
|
|
91
91
|
context 'when use references (no change)' do
|
92
|
-
let(:actual_dsl)
|
93
|
-
erbh(<<-
|
92
|
+
let(:actual_dsl) do
|
93
|
+
erbh(<<-ERB)
|
94
94
|
create_table "employees", primary_key: "emp_no", force: :cascade do |t|
|
95
95
|
t.date "birth_date", null: false
|
96
96
|
t.string "first_name", limit: 14, null: false
|
@@ -102,11 +102,11 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
102
102
|
t.index "products_id"
|
103
103
|
t.index "user_id"
|
104
104
|
end
|
105
|
-
|
106
|
-
|
105
|
+
ERB
|
106
|
+
end
|
107
107
|
|
108
|
-
let(:expected_dsl)
|
109
|
-
<<-
|
108
|
+
let(:expected_dsl) do
|
109
|
+
<<-RUBY
|
110
110
|
create_table "employees", primary_key: "emp_no", force: :cascade do |t|
|
111
111
|
t.date "birth_date", null: false
|
112
112
|
t.string "first_name", limit: 14, null: false
|
@@ -115,8 +115,8 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
115
115
|
t.date "hire_date", null: false
|
116
116
|
t.references :products, :user
|
117
117
|
end
|
118
|
-
|
119
|
-
|
118
|
+
RUBY
|
119
|
+
end
|
120
120
|
|
121
121
|
before { subject.diff(actual_dsl).migrate }
|
122
122
|
subject { client }
|
@@ -128,8 +128,8 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
128
128
|
end
|
129
129
|
|
130
130
|
context 'when use references with polymorphic (no change)' do
|
131
|
-
let(:actual_dsl)
|
132
|
-
erbh(<<-
|
131
|
+
let(:actual_dsl) do
|
132
|
+
erbh(<<-ERB)
|
133
133
|
create_table "employees", primary_key: "emp_no", force: :cascade do |t|
|
134
134
|
t.date "birth_date", null: false
|
135
135
|
t.string "first_name", limit: 14, null: false
|
@@ -143,11 +143,11 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
143
143
|
t.index ["products_type", "products_id"]
|
144
144
|
t.index ["user_type", "user_id"]
|
145
145
|
end
|
146
|
-
|
147
|
-
|
146
|
+
ERB
|
147
|
+
end
|
148
148
|
|
149
|
-
let(:expected_dsl)
|
150
|
-
<<-
|
149
|
+
let(:expected_dsl) do
|
150
|
+
<<-RUBY
|
151
151
|
create_table "employees", primary_key: "emp_no", force: :cascade do |t|
|
152
152
|
t.date "birth_date", null: false
|
153
153
|
t.string "first_name", limit: 14, null: false
|
@@ -156,8 +156,8 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
156
156
|
t.date "hire_date", null: false
|
157
157
|
t.references :products, :user, polymorphic: true
|
158
158
|
end
|
159
|
-
|
160
|
-
|
159
|
+
RUBY
|
160
|
+
end
|
161
161
|
|
162
162
|
before { subject.diff(actual_dsl).migrate }
|
163
163
|
subject { client }
|
@@ -169,8 +169,8 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
169
169
|
end
|
170
170
|
|
171
171
|
context 'when use references (change)' do
|
172
|
-
let(:actual_dsl)
|
173
|
-
erbh(<<-
|
172
|
+
let(:actual_dsl) do
|
173
|
+
erbh(<<-ERB)
|
174
174
|
create_table "employees", primary_key: "emp_no", force: :cascade do |t|
|
175
175
|
t.date "birth_date", null: false
|
176
176
|
t.string "first_name", limit: 14, null: false
|
@@ -178,11 +178,11 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
178
178
|
t.string "gender", limit: 1, null: false
|
179
179
|
t.date "hire_date", null: false
|
180
180
|
end
|
181
|
-
|
182
|
-
|
181
|
+
ERB
|
182
|
+
end
|
183
183
|
|
184
|
-
let(:dsl)
|
185
|
-
<<-
|
184
|
+
let(:dsl) do
|
185
|
+
<<-RUBY
|
186
186
|
create_table "employees", primary_key: "emp_no", force: :cascade do |t|
|
187
187
|
t.date "birth_date", null: false
|
188
188
|
t.string "first_name", limit: 14, null: false
|
@@ -191,11 +191,11 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
191
191
|
t.date "hire_date", null: false
|
192
192
|
t.references :products, :user
|
193
193
|
end
|
194
|
-
|
195
|
-
|
194
|
+
RUBY
|
195
|
+
end
|
196
196
|
|
197
|
-
let(:expected_dsl)
|
198
|
-
erbh(<<-
|
197
|
+
let(:expected_dsl) do
|
198
|
+
erbh(<<-ERB)
|
199
199
|
create_table "employees", primary_key: "emp_no", force: :cascade do |t|
|
200
200
|
t.date "birth_date", null: false
|
201
201
|
t.string "first_name", limit: 14, null: false
|
@@ -207,8 +207,8 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
207
207
|
t.index ["products_id"], name: "index_employees_on_products_id", <%= i cond(5.0, using: :btree) %>
|
208
208
|
t.index ["user_id"], name: "index_employees_on_user_id", <%= i cond(5.0, using: :btree) %>
|
209
209
|
end
|
210
|
-
|
211
|
-
|
210
|
+
ERB
|
211
|
+
end
|
212
212
|
|
213
213
|
before { subject.diff(actual_dsl).migrate }
|
214
214
|
subject { client }
|
@@ -223,8 +223,8 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
223
223
|
end
|
224
224
|
|
225
225
|
context 'when use references with polymorphic (change)' do
|
226
|
-
let(:actual_dsl)
|
227
|
-
erbh(<<-
|
226
|
+
let(:actual_dsl) do
|
227
|
+
erbh(<<-ERB)
|
228
228
|
create_table "employees", primary_key: "emp_no", force: :cascade do |t|
|
229
229
|
t.date "birth_date", null: false
|
230
230
|
t.string "first_name", limit: 14, null: false
|
@@ -232,11 +232,11 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
232
232
|
t.string "gender", limit: 1, null: false
|
233
233
|
t.date "hire_date", null: false
|
234
234
|
end
|
235
|
-
|
236
|
-
|
235
|
+
ERB
|
236
|
+
end
|
237
237
|
|
238
|
-
let(:dsl)
|
239
|
-
<<-
|
238
|
+
let(:dsl) do
|
239
|
+
<<-RUBY
|
240
240
|
create_table "employees", primary_key: "emp_no", force: :cascade do |t|
|
241
241
|
t.date "birth_date", null: false
|
242
242
|
t.string "first_name", limit: 14, null: false
|
@@ -245,11 +245,11 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
245
245
|
t.date "hire_date", null: false
|
246
246
|
t.references :products, :user, polymorphic: true
|
247
247
|
end
|
248
|
-
|
249
|
-
|
248
|
+
RUBY
|
249
|
+
end
|
250
250
|
|
251
|
-
let(:expected_dsl)
|
252
|
-
erbh(<<-
|
251
|
+
let(:expected_dsl) do
|
252
|
+
erbh(<<-ERB)
|
253
253
|
create_table "employees", primary_key: "emp_no", force: :cascade do |t|
|
254
254
|
t.date "birth_date", null: false
|
255
255
|
t.string "first_name", limit: 14, null: false
|
@@ -263,8 +263,8 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
263
263
|
t.index ["products_type", "products_id"], name: "index_employees_on_products_type_and_products_id", <%= i cond(5.0, using: :btree) %>
|
264
264
|
t.index ["user_type", "user_id"], name: "index_employees_on_user_type_and_user_id", <%= i cond(5.0, using: :btree) %>
|
265
265
|
end
|
266
|
-
|
267
|
-
|
266
|
+
ERB
|
267
|
+
end
|
268
268
|
|
269
269
|
before { subject.diff(actual_dsl).migrate }
|
270
270
|
subject { client }
|