ridgepole 0.8.9 → 0.9.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +83 -0
- data/.rubocop.yml +9 -34
- data/.simplecov +6 -0
- data/Appraisals +4 -5
- data/README.md +25 -40
- data/bin/ridgepole +13 -3
- data/gemfiles/{activerecord_5.0.gemfile → activerecord_6.1.gemfile} +1 -2
- data/lib/ridgepole/client.rb +8 -3
- data/lib/ridgepole/default_limit.rb +1 -1
- data/lib/ridgepole/delta.rb +16 -1
- data/lib/ridgepole/diff.rb +50 -31
- data/lib/ridgepole/dsl_parser.rb +3 -5
- data/lib/ridgepole/dsl_parser/context.rb +1 -1
- data/lib/ridgepole/dsl_parser/table_definition.rb +52 -42
- data/lib/ridgepole/execute_expander.rb +10 -1
- data/lib/ridgepole/ext/abstract_adapter/disable_table_options.rb +9 -1
- data/lib/ridgepole/external_sql_executer.rb +12 -1
- data/lib/ridgepole/version.rb +1 -1
- data/ridgepole.gemspec +7 -4
- data/spec/erb_helper.rb +5 -5
- data/spec/mysql/_migrate/migrate_change_table_option_spec.rb +2 -2
- data/spec/mysql/bigint_pk/int_pk_spec.rb +1 -1
- data/spec/mysql/cli/ridgepole_spec.rb +35 -1
- data/spec/mysql/collation/collation_spec.rb +15 -15
- data/spec/mysql/comment/comment_spec.rb +9 -9
- data/spec/mysql/diff/diff2_spec.rb +5 -5
- data/spec/mysql/diff/diff_spec.rb +3 -3
- data/spec/mysql/dump/dump_class_method_spec.rb +13 -13
- data/spec/mysql/dump/dump_some_tables_spec.rb +4 -4
- data/spec/mysql/dump/dump_spec.rb +13 -13
- data/spec/mysql/dump/dump_unknown_column_type_spec.rb +2 -2
- data/spec/mysql/dump/dump_without_table_options_spec.rb +2 -2
- data/spec/mysql/fk/migrate_change_fk2_spec.rb +2 -2
- data/spec/mysql/fk/migrate_change_fk_spec.rb +20 -20
- data/spec/mysql/fk/migrate_create_fk_spec.rb +73 -24
- data/spec/mysql/fk/migrate_drop_fk_spec.rb +26 -26
- data/spec/mysql/fk/migrate_fk_with_column_spec.rb +16 -16
- data/spec/mysql/fk/migrate_ignore_fk_spec.rb +6 -6
- data/spec/mysql/migrate/migrate_add_column_order_spec.rb +2 -2
- data/spec/mysql/migrate/migrate_add_column_spec.rb +18 -18
- data/spec/mysql/migrate/migrate_add_column_with_alter_extra_spec.rb +106 -18
- data/spec/mysql/migrate/migrate_add_column_with_script_spec.rb +18 -18
- data/spec/mysql/migrate/migrate_change_column2_spec.rb +5 -5
- data/spec/mysql/migrate/migrate_change_column3_spec.rb +116 -25
- data/spec/mysql/migrate/migrate_change_column5_spec.rb +3 -3
- data/spec/mysql/migrate/migrate_change_column6_spec.rb +7 -7
- data/spec/mysql/migrate/migrate_change_column8_spec.rb +38 -5
- data/spec/mysql/migrate/migrate_change_column_default_spec.rb +2 -14
- data/spec/mysql/migrate/migrate_change_column_spec.rb +21 -21
- data/spec/mysql/migrate/migrate_change_index2_spec.rb +5 -5
- data/spec/mysql/migrate/migrate_change_index3_spec.rb +7 -7
- data/spec/mysql/migrate/migrate_change_index4_spec.rb +6 -6
- data/spec/mysql/migrate/migrate_change_index5_spec.rb +4 -4
- data/spec/mysql/migrate/migrate_change_index6_spec.rb +27 -27
- data/spec/mysql/migrate/migrate_change_index7_spec.rb +4 -4
- data/spec/mysql/migrate/migrate_change_index8_spec.rb +4 -4
- data/spec/mysql/migrate/migrate_change_index_spec.rb +34 -28
- data/spec/mysql/migrate/migrate_check_relation_column_type_spec.rb +5 -5
- data/spec/mysql/migrate/migrate_create_index2_spec.rb +24 -24
- data/spec/mysql/migrate/migrate_create_index_spec.rb +18 -18
- data/spec/mysql/migrate/migrate_create_table_spec.rb +16 -16
- data/spec/mysql/migrate/migrate_create_table_with_ignore_spec.rb +4 -4
- data/spec/mysql/migrate/migrate_create_table_with_index_spec.rb +4 -4
- data/spec/mysql/migrate/migrate_create_table_with_script_spec.rb +16 -16
- data/spec/mysql/migrate/migrate_drop_column_and_index2_spec.rb +18 -18
- data/spec/mysql/migrate/migrate_drop_column_and_index_spec.rb +16 -16
- data/spec/mysql/migrate/migrate_drop_column_and_unique_index_spec.rb +1 -1
- data/spec/mysql/migrate/migrate_drop_column_spec.rb +18 -18
- data/spec/mysql/migrate/migrate_drop_index_spec.rb +15 -15
- data/spec/mysql/migrate/migrate_drop_table_spec.rb +16 -16
- data/spec/mysql/migrate/migrate_empty_spec.rb +9 -9
- data/spec/mysql/migrate/migrate_execute_spec.rb +32 -32
- data/spec/mysql/migrate/migrate_ignore_column_spec.rb +4 -4
- data/spec/mysql/migrate/migrate_ignore_index_spec.rb +5 -5
- data/spec/mysql/migrate/migrate_log_file_spec.rb +16 -16
- data/spec/mysql/migrate/migrate_merge_mode_spec.rb +18 -18
- data/spec/mysql/migrate/migrate_noop_spec.rb +12 -12
- data/spec/mysql/migrate/migrate_primary_key_spec.rb +31 -6
- data/spec/mysql/migrate/migrate_rename_column_spec.rb +18 -18
- data/spec/mysql/migrate/migrate_rename_table_spec.rb +22 -22
- data/spec/mysql/migrate/migrate_same_spec.rb +13 -13
- data/spec/mysql/migrate/migrate_skip_column_comment_change_spec.rb +2 -2
- data/spec/mysql/migrate/migrate_skip_drop_table_spec.rb +18 -18
- data/spec/mysql/migrate/migrate_skip_rename_column_spec.rb +18 -18
- data/spec/mysql/migrate/migrate_skip_rename_table_spec.rb +18 -18
- data/spec/mysql/migrate/migrate_with_pre_post_query_spec.rb +18 -18
- data/spec/mysql/text_blob_types/text_blob_types_spec.rb +2 -2
- data/spec/mysql/~default_name_fk/migrate_change_fk_spec.rb +6 -6
- data/spec/mysql/~default_name_fk/migrate_create_fk_spec.rb +9 -9
- data/spec/mysql/~default_name_fk/migrate_drop_fk_spec.rb +8 -8
- data/spec/mysql/~dump_auto_increment/migrate_create_table_with_index_spec.rb +5 -5
- 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 +1 -1
- data/spec/mysql57/virtual/change_virtual_column_spec.rb +1 -1
- data/spec/mysql57/virtual/drop_virtual_column_spec.rb +1 -1
- data/spec/postgresql/dump/dump_spec.rb +13 -13
- data/spec/postgresql/fk/migrate_change_fk_spec.rb +6 -6
- data/spec/postgresql/fk/migrate_create_fk_spec.rb +5 -5
- data/spec/postgresql/fk/migrate_drop_fk_spec.rb +8 -8
- data/spec/postgresql/migrate/migrate_add_column_spec.rb +27 -20
- data/spec/postgresql/migrate/migrate_add_expression_index_spec.rb +1 -1
- data/spec/postgresql/migrate/migrate_change_column_spec.rb +20 -16
- data/spec/postgresql/migrate/migrate_change_index_spec.rb +18 -18
- data/spec/postgresql/migrate/migrate_check_relation_column_type_spec.rb +1 -1
- data/spec/postgresql/migrate/migrate_create_table_spec.rb +14 -14
- data/spec/postgresql/migrate/migrate_drop_column_spec.rb +29 -22
- data/spec/postgresql/migrate/migrate_drop_column_with_index_spec.rb +17 -17
- data/spec/postgresql/migrate/migrate_drop_expression_index_spec.rb +3 -3
- data/spec/postgresql/migrate/migrate_drop_index_spec.rb +15 -15
- data/spec/postgresql/migrate/migrate_drop_table_spec.rb +16 -16
- data/spec/postgresql/migrate/migrate_primary_key2_spec.rb +1 -1
- data/spec/postgresql/migrate/migrate_primary_key_spec.rb +1 -1
- data/spec/postgresql/migrate/migrate_references_spec.rb +6 -6
- data/spec/postgresql/migrate/migrate_rename_column_spec.rb +18 -18
- data/spec/postgresql/migrate/migrate_rename_table_spec.rb +20 -20
- data/spec/postgresql/migrate/migrate_same_spec.rb +13 -13
- data/spec/postgresql/~default_name_fk/migrate_change_fk_spec.rb +3 -3
- data/spec/postgresql/~default_name_fk/migrate_create_fk_spec.rb +4 -4
- data/spec/postgresql/~default_name_fk/migrate_drop_fk_spec.rb +4 -4
- data/spec/processing_for_ci.rb +13 -0
- data/spec/spec_condition.rb +4 -0
- data/spec/spec_helper.rb +3 -2
- metadata +74 -49
- data/.travis.yml +0 -45
- data/lib/ridgepole/ext/abstract_mysql_adapter/use_alter_index.rb +0 -31
- data/omnibus-ridgepole/.gitignore +0 -10
- data/omnibus-ridgepole/Dockerfile.centos +0 -25
- data/omnibus-ridgepole/Dockerfile.ubuntu +0 -21
- data/omnibus-ridgepole/Gemfile +0 -24
- data/omnibus-ridgepole/README.md +0 -15
- data/omnibus-ridgepole/Rakefile +0 -38
- data/omnibus-ridgepole/config/projects/ridgepole.rb +0 -27
- data/omnibus-ridgepole/config/software/ridgepole.rb +0 -13
- data/omnibus-ridgepole/omnibus.rb +0 -54
- data/omnibus-ridgepole/package-scripts/ridgepole/postinst +0 -1
- data/omnibus-ridgepole/package-scripts/ridgepole/postrm +0 -1
- data/spec/mysql/bigint_pk/bigint_pk_spec.rb +0 -47
- data/spec/mysql/migrate_/migrate_create_index_with_alter_spec.rb +0 -141
- data/spec/mysql/migrate_/migrate_drop_index_with_alter_spec.rb +0 -141
- data/spec/processing_for_travis.rb +0 -11
@@ -26,8 +26,8 @@ describe 'Ridgepole::Client (with new text/blob types)' do
|
|
26
26
|
delta.migrate
|
27
27
|
|
28
28
|
expect(subject.dump).to match_ruby erbh(<<-ERB)
|
29
|
-
create_table "foos", id: :integer, unsigned: true, force: :cascade do |t|
|
30
|
-
t.binary "blob"
|
29
|
+
create_table "foos", <%= i cond(">= 6.1", { id: { type: :integer, unsigned: true } }, { id: :integer, unsigned: true }) %>, force: :cascade do |t|
|
30
|
+
t.binary "blob"
|
31
31
|
t.<%= cond('< 6.0.0.beta2', :blob, :binary) %> "tiny_blob", <%= i cond('< 6.0.0.beta2', {limit: 255}, {size: :tiny}) %>
|
32
32
|
t.binary "medium_blob", <%= i cond('< 6.0.0.beta2', {limit: 16777215}, {size: :medium}) %>
|
33
33
|
t.binary "long_blob", <%= i cond('< 6.0.0.beta2', {limit: 4294967295}, {size: :long}) %>
|
@@ -4,12 +4,12 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
4
4
|
context 'when change fk' do
|
5
5
|
let(:actual_dsl) do
|
6
6
|
erbh(<<-ERB)
|
7
|
-
create_table "parent",
|
7
|
+
create_table "parent", id: :integer, force: :cascade do |t|
|
8
8
|
end
|
9
9
|
|
10
10
|
create_table "child", force: :cascade do |t|
|
11
11
|
t.integer "parent_id"
|
12
|
-
t.index ["parent_id"], name: "par_id"
|
12
|
+
t.index ["parent_id"], name: "par_id"
|
13
13
|
end
|
14
14
|
|
15
15
|
add_foreign_key "child", "parent", name: "fk_rails_e74ce85cbc", on_delete: :cascade
|
@@ -20,10 +20,10 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
20
20
|
erbh(<<-ERB)
|
21
21
|
create_table "child", force: :cascade do |t|
|
22
22
|
t.integer "parent_id"
|
23
|
-
t.index ["parent_id"], name: "par_id"
|
23
|
+
t.index ["parent_id"], name: "par_id"
|
24
24
|
end
|
25
25
|
|
26
|
-
create_table "parent",
|
26
|
+
create_table "parent", id: :integer, force: :cascade do |t|
|
27
27
|
end
|
28
28
|
|
29
29
|
add_foreign_key "child", "parent", name: "fk_rails_e74ce85cbc", on_delete: :cascade
|
@@ -34,10 +34,10 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
34
34
|
erbh(<<-ERB)
|
35
35
|
create_table "child", force: :cascade do |t|
|
36
36
|
t.integer "parent_id"
|
37
|
-
t.index ["parent_id"], name: "par_id"
|
37
|
+
t.index ["parent_id"], name: "par_id"
|
38
38
|
end
|
39
39
|
|
40
|
-
create_table "parent",
|
40
|
+
create_table "parent", id: :integer, force: :cascade do |t|
|
41
41
|
end
|
42
42
|
|
43
43
|
add_foreign_key "child", "parent", name: "fk_rails_e74ce85cbc"
|
@@ -6,10 +6,10 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
6
6
|
erbh(<<-ERB)
|
7
7
|
create_table "child", force: :cascade do |t|
|
8
8
|
t.integer "parent_id"
|
9
|
-
t.index ["parent_id"], name: "par_id"
|
9
|
+
t.index ["parent_id"], name: "par_id"
|
10
10
|
end
|
11
11
|
|
12
|
-
create_table "parent",
|
12
|
+
create_table "parent", id: :integer, force: :cascade do |t|
|
13
13
|
end
|
14
14
|
ERB
|
15
15
|
end
|
@@ -47,12 +47,12 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
47
47
|
let(:dsl) do
|
48
48
|
erbh(<<-ERB)
|
49
49
|
# Define parent before child
|
50
|
-
create_table "parent",
|
50
|
+
create_table "parent", id: :integer, force: :cascade do |t|
|
51
51
|
end
|
52
52
|
|
53
53
|
create_table "child", force: :cascade do |t|
|
54
54
|
t.integer "parent_id"
|
55
|
-
t.index ["parent_id"], name: "par_id"
|
55
|
+
t.index ["parent_id"], name: "par_id"
|
56
56
|
end
|
57
57
|
|
58
58
|
add_foreign_key "child", "parent", name: "fk_rails_e74ce85cbc"
|
@@ -63,10 +63,10 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
63
63
|
erbh(<<-ERB)
|
64
64
|
create_table "child", force: :cascade do |t|
|
65
65
|
t.integer "parent_id"
|
66
|
-
t.index ["parent_id"], name: "par_id"
|
66
|
+
t.index ["parent_id"], name: "par_id"
|
67
67
|
end
|
68
68
|
|
69
|
-
create_table "parent",
|
69
|
+
create_table "parent", id: :integer, force: :cascade do |t|
|
70
70
|
end
|
71
71
|
|
72
72
|
add_foreign_key "child", "parent", name: "fk_rails_e74ce85cbc"
|
@@ -88,12 +88,12 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
88
88
|
let(:dsl) do
|
89
89
|
erbh(<<-ERB)
|
90
90
|
# Define parent before child
|
91
|
-
create_table "parent",
|
91
|
+
create_table "parent", id: :integer, force: :cascade do |t|
|
92
92
|
end
|
93
93
|
|
94
94
|
create_table "child", force: :cascade do |t|
|
95
95
|
t.integer "parent_id", unsigned: true
|
96
|
-
t.index ["parent_id"], name: "par_id"
|
96
|
+
t.index ["parent_id"], name: "par_id"
|
97
97
|
end
|
98
98
|
|
99
99
|
add_foreign_key "child", "parent", name: "fk_rails_e74ce85cbc"
|
@@ -115,7 +115,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
115
115
|
let(:dsl) do
|
116
116
|
erbh(<<-ERB)
|
117
117
|
# Define parent before child
|
118
|
-
create_table "parent",
|
118
|
+
create_table "parent", id: :integer, force: :cascade do |t|
|
119
119
|
end
|
120
120
|
|
121
121
|
add_foreign_key "child", "parent", name: "fk_rails_e74ce85cbc"
|
@@ -4,12 +4,12 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
4
4
|
context 'when drop fk' do
|
5
5
|
let(:actual_dsl) do
|
6
6
|
erbh(<<-ERB)
|
7
|
-
create_table "parent",
|
7
|
+
create_table "parent", id: :integer, force: :cascade do |t|
|
8
8
|
end
|
9
9
|
|
10
10
|
create_table "child", force: :cascade do |t|
|
11
11
|
t.integer "parent_id"
|
12
|
-
t.index ["parent_id"], name: "par_id"
|
12
|
+
t.index ["parent_id"], name: "par_id"
|
13
13
|
end
|
14
14
|
|
15
15
|
add_foreign_key "child", "parent", name: "fk_rails_e74ce85cbc"
|
@@ -26,10 +26,10 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
26
26
|
erbh(<<-ERB)
|
27
27
|
create_table "child", force: :cascade do |t|
|
28
28
|
t.integer "parent_id"
|
29
|
-
t.index ["parent_id"], name: "par_id"
|
29
|
+
t.index ["parent_id"], name: "par_id"
|
30
30
|
end
|
31
31
|
|
32
|
-
create_table "parent",
|
32
|
+
create_table "parent", id: :integer, force: :cascade do |t|
|
33
33
|
end
|
34
34
|
ERB
|
35
35
|
end
|
@@ -60,12 +60,12 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
60
60
|
context 'when drop fk when drop table' do
|
61
61
|
let(:dsl) do
|
62
62
|
erbh(<<-ERB)
|
63
|
-
create_table "parent",
|
63
|
+
create_table "parent", id: :integer, force: :cascade do |t|
|
64
64
|
end
|
65
65
|
|
66
66
|
create_table "child", force: :cascade do |t|
|
67
67
|
t.integer "parent_id"
|
68
|
-
t.index ["parent_id"], name: "par_id"
|
68
|
+
t.index ["parent_id"], name: "par_id"
|
69
69
|
end
|
70
70
|
|
71
71
|
add_foreign_key "child", "parent", name: "fk_rails_e74ce85cbc"
|
@@ -76,10 +76,10 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
76
76
|
erbh(<<-ERB)
|
77
77
|
create_table "child", force: :cascade do |t|
|
78
78
|
t.integer "parent_id"
|
79
|
-
t.index ["parent_id"], name: "par_id"
|
79
|
+
t.index ["parent_id"], name: "par_id"
|
80
80
|
end
|
81
81
|
|
82
|
-
create_table "parent",
|
82
|
+
create_table "parent", id: :integer, force: :cascade do |t|
|
83
83
|
end
|
84
84
|
|
85
85
|
add_foreign_key "child", "parent", name: "fk_rails_e74ce85cbc"
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
describe 'Ridgepole::Client#diff -> migrate (with index)'
|
3
|
+
describe 'Ridgepole::Client#diff -> migrate (with index)' do
|
4
4
|
context 'when create table with auto increment column' do
|
5
5
|
let(:actual_dsl) { '' }
|
6
6
|
|
@@ -11,8 +11,8 @@ describe 'Ridgepole::Client#diff -> migrate (with index)', condition: '>= 5.1.0'
|
|
11
11
|
t.integer "dept_no", null: false, auto_increment: true
|
12
12
|
t.date "from_date", null: false
|
13
13
|
t.date "to_date", null: false
|
14
|
-
t.index ["dept_no"], name: "dept_no"
|
15
|
-
t.index ["emp_no"], name: "emp_no"
|
14
|
+
t.index ["dept_no"], name: "dept_no"
|
15
|
+
t.index ["emp_no"], name: "emp_no"
|
16
16
|
end
|
17
17
|
ERB
|
18
18
|
end
|
@@ -30,8 +30,8 @@ describe 'Ridgepole::Client#diff -> migrate (with index)', condition: '>= 5.1.0'
|
|
30
30
|
t.column("dept_no", :"integer", **{:null=>false, :auto_increment=>true, :limit=>4})
|
31
31
|
t.column("from_date", :"date", **{:null=>false})
|
32
32
|
t.column("to_date", :"date", **{:null=>false})
|
33
|
-
t.index(["dept_no"],
|
34
|
-
t.index(["emp_no"],
|
33
|
+
t.index(["dept_no"], **{:name=>"dept_no"})
|
34
|
+
t.index(["emp_no"], **{:name=>"emp_no"})
|
35
35
|
end
|
36
36
|
ERB
|
37
37
|
|
@@ -6,7 +6,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
6
6
|
erbh(<<-ERB)
|
7
7
|
create_table "books", force: :cascade do |t|
|
8
8
|
t.string "title", null: false
|
9
|
-
t.index ["title"], name: "index_books_on_title"
|
9
|
+
t.index ["title"], name: "index_books_on_title"
|
10
10
|
end
|
11
11
|
ERB
|
12
12
|
end
|
@@ -16,7 +16,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
16
16
|
create_table "books", force: :cascade do |t|
|
17
17
|
t.string "title", null: false
|
18
18
|
t.json "attrs", null: false
|
19
|
-
t.index ["title"], name: "index_books_on_title"
|
19
|
+
t.index ["title"], name: "index_books_on_title"
|
20
20
|
end
|
21
21
|
ERB
|
22
22
|
end
|
@@ -7,7 +7,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
7
7
|
create_table "books", force: :cascade do |t|
|
8
8
|
t.string "title", null: false
|
9
9
|
t.json "attrs", null: false
|
10
|
-
t.index ["title"], name: "index_books_on_title"
|
10
|
+
t.index ["title"], name: "index_books_on_title"
|
11
11
|
end
|
12
12
|
ERB
|
13
13
|
end
|
@@ -17,7 +17,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
17
17
|
create_table "books", force: :cascade do |t|
|
18
18
|
t.string "title", null: false
|
19
19
|
t.json "attrs"
|
20
|
-
t.index ["title"], name: "index_books_on_title"
|
20
|
+
t.index ["title"], name: "index_books_on_title"
|
21
21
|
end
|
22
22
|
ERB
|
23
23
|
end
|
@@ -40,7 +40,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
40
40
|
create_table "books", force: :cascade do |t|
|
41
41
|
t.string "title", null: false
|
42
42
|
t.json "attrs", null: false
|
43
|
-
t.index ["title"], name: "index_books_on_title"
|
43
|
+
t.index ["title"], name: "index_books_on_title"
|
44
44
|
end
|
45
45
|
ERB
|
46
46
|
end
|
@@ -50,7 +50,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
50
50
|
create_table "books", force: :cascade do |t|
|
51
51
|
t.string "title", null: false
|
52
52
|
t.string "attrs"
|
53
|
-
t.index ["title"], name: "index_books_on_title"
|
53
|
+
t.index ["title"], name: "index_books_on_title"
|
54
54
|
end
|
55
55
|
ERB
|
56
56
|
end
|
@@ -73,7 +73,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
73
73
|
create_table "books", force: :cascade do |t|
|
74
74
|
t.string "title", null: false
|
75
75
|
t.string "attrs"
|
76
|
-
t.index ["title"], name: "index_books_on_title"
|
76
|
+
t.index ["title"], name: "index_books_on_title"
|
77
77
|
end
|
78
78
|
ERB
|
79
79
|
end
|
@@ -83,7 +83,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
83
83
|
create_table "books", force: :cascade do |t|
|
84
84
|
t.string "title", null: false
|
85
85
|
t.json "attrs", null: false
|
86
|
-
t.index ["title"], name: "index_books_on_title"
|
86
|
+
t.index ["title"], name: "index_books_on_title"
|
87
87
|
end
|
88
88
|
ERB
|
89
89
|
end
|
@@ -7,7 +7,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
7
7
|
create_table "books", force: :cascade do |t|
|
8
8
|
t.string "title", null: false
|
9
9
|
t.json "attrs", null: false
|
10
|
-
t.index ["title"], name: "index_books_on_title"
|
10
|
+
t.index ["title"], name: "index_books_on_title"
|
11
11
|
end
|
12
12
|
ERB
|
13
13
|
end
|
@@ -16,7 +16,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
16
16
|
erbh(<<-ERB)
|
17
17
|
create_table "books", force: :cascade do |t|
|
18
18
|
t.string "title", null: false
|
19
|
-
t.index ["title"], name: "index_books_on_title"
|
19
|
+
t.index ["title"], name: "index_books_on_title"
|
20
20
|
end
|
21
21
|
ERB
|
22
22
|
end
|
@@ -7,14 +7,14 @@ describe 'Ridgepole::Client#dump' do
|
|
7
7
|
|
8
8
|
it {
|
9
9
|
expect(subject.dump).to match_fuzzy erbh(<<-ERB)
|
10
|
-
create_table "clubs",
|
10
|
+
create_table "clubs", id: :serial, force: :cascade do |t|
|
11
11
|
t.string "name", limit: 255, default: "", null: false
|
12
|
-
t.index ["name"], name: "idx_name", unique: true
|
12
|
+
t.index ["name"], name: "idx_name", unique: true
|
13
13
|
end
|
14
14
|
|
15
|
-
create_table "departments", primary_key: "dept_no", id: :string, limit: 4, force: :cascade do |t|
|
15
|
+
create_table "departments", primary_key: "dept_no", <%= i cond(">= 6.1", { id: { type: :string, limit: 4 } }, { id: :string, limit: 4 }) %>, force: :cascade do |t|
|
16
16
|
t.string "dept_name", limit: 40, null: false
|
17
|
-
t.index ["dept_name"], name: "idx_dept_name", unique: true
|
17
|
+
t.index ["dept_name"], name: "idx_dept_name", unique: true
|
18
18
|
end
|
19
19
|
|
20
20
|
create_table "dept_emp", primary_key: ["emp_no", "dept_no"], force: :cascade do |t|
|
@@ -22,8 +22,8 @@ describe 'Ridgepole::Client#dump' do
|
|
22
22
|
t.string "dept_no", limit: 4, null: false
|
23
23
|
t.date "from_date", null: false
|
24
24
|
t.date "to_date", null: false
|
25
|
-
t.index ["dept_no"], name: "idx_dept_emp_dept_no"
|
26
|
-
t.index ["emp_no"], name: "idx_dept_emp_emp_no"
|
25
|
+
t.index ["dept_no"], name: "idx_dept_emp_dept_no"
|
26
|
+
t.index ["emp_no"], name: "idx_dept_emp_emp_no"
|
27
27
|
end
|
28
28
|
|
29
29
|
create_table "dept_manager", primary_key: ["emp_no", "dept_no"], force: :cascade do |t|
|
@@ -31,17 +31,17 @@ describe 'Ridgepole::Client#dump' do
|
|
31
31
|
t.integer "emp_no", null: false
|
32
32
|
t.date "from_date", null: false
|
33
33
|
t.date "to_date", null: false
|
34
|
-
t.index ["dept_no"], name: "idx_dept_manager_dept_no"
|
35
|
-
t.index ["emp_no"], name: "idx_dept_manager_emp_no"
|
34
|
+
t.index ["dept_no"], name: "idx_dept_manager_dept_no"
|
35
|
+
t.index ["emp_no"], name: "idx_dept_manager_emp_no"
|
36
36
|
end
|
37
37
|
|
38
|
-
create_table "employee_clubs",
|
38
|
+
create_table "employee_clubs", id: :serial, force: :cascade do |t|
|
39
39
|
t.integer "emp_no", null: false
|
40
40
|
t.integer "club_id", null: false
|
41
|
-
t.index ["emp_no", "club_id"], name: "idx_employee_clubs_emp_no_club_id"
|
41
|
+
t.index ["emp_no", "club_id"], name: "idx_employee_clubs_emp_no_club_id"
|
42
42
|
end
|
43
43
|
|
44
|
-
create_table "employees", primary_key: "emp_no", id: :integer,
|
44
|
+
create_table "employees", primary_key: "emp_no", id: :integer, default: nil, force: :cascade do |t|
|
45
45
|
t.date "birth_date", null: false
|
46
46
|
t.string "first_name", limit: 14, null: false
|
47
47
|
t.string "last_name", limit: 16, null: false
|
@@ -53,7 +53,7 @@ describe 'Ridgepole::Client#dump' do
|
|
53
53
|
t.integer "salary", null: false
|
54
54
|
t.date "from_date", null: false
|
55
55
|
t.date "to_date", null: false
|
56
|
-
t.index ["emp_no"], name: "idx_salaries_emp_no"
|
56
|
+
t.index ["emp_no"], name: "idx_salaries_emp_no"
|
57
57
|
end
|
58
58
|
|
59
59
|
create_table "titles", primary_key: ["emp_no", "title", "from_date"], force: :cascade do |t|
|
@@ -61,7 +61,7 @@ describe 'Ridgepole::Client#dump' do
|
|
61
61
|
t.string "title", limit: 50, null: false
|
62
62
|
t.date "from_date", null: false
|
63
63
|
t.date "to_date"
|
64
|
-
t.index ["emp_no"], name: "idx_titles_emp_no"
|
64
|
+
t.index ["emp_no"], name: "idx_titles_emp_no"
|
65
65
|
end
|
66
66
|
ERB
|
67
67
|
}
|
@@ -9,7 +9,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
9
9
|
|
10
10
|
create_table "child", force: :cascade do |t|
|
11
11
|
t.integer "parent_id"
|
12
|
-
t.index ["parent_id"], name: "par_id"
|
12
|
+
t.index ["parent_id"], name: "par_id"
|
13
13
|
end
|
14
14
|
|
15
15
|
add_foreign_key "child", "parent", name: "child_ibfk_1", on_delete: :cascade
|
@@ -20,7 +20,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
20
20
|
erbh(<<-ERB)
|
21
21
|
create_table "child", force: :cascade do |t|
|
22
22
|
t.integer "parent_id"
|
23
|
-
t.index ["parent_id"], name: "par_id"
|
23
|
+
t.index ["parent_id"], name: "par_id"
|
24
24
|
end
|
25
25
|
|
26
26
|
create_table "parent", force: :cascade do |t|
|
@@ -34,7 +34,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
34
34
|
erbh(<<-ERB)
|
35
35
|
create_table "child", force: :cascade do |t|
|
36
36
|
t.integer "parent_id"
|
37
|
-
t.index ["parent_id"], name: "par_id"
|
37
|
+
t.index ["parent_id"], name: "par_id"
|
38
38
|
end
|
39
39
|
|
40
40
|
create_table "parent", force: :cascade do |t|
|
@@ -65,7 +65,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
65
65
|
|
66
66
|
create_table "child", force: :cascade do |t|
|
67
67
|
t.integer "parent_id"
|
68
|
-
t.index ["parent_id"], name: "par_id"
|
68
|
+
t.index ["parent_id"], name: "par_id"
|
69
69
|
end
|
70
70
|
|
71
71
|
add_foreign_key "child", "parent", on_delete: :cascade
|
@@ -76,7 +76,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
76
76
|
erbh(<<-ERB)
|
77
77
|
create_table "child", force: :cascade do |t|
|
78
78
|
t.integer "parent_id"
|
79
|
-
t.index ["parent_id"], name: "par_id"
|
79
|
+
t.index ["parent_id"], name: "par_id"
|
80
80
|
end
|
81
81
|
|
82
82
|
create_table "parent", force: :cascade do |t|
|
@@ -90,7 +90,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
90
90
|
erbh(<<-ERB)
|
91
91
|
create_table "child", force: :cascade do |t|
|
92
92
|
t.integer "parent_id"
|
93
|
-
t.index ["parent_id"], name: "par_id"
|
93
|
+
t.index ["parent_id"], name: "par_id"
|
94
94
|
end
|
95
95
|
|
96
96
|
create_table "parent", force: :cascade do |t|
|
@@ -6,7 +6,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
6
6
|
erbh(<<-ERB)
|
7
7
|
create_table "child", force: :cascade do |t|
|
8
8
|
t.integer "parent_id"
|
9
|
-
t.index ["parent_id"], name: "par_id"
|
9
|
+
t.index ["parent_id"], name: "par_id"
|
10
10
|
end
|
11
11
|
|
12
12
|
create_table "parent", force: :cascade do |t|
|
@@ -52,7 +52,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
52
52
|
|
53
53
|
create_table "child", force: :cascade do |t|
|
54
54
|
t.integer "parent_id", unsigned: true
|
55
|
-
t.index ["parent_id"], name: "par_id"
|
55
|
+
t.index ["parent_id"], name: "par_id"
|
56
56
|
end
|
57
57
|
|
58
58
|
add_foreign_key "child", "parent", name: "child_ibfk_1"
|
@@ -63,7 +63,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
63
63
|
erbh(<<-ERB)
|
64
64
|
create_table "child", force: :cascade do |t|
|
65
65
|
t.integer "parent_id"
|
66
|
-
t.index ["parent_id"], name: "par_id"
|
66
|
+
t.index ["parent_id"], name: "par_id"
|
67
67
|
end
|
68
68
|
|
69
69
|
create_table "parent", force: :cascade do |t|
|
@@ -94,7 +94,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
94
94
|
|
95
95
|
create_table "child", force: :cascade do |t|
|
96
96
|
t.integer "parent_id", unsigned: true
|
97
|
-
t.index ["parent_id"], name: "par_id"
|
97
|
+
t.index ["parent_id"], name: "par_id"
|
98
98
|
end
|
99
99
|
|
100
100
|
add_foreign_key "child", "parent", name: "child_ibfk_1"
|
@@ -117,7 +117,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
117
117
|
erbh(<<-ERB)
|
118
118
|
create_table "child", force: :cascade do |t|
|
119
119
|
t.integer "parent_id"
|
120
|
-
t.index ["parent_id"], name: "par_id"
|
120
|
+
t.index ["parent_id"], name: "par_id"
|
121
121
|
end
|
122
122
|
|
123
123
|
create_table "parent", force: :cascade do |t|
|