ridgepole 0.9.0.beta → 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 +19 -1
- data/.simplecov +6 -0
- data/README.md +4 -26
- data/bin/ridgepole +0 -2
- data/lib/ridgepole/diff.rb +7 -11
- data/lib/ridgepole/dsl_parser/table_definition.rb +1 -1
- data/lib/ridgepole/version.rb +1 -1
- data/ridgepole.gemspec +2 -1
- data/spec/erb_helper.rb +1 -5
- data/spec/mysql/bigint_pk/int_pk_spec.rb +1 -1
- data/spec/mysql/collation/collation_spec.rb +14 -14
- 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 +12 -12
- data/spec/mysql/dump/dump_some_tables_spec.rb +4 -4
- data/spec/mysql/dump/dump_spec.rb +12 -12
- data/spec/mysql/dump/dump_unknown_column_type_spec.rb +2 -2
- data/spec/mysql/dump/dump_without_table_options_spec.rb +1 -1
- 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 +18 -18
- 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 +21 -21
- 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 +10 -10
- 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_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 +27 -27
- data/spec/mysql/migrate/migrate_check_relation_column_type_spec.rb +1 -1
- 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 +1 -1
- 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 +12 -12
- 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 +1 -1
- 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 +12 -12
- 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 +16 -16
- data/spec/postgresql/migrate/migrate_add_expression_index_spec.rb +1 -1
- data/spec/postgresql/migrate/migrate_change_column_spec.rb +16 -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 +18 -18
- 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 +12 -12
- 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_helper.rb +1 -1
- metadata +33 -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/processing_for_travis.rb +0 -11
@@ -7,7 +7,7 @@ describe 'Ridgepole::Client#dump' do
|
|
7
7
|
|
8
8
|
it {
|
9
9
|
expect(subject.dump).to match_fuzzy erbh(<<-ERB)
|
10
|
-
create_table "employees", primary_key: "emp_no", id: :integer,
|
10
|
+
create_table "employees", primary_key: "emp_no", id: :integer, default: nil, force: :cascade do |t|
|
11
11
|
t.date "birth_date", null: false
|
12
12
|
t.string "first_name", limit: 14, null: false
|
13
13
|
t.string "last_name", limit: 16, null: false
|
@@ -24,7 +24,7 @@ describe 'Ridgepole::Client#dump' do
|
|
24
24
|
t.integer "salary", null: false
|
25
25
|
t.date "from_date", null: false
|
26
26
|
t.date "to_date", null: false
|
27
|
-
t.index ["emp_no"], name: "emp_no"
|
27
|
+
t.index ["emp_no"], name: "emp_no"
|
28
28
|
end
|
29
29
|
ERB
|
30
30
|
}
|
@@ -45,7 +45,7 @@ describe 'Ridgepole::Client#dump' do
|
|
45
45
|
|
46
46
|
it {
|
47
47
|
expect(subject.dump).to match_fuzzy erbh(<<-ERB)
|
48
|
-
create_table "employees", primary_key: "emp_no", id: :integer,
|
48
|
+
create_table "employees", primary_key: "emp_no", id: :integer, default: nil, force: :cascade do |t|
|
49
49
|
t.date "birth_date", null: false
|
50
50
|
t.string "first_name", limit: 14, null: false
|
51
51
|
t.string "last_name", limit: 16, null: false
|
@@ -62,7 +62,7 @@ describe 'Ridgepole::Client#dump' do
|
|
62
62
|
t.integer "salary", null: false
|
63
63
|
t.date "from_date", null: false
|
64
64
|
t.date "to_date", null: false
|
65
|
-
t.index ["emp_no"], name: "emp_no"
|
65
|
+
t.index ["emp_no"], name: "emp_no"
|
66
66
|
end
|
67
67
|
ERB
|
68
68
|
}
|
@@ -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", <%= i cond(
|
10
|
+
create_table "clubs", <%= i cond('< 6.1', { id: :integer, unsigned: true }, { id: { type: :integer, unsigned: true } }) %>, force: :cascade do |t|
|
11
11
|
t.string "name", 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
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: "dept_name", unique: true
|
17
|
+
t.index ["dept_name"], name: "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: "dept_no"
|
26
|
-
t.index ["emp_no"], name: "emp_no"
|
25
|
+
t.index ["dept_no"], name: "dept_no"
|
26
|
+
t.index ["emp_no"], name: "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: "dept_no"
|
35
|
-
t.index ["emp_no"], name: "emp_no"
|
34
|
+
t.index ["dept_no"], name: "dept_no"
|
35
|
+
t.index ["emp_no"], name: "emp_no"
|
36
36
|
end
|
37
37
|
|
38
|
-
create_table "employee_clubs", <%= i cond(
|
38
|
+
create_table "employee_clubs", <%= i cond('< 6.1', { id: :integer, unsigned: true }, { id: { type: :integer, unsigned: true } }) %>, force: :cascade do |t|
|
39
39
|
t.integer "emp_no", null: false, unsigned: true
|
40
40
|
t.integer "club_id", null: false, unsigned: true
|
41
|
-
t.index ["emp_no", "club_id"], name: "idx_emp_no_club_id"
|
41
|
+
t.index ["emp_no", "club_id"], name: "idx_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
|
@@ -58,7 +58,7 @@ describe 'Ridgepole::Client#dump' do
|
|
58
58
|
t.integer "salary", null: false
|
59
59
|
t.date "from_date", null: false
|
60
60
|
t.date "to_date", null: false
|
61
|
-
t.index ["emp_no"], name: "emp_no"
|
61
|
+
t.index ["emp_no"], name: "emp_no"
|
62
62
|
end
|
63
63
|
|
64
64
|
create_table "titles", primary_key: ["emp_no", "title", "from_date"], force: :cascade do |t|
|
@@ -66,7 +66,7 @@ describe 'Ridgepole::Client#dump' do
|
|
66
66
|
t.string "title", limit: 50, null: false
|
67
67
|
t.date "from_date", null: false
|
68
68
|
t.date "to_date"
|
69
|
-
t.index ["emp_no"], name: "emp_no"
|
69
|
+
t.index ["emp_no"], name: "emp_no"
|
70
70
|
end
|
71
71
|
ERB
|
72
72
|
}
|
@@ -7,9 +7,9 @@ describe 'Ridgepole::Client#dump' do
|
|
7
7
|
|
8
8
|
it {
|
9
9
|
expect(subject.dump).to match_fuzzy erbh(<<-ERB)
|
10
|
-
create_table "clubs", <%= i cond(
|
10
|
+
create_table "clubs", <%= i cond('< 6.1', { id: :integer, unsigned: true }, { id: { type: :integer, unsigned: true } }) %>, force: :cascade do |t|
|
11
11
|
t.string "name", 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
|
ERB
|
15
15
|
}
|
@@ -15,7 +15,7 @@ describe 'Ridgepole::Client#dump' do
|
|
15
15
|
context 'when without table options' do
|
16
16
|
let(:expected_dsl) do
|
17
17
|
erbh(<<-ERB)
|
18
|
-
create_table "books", <%= i cond(
|
18
|
+
create_table "books", <%= i cond('>= 6.1', { id: { type: :bigint, unsigned: true } }, { id: :bigint, unsigned: true }) %>, force: :cascade, comment: "\\"london\\" bridge \\"is\\" falling \\"down\\"" do |t|
|
19
19
|
t.string "title", null: false
|
20
20
|
t.integer "author_id", null: false
|
21
21
|
t.datetime "created_at"
|
@@ -22,12 +22,12 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
22
22
|
erbh(<<-ERB)
|
23
23
|
create_table "lessons", force: :cascade do |t|
|
24
24
|
t.bigint "user_id2", null: false
|
25
|
-
t.index ["user_id2"], name: "index_lessons_on_user_id2"
|
25
|
+
t.index ["user_id2"], name: "index_lessons_on_user_id2"
|
26
26
|
end
|
27
27
|
|
28
28
|
create_table "users", id: false, force: :cascade do |t|
|
29
29
|
t.bigint "my_original_id", null: false
|
30
|
-
t.index ["my_original_id"], name: "index_users_on_my_original_id", unique: true
|
30
|
+
t.index ["my_original_id"], name: "index_users_on_my_original_id", unique: true
|
31
31
|
end
|
32
32
|
|
33
33
|
add_foreign_key "lessons", "users", primary_key: "my_original_id", column: "user_id2"
|
@@ -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: "child_ibfk_1", 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: "child_ibfk_1", 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: "child_ibfk_1"
|
@@ -60,12 +60,12 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
60
60
|
context 'when change fk without name' do
|
61
61
|
let(:actual_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", on_delete: :cascade
|
@@ -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", on_delete: :cascade
|
@@ -90,10 +90,10 @@ 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
|
-
create_table "parent",
|
96
|
+
create_table "parent", id: :integer, force: :cascade do |t|
|
97
97
|
end
|
98
98
|
|
99
99
|
add_foreign_key "child", "parent"
|
@@ -118,10 +118,10 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
118
118
|
erbh(<<-ERB)
|
119
119
|
create_table "child", force: :cascade do |t|
|
120
120
|
t.integer "parent_id"
|
121
|
-
t.index ["parent_id"], name: "par_id"
|
121
|
+
t.index ["parent_id"], name: "par_id"
|
122
122
|
end
|
123
123
|
|
124
|
-
create_table "parent",
|
124
|
+
create_table "parent", id: :integer, force: :cascade do |t|
|
125
125
|
end
|
126
126
|
|
127
127
|
add_foreign_key "child", "parent", name: "child_ibfk_1"
|
@@ -132,10 +132,10 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
132
132
|
erbh(<<-ERB)
|
133
133
|
create_table "child", force: :cascade do |t|
|
134
134
|
t.integer "parent2_id"
|
135
|
-
t.index ["parent2_id"], name: "par2_id"
|
135
|
+
t.index ["parent2_id"], name: "par2_id"
|
136
136
|
end
|
137
137
|
|
138
|
-
create_table "parent2",
|
138
|
+
create_table "parent2", id: :integer, force: :cascade do |t|
|
139
139
|
end
|
140
140
|
|
141
141
|
add_foreign_key "child", "parent2", name: "child_ibfk_2"
|
@@ -159,10 +159,10 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
159
159
|
erbh(<<-ERB)
|
160
160
|
create_table "child", force: :cascade do |t|
|
161
161
|
t.integer "parent_id"
|
162
|
-
t.index ["parent_id"], name: "par_id"
|
162
|
+
t.index ["parent_id"], name: "par_id"
|
163
163
|
end
|
164
164
|
|
165
|
-
create_table "parent",
|
165
|
+
create_table "parent", id: :integer, force: :cascade do |t|
|
166
166
|
end
|
167
167
|
|
168
168
|
add_foreign_key "child", "parent"
|
@@ -173,10 +173,10 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
173
173
|
erbh(<<-ERB)
|
174
174
|
create_table "child", force: :cascade do |t|
|
175
175
|
t.integer "parent2_id"
|
176
|
-
t.index ["parent2_id"], name: "par2_id"
|
176
|
+
t.index ["parent2_id"], name: "par2_id"
|
177
177
|
end
|
178
178
|
|
179
|
-
create_table "parent2",
|
179
|
+
create_table "parent2", id: :integer, force: :cascade do |t|
|
180
180
|
end
|
181
181
|
|
182
182
|
add_foreign_key "child", "parent2"
|
@@ -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
|
@@ -48,12 +48,12 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
48
48
|
erbh(<<-ERB)
|
49
49
|
create_table "child", force: :cascade do |t|
|
50
50
|
t.integer "parent_id"
|
51
|
-
t.index ["parent_id"], name: "par_id"
|
51
|
+
t.index ["parent_id"], name: "par_id"
|
52
52
|
end
|
53
53
|
|
54
54
|
add_foreign_key "child", "parent", name: "child_ibfk_1"
|
55
55
|
|
56
|
-
create_table "parent",
|
56
|
+
create_table "parent", id: :integer, force: :cascade do |t|
|
57
57
|
end
|
58
58
|
ERB
|
59
59
|
end
|
@@ -62,10 +62,10 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
62
62
|
erbh(<<-ERB)
|
63
63
|
create_table "child", force: :cascade do |t|
|
64
64
|
t.integer "parent_id"
|
65
|
-
t.index ["parent_id"], name: "par_id"
|
65
|
+
t.index ["parent_id"], name: "par_id"
|
66
66
|
end
|
67
67
|
|
68
|
-
create_table "parent",
|
68
|
+
create_table "parent", id: :integer, force: :cascade do |t|
|
69
69
|
end
|
70
70
|
|
71
71
|
add_foreign_key "child", "parent", name: "child_ibfk_1"
|
@@ -88,14 +88,14 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
88
88
|
erbh(<<-ERB)
|
89
89
|
create_table "child", force: :cascade do |t|
|
90
90
|
t.integer "parent_id", unsigned: true
|
91
|
-
t.index ["parent_id"], name: "par_id"
|
91
|
+
t.index ["parent_id"], name: "par_id"
|
92
92
|
end
|
93
93
|
|
94
94
|
add_foreign_key "child", "parent", name: "child_ibfk_1"
|
95
95
|
|
96
96
|
add_foreign_key "child", "parent", name: "child_ibfk_1"
|
97
97
|
|
98
|
-
create_table "parent",
|
98
|
+
create_table "parent", id: :integer, force: :cascade do |t|
|
99
99
|
end
|
100
100
|
ERB
|
101
101
|
end
|
@@ -114,10 +114,10 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
114
114
|
erbh(<<-ERB)
|
115
115
|
create_table "child", force: :cascade do |t|
|
116
116
|
t.integer "parent_id"
|
117
|
-
t.index ["parent_id"], name: "par_id"
|
117
|
+
t.index ["parent_id"], name: "par_id"
|
118
118
|
end
|
119
119
|
|
120
|
-
create_table "parent",
|
120
|
+
create_table "parent", id: :integer, force: :cascade do |t|
|
121
121
|
end
|
122
122
|
ERB
|
123
123
|
end
|
@@ -156,7 +156,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
156
156
|
erbh(<<-ERB)
|
157
157
|
add_foreign_key "child", "parent", name: "child_ibfk_1"
|
158
158
|
|
159
|
-
create_table "parent",
|
159
|
+
create_table "parent", id: :integer, force: :cascade do |t|
|
160
160
|
end
|
161
161
|
ERB
|
162
162
|
end
|
@@ -173,7 +173,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
173
173
|
context 'when create fk without any indexes for its column' do
|
174
174
|
let(:dsl) do
|
175
175
|
erbh(<<-ERB)
|
176
|
-
create_table "parent",
|
176
|
+
create_table "parent", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
|
177
177
|
end
|
178
178
|
|
179
179
|
create_table "child", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
|
@@ -195,13 +195,13 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
195
195
|
context 'when create fk with first key of multiple column indexes for its column' do
|
196
196
|
let(:dsl) do
|
197
197
|
erbh(<<-ERB)
|
198
|
-
create_table "parent",
|
198
|
+
create_table "parent", id: :integer, force: :cascade, <%= i cond('>= 6.1', { charset: 'utf8' }, { options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" }) %> do |t|
|
199
199
|
end
|
200
200
|
|
201
201
|
create_table "child", force: :cascade, <%= i cond('>= 6.1', { charset: 'utf8' }, { options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" }) %> do |t|
|
202
202
|
t.integer "parent_id"
|
203
203
|
t.string "name"
|
204
|
-
t.index ["parent_id", "name"], name: "par_id"
|
204
|
+
t.index ["parent_id", "name"], name: "par_id"
|
205
205
|
end
|
206
206
|
add_foreign_key "child", "parent", name: "child_ibfk_1"
|
207
207
|
ERB
|
@@ -243,10 +243,10 @@ end
|
|
243
243
|
context 'when create fk on the first primary key' do
|
244
244
|
let(:dsl) do
|
245
245
|
erbh(<<-ERB)
|
246
|
-
create_table "users",
|
246
|
+
create_table "users", id: :integer, force: :cascade, <%= i cond('>= 6.1', { charset: 'utf8' }, { options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" }) %> do |t|
|
247
247
|
end
|
248
248
|
|
249
|
-
create_table "employee",
|
249
|
+
create_table "employee", id: :integer, force: :cascade, <%= i cond('>= 6.1', { charset: 'utf8' }, { options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" }) %> do |t|
|
250
250
|
end
|
251
251
|
|
252
252
|
create_table "icons", primary_key: ["user_id", "employee_id"], force: :cascade, <%= i cond('>= 6.1', { charset: 'utf8' }, { options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" }) %> do |t|
|
@@ -270,10 +270,10 @@ end
|
|
270
270
|
context 'when create fk on the second primary key' do
|
271
271
|
let(:dsl) do
|
272
272
|
erbh(<<-ERB)
|
273
|
-
create_table "users",
|
273
|
+
create_table "users", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
|
274
274
|
end
|
275
275
|
|
276
|
-
create_table "employee",
|
276
|
+
create_table "employee", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
|
277
277
|
end
|
278
278
|
|
279
279
|
create_table "icons", primary_key: ["user_id", "employee_id"], force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
|
@@ -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: "child_ibfk_1"
|
@@ -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,16 +60,16 @@ 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 "users",
|
63
|
+
create_table "users", id: :integer, force: :cascade do |t|
|
64
64
|
t.integer "invitation_id"
|
65
|
-
t.index ["invitation_id"], name: "idx_invitation_id"
|
65
|
+
t.index ["invitation_id"], name: "idx_invitation_id"
|
66
66
|
end
|
67
67
|
|
68
68
|
add_foreign_key "users", "invitations", name: "users_ibfk"
|
69
69
|
|
70
|
-
create_table "invitations",
|
70
|
+
create_table "invitations", id: :integer, force: :cascade do |t|
|
71
71
|
t.integer "user_id"
|
72
|
-
t.index ["user_id"], name: "idx_user_id"
|
72
|
+
t.index ["user_id"], name: "idx_user_id"
|
73
73
|
end
|
74
74
|
|
75
75
|
add_foreign_key "invitations", "users", name: "invitations_ibfk"
|
@@ -78,14 +78,14 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
78
78
|
|
79
79
|
let(:sorted_dsl) do
|
80
80
|
erbh(<<-ERB)
|
81
|
-
create_table "invitations",
|
81
|
+
create_table "invitations", id: :integer, force: :cascade do |t|
|
82
82
|
t.integer "user_id"
|
83
|
-
t.index ["user_id"], name: "idx_user_id"
|
83
|
+
t.index ["user_id"], name: "idx_user_id"
|
84
84
|
end
|
85
85
|
|
86
|
-
create_table "users",
|
86
|
+
create_table "users", id: :integer, force: :cascade do |t|
|
87
87
|
t.integer "invitation_id"
|
88
|
-
t.index ["invitation_id"], name: "idx_invitation_id"
|
88
|
+
t.index ["invitation_id"], name: "idx_invitation_id"
|
89
89
|
end
|
90
90
|
|
91
91
|
add_foreign_key "invitations", "users", name: "invitations_ibfk"
|
@@ -108,12 +108,12 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
108
108
|
context 'when drop fk without name' do
|
109
109
|
let(:actual_dsl) do
|
110
110
|
erbh(<<-ERB)
|
111
|
-
create_table "parent",
|
111
|
+
create_table "parent", id: :integer, force: :cascade do |t|
|
112
112
|
end
|
113
113
|
|
114
114
|
create_table "child", force: :cascade do |t|
|
115
115
|
t.integer "parent_id"
|
116
|
-
t.index ["parent_id"], name: "par_id"
|
116
|
+
t.index ["parent_id"], name: "par_id"
|
117
117
|
end
|
118
118
|
|
119
119
|
add_foreign_key "child", "parent"
|
@@ -130,10 +130,10 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
130
130
|
erbh(<<-ERB)
|
131
131
|
create_table "child", force: :cascade do |t|
|
132
132
|
t.integer "parent_id"
|
133
|
-
t.index ["parent_id"], name: "par_id"
|
133
|
+
t.index ["parent_id"], name: "par_id"
|
134
134
|
end
|
135
135
|
|
136
|
-
create_table "parent",
|
136
|
+
create_table "parent", id: :integer, force: :cascade do |t|
|
137
137
|
end
|
138
138
|
ERB
|
139
139
|
end
|
@@ -164,12 +164,12 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
164
164
|
context 'when drop fk when drop table without name' do
|
165
165
|
let(:dsl) do
|
166
166
|
erbh(<<-ERB)
|
167
|
-
create_table "parent",
|
167
|
+
create_table "parent", id: :integer, force: :cascade do |t|
|
168
168
|
end
|
169
169
|
|
170
170
|
create_table "child", force: :cascade do |t|
|
171
171
|
t.integer "parent_id"
|
172
|
-
t.index ["parent_id"], name: "par_id"
|
172
|
+
t.index ["parent_id"], name: "par_id"
|
173
173
|
end
|
174
174
|
|
175
175
|
add_foreign_key "child", "parent"
|
@@ -180,10 +180,10 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
180
180
|
erbh(<<-ERB)
|
181
181
|
create_table "child", force: :cascade do |t|
|
182
182
|
t.integer "parent_id"
|
183
|
-
t.index ["parent_id"], name: "par_id"
|
183
|
+
t.index ["parent_id"], name: "par_id"
|
184
184
|
end
|
185
185
|
|
186
|
-
create_table "parent",
|
186
|
+
create_table "parent", id: :integer, force: :cascade do |t|
|
187
187
|
end
|
188
188
|
|
189
189
|
add_foreign_key "child", "parent"
|
@@ -207,10 +207,10 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
207
207
|
erbh(<<-ERB)
|
208
208
|
create_table "child", force: :cascade do |t|
|
209
209
|
t.integer "parent_id"
|
210
|
-
t.index ["parent_id"], name: "par_id"
|
210
|
+
t.index ["parent_id"], name: "par_id"
|
211
211
|
end
|
212
212
|
|
213
|
-
create_table "parent",
|
213
|
+
create_table "parent", id: :integer, force: :cascade do |t|
|
214
214
|
end
|
215
215
|
|
216
216
|
add_foreign_key "child", "parent", name: "child_ibfk_1"
|
@@ -221,7 +221,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
221
221
|
erbh(<<-ERB)
|
222
222
|
create_table "child", force: :cascade do |t|
|
223
223
|
t.integer "parent_id"
|
224
|
-
t.index ["parent_id"], name: "par_id"
|
224
|
+
t.index ["parent_id"], name: "par_id"
|
225
225
|
end
|
226
226
|
ERB
|
227
227
|
end
|
@@ -243,10 +243,10 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
243
243
|
erbh(<<-ERB)
|
244
244
|
create_table "child", force: :cascade do |t|
|
245
245
|
t.integer "parent_id"
|
246
|
-
t.index ["parent_id"], name: "par_id"
|
246
|
+
t.index ["parent_id"], name: "par_id"
|
247
247
|
end
|
248
248
|
|
249
|
-
create_table "parent",
|
249
|
+
create_table "parent", id: :integer, force: :cascade do |t|
|
250
250
|
end
|
251
251
|
|
252
252
|
add_foreign_key "child", "parent"
|
@@ -257,7 +257,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
257
257
|
erbh(<<-ERB)
|
258
258
|
create_table "child", force: :cascade do |t|
|
259
259
|
t.integer "parent_id"
|
260
|
-
t.index ["parent_id"], name: "par_id"
|
260
|
+
t.index ["parent_id"], name: "par_id"
|
261
261
|
end
|
262
262
|
ERB
|
263
263
|
end
|