ridgepole 0.8.4 → 0.8.9
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 -4
- data/.travis.yml +5 -7
- data/README.md +13 -1
- data/bin/ridgepole +4 -2
- data/lib/ridgepole/cli/config.rb +5 -3
- data/lib/ridgepole/delta.rb +29 -22
- data/lib/ridgepole/diff.rb +13 -1
- data/lib/ridgepole/dsl_parser.rb +2 -1
- data/lib/ridgepole/dsl_parser/context.rb +5 -2
- data/lib/ridgepole/external_sql_executer.rb +1 -1
- data/lib/ridgepole/version.rb +1 -1
- data/spec/dsl_parser/context_spec.rb +16 -0
- data/spec/fixtures/for_require_relative_spec.rb +3 -0
- data/spec/mysql/cli/config_spec.rb +54 -1
- data/spec/mysql/cli/ridgepole_spec.rb +1 -0
- data/spec/mysql/collation/collation_spec.rb +6 -0
- data/spec/mysql/diff/diff2_spec.rb +3 -3
- data/spec/mysql/diff/diff_spec.rb +3 -3
- data/spec/mysql/fk/migrate_create_fk_spec.rb +27 -7
- data/spec/mysql/fk/migrate_drop_fk_spec.rb +1 -1
- data/spec/mysql/fk/migrate_fk_with_column_spec.rb +2 -2
- data/spec/mysql/migrate/migrate_add_column_spec.rb +5 -5
- data/spec/mysql/migrate/migrate_change_column8_spec.rb +1 -1
- data/spec/mysql/migrate/migrate_change_column_spec.rb +5 -5
- data/spec/mysql/migrate/migrate_change_index_spec.rb +9 -9
- data/spec/mysql/migrate/migrate_change_table_comment_spec.rb +1 -1
- data/spec/mysql/migrate/migrate_change_table_option_spec.rb +1 -1
- data/spec/mysql/migrate/migrate_create_index_spec.rb +6 -6
- data/spec/mysql/migrate/migrate_create_table_with_index_spec.rb +7 -7
- data/spec/mysql/migrate/migrate_create_table_with_options_spec.rb +8 -8
- data/spec/mysql/migrate/migrate_drop_column_and_index_spec.rb +4 -4
- data/spec/mysql/migrate/migrate_drop_column_spec.rb +3 -3
- data/spec/mysql/migrate/migrate_drop_index_spec.rb +6 -6
- data/spec/mysql/migrate/migrate_rename_column_spec.rb +3 -3
- data/spec/mysql/migrate/migrate_script_error_spec.rb +1 -1
- data/spec/mysql/text_blob_types/text_blob_types_spec.rb +4 -1
- data/spec/mysql/~default_name_fk/migrate_create_fk_spec.rb +1 -1
- data/spec/mysql/~default_name_fk/migrate_drop_fk_spec.rb +1 -1
- data/spec/mysql/~dump_auto_increment/migrate_create_table_with_index_spec.rb +7 -7
- data/spec/postgresql/diff/diff_spec.rb +2 -2
- data/spec/postgresql/fk/migrate_create_fk_spec.rb +2 -2
- data/spec/postgresql/fk/migrate_drop_fk_spec.rb +1 -1
- data/spec/postgresql/migrate/migrate_add_column_spec.rb +5 -5
- data/spec/postgresql/migrate/migrate_change_column_spec.rb +4 -4
- data/spec/postgresql/migrate/migrate_change_index_spec.rb +9 -9
- data/spec/postgresql/migrate/migrate_drop_column_spec.rb +3 -3
- data/spec/postgresql/migrate/migrate_drop_column_with_index_spec.rb +5 -5
- data/spec/postgresql/migrate/migrate_drop_expression_index_spec.rb +1 -1
- data/spec/postgresql/migrate/migrate_drop_index_spec.rb +6 -6
- data/spec/postgresql/migrate/migrate_rename_column_spec.rb +2 -2
- data/spec/postgresql/~default_name_fk/migrate_create_fk_spec.rb +1 -1
- data/spec/postgresql/~default_name_fk/migrate_drop_fk_spec.rb +1 -1
- data/spec/spec_condition.rb +0 -4
- metadata +6 -2
@@ -50,7 +50,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
50
50
|
expect(delta.differ?).to be_truthy
|
51
51
|
expect(subject.dump).to match_fuzzy sorted_actual_dsl
|
52
52
|
expect(delta.script).to match_fuzzy <<-RUBY
|
53
|
-
remove_foreign_key("child",
|
53
|
+
remove_foreign_key("child", name: "fk_rails_e74ce85cbc")
|
54
54
|
RUBY
|
55
55
|
delta.migrate
|
56
56
|
expect(subject.dump).to match_ruby expected_dsl
|
@@ -25,13 +25,13 @@ describe 'Ridgepole::Client#diff -> migrate (with index)', condition: '>= 5.1.0'
|
|
25
25
|
expect(delta.differ?).to be_truthy
|
26
26
|
|
27
27
|
expect(delta.script).to match_fuzzy erbh(<<-ERB)
|
28
|
-
create_table("dept_emp", {:primary_key=>["emp_no", "dept_no"]}) do |t|
|
29
|
-
t.column("emp_no", :"integer", {:null=>false, :limit=>4})
|
30
|
-
t.column("dept_no", :"integer", {:null=>false, :auto_increment=>true, :limit=>4})
|
31
|
-
t.column("from_date", :"date", {:null=>false})
|
32
|
-
t.column("to_date", :"date", {:null=>false})
|
33
|
-
t.index(["dept_no"],
|
34
|
-
t.index(["emp_no"],
|
28
|
+
create_table("dept_emp", **{:primary_key=>["emp_no", "dept_no"]}) do |t|
|
29
|
+
t.column("emp_no", :"integer", **{:null=>false, :limit=>4})
|
30
|
+
t.column("dept_no", :"integer", **{:null=>false, :auto_increment=>true, :limit=>4})
|
31
|
+
t.column("from_date", :"date", **{:null=>false})
|
32
|
+
t.column("to_date", :"date", **{:null=>false})
|
33
|
+
t.index(["dept_no"], **<%= {:name=>"dept_no"} + cond(5.0, using: :btree) %>)
|
34
|
+
t.index(["emp_no"], **<%= {:name=>"emp_no"} + cond(5.0, using: :btree) %>)
|
35
35
|
end
|
36
36
|
ERB
|
37
37
|
|
@@ -148,9 +148,9 @@ describe 'Ridgepole::Client.diff' do
|
|
148
148
|
delta = subject.diff(actual_dsl, expected_dsl)
|
149
149
|
expect(delta.differ?).to be_truthy
|
150
150
|
expect(delta.script).to match_fuzzy <<-RUBY
|
151
|
-
change_column("employee_clubs", "club_id", :integer, {:null=>true, :default=>nil})
|
151
|
+
change_column("employee_clubs", "club_id", :integer, **{:null=>true, :default=>nil})
|
152
152
|
|
153
|
-
change_column("employees", "last_name", :string, {:limit=>20, :default=>"XXX"})
|
153
|
+
change_column("employees", "last_name", :string, **{:limit=>20, :default=>"XXX"})
|
154
154
|
RUBY
|
155
155
|
}
|
156
156
|
end
|
@@ -36,7 +36,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
36
36
|
expect(delta.differ?).to be_truthy
|
37
37
|
expect(subject.dump).to match_ruby actual_dsl
|
38
38
|
expect(delta.script).to match_fuzzy <<-RUBY
|
39
|
-
add_foreign_key("child", "parent", {:name=>"child_ibfk_1"})
|
39
|
+
add_foreign_key("child", "parent", **{:name=>"child_ibfk_1"})
|
40
40
|
RUBY
|
41
41
|
delta.migrate
|
42
42
|
expect(subject.dump).to match_ruby expected_dsl
|
@@ -147,7 +147,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
147
147
|
expect(delta.differ?).to be_truthy
|
148
148
|
expect(subject.dump).to match_ruby actual_dsl
|
149
149
|
expect(delta.script).to match_fuzzy <<-RUBY
|
150
|
-
add_foreign_key("child", "parent", {})
|
150
|
+
add_foreign_key("child", "parent", **{})
|
151
151
|
RUBY
|
152
152
|
delta.migrate
|
153
153
|
expect(subject.dump).to match_ruby expected_dsl
|
@@ -50,7 +50,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
50
50
|
expect(delta.differ?).to be_truthy
|
51
51
|
expect(subject.dump).to match_fuzzy sorted_actual_dsl
|
52
52
|
expect(delta.script).to match_fuzzy <<-RUBY
|
53
|
-
remove_foreign_key("child",
|
53
|
+
remove_foreign_key("child", name: "child_ibfk_1")
|
54
54
|
RUBY
|
55
55
|
delta.migrate
|
56
56
|
expect(subject.dump).to match_ruby expected_dsl
|
@@ -141,13 +141,13 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
141
141
|
expect(delta.differ?).to be_truthy
|
142
142
|
expect(subject.dump).to match_ruby actual_dsl
|
143
143
|
expect(delta.script).to match_fuzzy <<-RUBY
|
144
|
-
change_table("employee_clubs",
|
145
|
-
t.column("any_col", :string, {:limit=>255, :null=>false})
|
144
|
+
change_table("employee_clubs", bulk: true) do |t|
|
145
|
+
t.column("any_col", :string, **{:limit=>255, :null=>false})
|
146
146
|
end
|
147
147
|
|
148
|
-
change_table("employees",
|
149
|
-
t.column("age", :integer, {:null=>false})
|
150
|
-
t.column("updated_at", :date, {})
|
148
|
+
change_table("employees", bulk: true) do |t|
|
149
|
+
t.column("age", :integer, **{:null=>false})
|
150
|
+
t.column("updated_at", :date, **{})
|
151
151
|
end
|
152
152
|
RUBY
|
153
153
|
delta.migrate
|
@@ -138,12 +138,12 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
138
138
|
expect(delta.differ?).to be_truthy
|
139
139
|
expect(subject.dump).to match_ruby actual_dsl
|
140
140
|
expect(delta.script).to match_fuzzy <<-RUBY
|
141
|
-
change_table("employee_clubs",
|
142
|
-
t.change("club_id", :integer, {:null=>true, :default=>nil})
|
141
|
+
change_table("employee_clubs", bulk: true) do |t|
|
142
|
+
t.change("club_id", :integer, **{:null=>true, :default=>nil})
|
143
143
|
end
|
144
144
|
|
145
|
-
change_table("employees",
|
146
|
-
t.change("last_name", :string, {:limit=>20, :default=>"XXX"})
|
145
|
+
change_table("employees", bulk: true) do |t|
|
146
|
+
t.change("last_name", :string, **{:limit=>20, :default=>"XXX"})
|
147
147
|
end
|
148
148
|
RUBY
|
149
149
|
delta.migrate
|
@@ -140,19 +140,19 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
140
140
|
expect(delta.differ?).to be_truthy
|
141
141
|
expect(subject.dump).to match_ruby actual_dsl
|
142
142
|
expect(delta.script).to match_fuzzy <<-RUBY
|
143
|
-
change_table("dept_emp",
|
144
|
-
t.remove_index(
|
145
|
-
t.index(["from_date"], {:name=>"idx_dept_emp_emp_no", :using=>:btree, :unique=>false})
|
143
|
+
change_table("dept_emp", bulk: true) do |t|
|
144
|
+
t.remove_index(name: "idx_dept_emp_emp_no")
|
145
|
+
t.index(["from_date"], **{:name=>"idx_dept_emp_emp_no", :using=>:btree, :unique=>false})
|
146
146
|
end
|
147
147
|
|
148
|
-
change_table("dept_manager",
|
149
|
-
t.remove_index(
|
150
|
-
t.index(["from_date"], {:name=>"idx_dept_manager_emp_no", :using=>:btree, :unique=>false})
|
148
|
+
change_table("dept_manager", bulk: true) do |t|
|
149
|
+
t.remove_index(name: "idx_dept_manager_emp_no")
|
150
|
+
t.index(["from_date"], **{:name=>"idx_dept_manager_emp_no", :using=>:btree, :unique=>false})
|
151
151
|
end
|
152
152
|
|
153
|
-
change_table("salaries",
|
154
|
-
t.remove_index(
|
155
|
-
t.index(["from_date"], {:name=>"idx_salaries_emp_no", :using=>:btree, :unique=>false})
|
153
|
+
change_table("salaries", bulk: true) do |t|
|
154
|
+
t.remove_index(name: "idx_salaries_emp_no")
|
155
|
+
t.index(["from_date"], **{:name=>"idx_salaries_emp_no", :using=>:btree, :unique=>false})
|
156
156
|
end
|
157
157
|
RUBY
|
158
158
|
|
@@ -134,17 +134,17 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
134
134
|
expect(delta.differ?).to be_truthy
|
135
135
|
expect(subject.dump).to match_ruby actual_dsl
|
136
136
|
expect(delta.script).to match_fuzzy <<-RUBY
|
137
|
-
change_table("dept_emp",
|
137
|
+
change_table("dept_emp", bulk: true) do |t|
|
138
138
|
t.remove("from_date")
|
139
139
|
t.remove("to_date")
|
140
140
|
end
|
141
141
|
|
142
|
-
change_table("dept_manager",
|
142
|
+
change_table("dept_manager", bulk: true) do |t|
|
143
143
|
t.remove("from_date")
|
144
144
|
t.remove("to_date")
|
145
145
|
end
|
146
146
|
|
147
|
-
change_table("employees",
|
147
|
+
change_table("employees", bulk: true) do |t|
|
148
148
|
t.remove("last_name")
|
149
149
|
t.remove("hire_date")
|
150
150
|
end
|
@@ -137,24 +137,24 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
137
137
|
expect(delta.differ?).to be_truthy
|
138
138
|
expect(subject.dump).to match_ruby actual_dsl
|
139
139
|
expect(delta.script).to match_fuzzy erbh(<<-ERB)
|
140
|
-
change_table("dept_emp",
|
140
|
+
change_table("dept_emp", bulk: true) do |t|
|
141
141
|
t.remove("emp_no")
|
142
142
|
t.remove("from_date")
|
143
143
|
t.remove("to_date")
|
144
144
|
end
|
145
145
|
|
146
|
-
change_table("dept_manager",
|
146
|
+
change_table("dept_manager", bulk: true) do |t|
|
147
147
|
t.remove("emp_no")
|
148
148
|
t.remove("from_date")
|
149
149
|
t.remove("to_date")
|
150
150
|
end
|
151
151
|
|
152
|
-
change_table("employee_clubs",
|
152
|
+
change_table("employee_clubs", bulk: true) do |t|
|
153
153
|
t.remove("club_id")
|
154
|
-
t.index(["emp_no"],
|
154
|
+
t.index(["emp_no"], **<%= {:name=>"idx_employee_clubs_emp_no"} + cond(5.0, using: :btree) %>)
|
155
155
|
end
|
156
156
|
|
157
|
-
change_table("employees",
|
157
|
+
change_table("employees", bulk: true) do |t|
|
158
158
|
t.remove("last_name")
|
159
159
|
t.remove("hire_date")
|
160
160
|
end
|
@@ -50,7 +50,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
50
50
|
specify do
|
51
51
|
delta = subject.diff(expected_dsl)
|
52
52
|
expect(delta).to be_differ
|
53
|
-
expect(delta.script).to match_fuzzy('remove_index("users",
|
53
|
+
expect(delta.script).to match_fuzzy('remove_index("users", name: "index_users_on_lower_name")')
|
54
54
|
expect(subject.dump).to match_fuzzy(actual_dsl)
|
55
55
|
delta.migrate
|
56
56
|
expect(subject.dump).to match_fuzzy(expected_dsl)
|
@@ -139,16 +139,16 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
139
139
|
expect(delta.differ?).to be_truthy
|
140
140
|
expect(subject.dump).to match_ruby actual_dsl
|
141
141
|
expect(delta.script).to match_fuzzy <<-RUBY
|
142
|
-
change_table("clubs",
|
143
|
-
t.remove_index(
|
142
|
+
change_table("clubs", bulk: true) do |t|
|
143
|
+
t.remove_index(name: "idx_name")
|
144
144
|
end
|
145
145
|
|
146
|
-
change_table("employee_clubs",
|
147
|
-
t.remove_index(
|
146
|
+
change_table("employee_clubs", bulk: true) do |t|
|
147
|
+
t.remove_index(name: "idx_employee_clubs_emp_no_club_id")
|
148
148
|
end
|
149
149
|
|
150
|
-
change_table("titles",
|
151
|
-
t.remove_index(
|
150
|
+
change_table("titles", bulk: true) do |t|
|
151
|
+
t.remove_index(name: "idx_titles_emp_no")
|
152
152
|
end
|
153
153
|
RUBY
|
154
154
|
delta.migrate
|
@@ -140,11 +140,11 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
140
140
|
expect(delta.differ?).to be_truthy
|
141
141
|
expect(subject.dump).to match_ruby actual_dsl
|
142
142
|
expect(delta.script).to match_fuzzy <<-RUBY
|
143
|
-
change_table("dept_emp",
|
143
|
+
change_table("dept_emp", bulk: true) do |t|
|
144
144
|
t.rename("from_date", "from_date2")
|
145
145
|
end
|
146
146
|
|
147
|
-
change_table("dept_manager",
|
147
|
+
change_table("dept_manager", bulk: true) do |t|
|
148
148
|
t.rename("to_date", "to_date2")
|
149
149
|
end
|
150
150
|
RUBY
|
@@ -36,7 +36,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
36
36
|
expect(delta.differ?).to be_truthy
|
37
37
|
expect(subject.dump).to match_ruby actual_dsl
|
38
38
|
expect(delta.script).to match_fuzzy <<-RUBY
|
39
|
-
add_foreign_key("child", "parent", {:name=>"fk_rails_e74ce85cbc"})
|
39
|
+
add_foreign_key("child", "parent", **{:name=>"fk_rails_e74ce85cbc"})
|
40
40
|
RUBY
|
41
41
|
delta.migrate
|
42
42
|
expect(subject.dump).to match_ruby expected_dsl
|
@@ -50,7 +50,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
50
50
|
expect(delta.differ?).to be_truthy
|
51
51
|
expect(subject.dump).to match_fuzzy sorted_actual_dsl
|
52
52
|
expect(delta.script).to match_fuzzy <<-RUBY
|
53
|
-
remove_foreign_key("child",
|
53
|
+
remove_foreign_key("child", name: "fk_rails_e74ce85cbc")
|
54
54
|
RUBY
|
55
55
|
delta.migrate
|
56
56
|
expect(subject.dump).to match_ruby expected_dsl
|
data/spec/spec_condition.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ridgepole
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Genki Sugawara
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-08-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -286,7 +286,9 @@ files:
|
|
286
286
|
- omnibus-ridgepole/package-scripts/ridgepole/postrm
|
287
287
|
- ridgepole.gemspec
|
288
288
|
- spec/cli_helper.rb
|
289
|
+
- spec/dsl_parser/context_spec.rb
|
289
290
|
- spec/erb_helper.rb
|
291
|
+
- spec/fixtures/for_require_relative_spec.rb
|
290
292
|
- spec/hide_pending_formatter.rb
|
291
293
|
- spec/mysql/_migrate/migrate_change_table_option_spec.rb
|
292
294
|
- spec/mysql/bigint_pk/bigint_pk_spec.rb
|
@@ -448,7 +450,9 @@ specification_version: 4
|
|
448
450
|
summary: Ridgepole is a tool to manage DB schema.
|
449
451
|
test_files:
|
450
452
|
- spec/cli_helper.rb
|
453
|
+
- spec/dsl_parser/context_spec.rb
|
451
454
|
- spec/erb_helper.rb
|
455
|
+
- spec/fixtures/for_require_relative_spec.rb
|
452
456
|
- spec/hide_pending_formatter.rb
|
453
457
|
- spec/mysql/_migrate/migrate_change_table_option_spec.rb
|
454
458
|
- spec/mysql/bigint_pk/bigint_pk_spec.rb
|