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
@@ -6,12 +6,12 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
6
6
|
erbh(<<-ERB)
|
7
7
|
create_table "clubs", force: :cascade do |t|
|
8
8
|
t.string "name", default: "", null: false
|
9
|
-
t.index ["name"], name: "idx_name", unique: true
|
9
|
+
t.index ["name"], name: "idx_name", unique: true
|
10
10
|
end
|
11
11
|
|
12
12
|
create_table "departments", primary_key: "dept_no", force: :cascade do |t|
|
13
13
|
t.string "dept_name", limit: 40, null: false
|
14
|
-
t.index ["dept_name"], name: "dept_name", unique: true
|
14
|
+
t.index ["dept_name"], name: "dept_name", unique: true
|
15
15
|
end
|
16
16
|
|
17
17
|
create_table "dept_emp", id: false, force: :cascade do |t|
|
@@ -19,8 +19,8 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
19
19
|
t.string "dept_no", null: false
|
20
20
|
t.date "from_date", null: false
|
21
21
|
t.date "to_date", null: false
|
22
|
-
t.index ["dept_no"], name: "dept_no"
|
23
|
-
t.index ["emp_no"], name: "emp_no"
|
22
|
+
t.index ["dept_no"], name: "dept_no"
|
23
|
+
t.index ["emp_no"], name: "emp_no"
|
24
24
|
end
|
25
25
|
|
26
26
|
create_table "dept_manager", id: false, force: :cascade do |t|
|
@@ -28,14 +28,14 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
28
28
|
t.integer "emp_no", null: false
|
29
29
|
t.date "from_date", null: false
|
30
30
|
t.date "to_date", null: false
|
31
|
-
t.index ["dept_no"], name: "dept_no"
|
32
|
-
t.index ["emp_no"], name: "emp_no"
|
31
|
+
t.index ["dept_no"], name: "dept_no"
|
32
|
+
t.index ["emp_no"], name: "emp_no"
|
33
33
|
end
|
34
34
|
|
35
35
|
create_table "employee_clubs", force: :cascade do |t|
|
36
36
|
t.integer "emp_no", null: false
|
37
37
|
t.integer "club_id", null: false
|
38
|
-
t.index ["emp_no", "club_id"], name: "idx_emp_no_club_id"
|
38
|
+
t.index ["emp_no", "club_id"], name: "idx_emp_no_club_id"
|
39
39
|
end
|
40
40
|
|
41
41
|
create_table "employees", primary_key: "emp_no", force: :cascade do |t|
|
@@ -51,7 +51,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
51
51
|
t.integer "salary", null: false
|
52
52
|
t.date "from_date", null: false
|
53
53
|
t.date "to_date", null: false
|
54
|
-
t.index ["emp_no"], name: "emp_no"
|
54
|
+
t.index ["emp_no"], name: "emp_no"
|
55
55
|
end
|
56
56
|
|
57
57
|
create_table "titles", id: false, force: :cascade do |t|
|
@@ -59,7 +59,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
59
59
|
t.string "title", limit: 50, null: false
|
60
60
|
t.date "from_date", null: false
|
61
61
|
t.date "to_date"
|
62
|
-
t.index ["emp_no"], name: "emp_no"
|
62
|
+
t.index ["emp_no"], name: "emp_no"
|
63
63
|
end
|
64
64
|
ERB
|
65
65
|
end
|
@@ -70,7 +70,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
70
70
|
erbh(<<-ERB)
|
71
71
|
create_table "departments", primary_key: "dept_no", force: :cascade do |t|
|
72
72
|
t.string "dept_name", limit: 40, null: false
|
73
|
-
t.index ["dept_name"], name: "dept_name", unique: true
|
73
|
+
t.index ["dept_name"], name: "dept_name", unique: true
|
74
74
|
end
|
75
75
|
|
76
76
|
create_table "dept_emp", id: false, force: :cascade do |t|
|
@@ -78,8 +78,8 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
78
78
|
t.string "dept_no", null: false
|
79
79
|
t.date "from_date", null: false
|
80
80
|
t.date "to_date", null: false
|
81
|
-
t.index ["dept_no"], name: "dept_no"
|
82
|
-
t.index ["emp_no"], name: "emp_no"
|
81
|
+
t.index ["dept_no"], name: "dept_no"
|
82
|
+
t.index ["emp_no"], name: "emp_no"
|
83
83
|
end
|
84
84
|
|
85
85
|
create_table "dept_manager", id: false, force: :cascade do |t|
|
@@ -87,8 +87,8 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
87
87
|
t.integer "emp_no", null: false
|
88
88
|
t.date "from_date", null: false
|
89
89
|
t.date "to_date", null: false
|
90
|
-
t.index ["dept_no"], name: "dept_no"
|
91
|
-
t.index ["emp_no"], name: "emp_no"
|
90
|
+
t.index ["dept_no"], name: "dept_no"
|
91
|
+
t.index ["emp_no"], name: "emp_no"
|
92
92
|
end
|
93
93
|
|
94
94
|
create_table "salaries", id: false, force: :cascade do |t|
|
@@ -96,7 +96,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
96
96
|
t.integer "salary", null: false
|
97
97
|
t.date "from_date", null: false
|
98
98
|
t.date "to_date", null: false
|
99
|
-
t.index ["emp_no"], name: "emp_no"
|
99
|
+
t.index ["emp_no"], name: "emp_no"
|
100
100
|
end
|
101
101
|
|
102
102
|
create_table "titles", id: false, force: :cascade do |t|
|
@@ -104,7 +104,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
104
104
|
t.string "title", limit: 50, null: false
|
105
105
|
t.date "from_date", null: false
|
106
106
|
t.date "to_date"
|
107
|
-
t.index ["emp_no"], name: "emp_no"
|
107
|
+
t.index ["emp_no"], name: "emp_no"
|
108
108
|
end
|
109
109
|
ERB
|
110
110
|
end
|
@@ -7,12 +7,12 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
7
7
|
erbh(<<-ERB)
|
8
8
|
create_table "clubs", force: :cascade do |t|
|
9
9
|
t.string "name", default: "", null: false
|
10
|
-
t.index ["name"], name: "idx_name", unique: true
|
10
|
+
t.index ["name"], name: "idx_name", unique: true
|
11
11
|
end
|
12
12
|
|
13
13
|
create_table "departments", primary_key: "dept_no", force: :cascade do |t|
|
14
14
|
t.string "dept_name", limit: 40, null: false
|
15
|
-
t.index ["dept_name"], name: "dept_name", unique: true
|
15
|
+
t.index ["dept_name"], name: "dept_name", unique: true
|
16
16
|
end
|
17
17
|
|
18
18
|
create_table "dept_emp", id: false, force: :cascade do |t|
|
@@ -20,8 +20,8 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
20
20
|
t.string "dept_no", null: false
|
21
21
|
t.date "from_date", null: false
|
22
22
|
t.date "to_date", null: false
|
23
|
-
t.index ["dept_no"], name: "dept_no"
|
24
|
-
t.index ["emp_no"], name: "emp_no"
|
23
|
+
t.index ["dept_no"], name: "dept_no"
|
24
|
+
t.index ["emp_no"], name: "emp_no"
|
25
25
|
end
|
26
26
|
|
27
27
|
create_table "dept_manager", id: false, force: :cascade do |t|
|
@@ -29,14 +29,14 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
29
29
|
t.integer "emp_no", null: false
|
30
30
|
t.date "from_date", null: false
|
31
31
|
t.date "to_date", null: false
|
32
|
-
t.index ["dept_no"], name: "dept_no"
|
33
|
-
t.index ["emp_no"], name: "emp_no"
|
32
|
+
t.index ["dept_no"], name: "dept_no"
|
33
|
+
t.index ["emp_no"], name: "emp_no"
|
34
34
|
end
|
35
35
|
|
36
36
|
create_table "employee_clubs", force: :cascade do |t|
|
37
37
|
t.integer "emp_no", null: false
|
38
38
|
t.integer "club_id", null: false
|
39
|
-
t.index ["emp_no", "club_id"], name: "idx_emp_no_club_id"
|
39
|
+
t.index ["emp_no", "club_id"], name: "idx_emp_no_club_id"
|
40
40
|
end
|
41
41
|
|
42
42
|
create_table "employees", primary_key: "emp_no", force: :cascade do |t|
|
@@ -52,7 +52,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
52
52
|
t.integer "salary", null: false
|
53
53
|
t.date "from_date", null: false
|
54
54
|
t.date "to_date", null: false
|
55
|
-
t.index ["emp_no"], name: "emp_no"
|
55
|
+
t.index ["emp_no"], name: "emp_no"
|
56
56
|
end
|
57
57
|
|
58
58
|
create_table "titles", id: false, force: :cascade do |t|
|
@@ -60,7 +60,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
60
60
|
t.string "title", limit: 50, null: false
|
61
61
|
t.date "from_date", null: false
|
62
62
|
t.date "to_date"
|
63
|
-
t.index ["emp_no"], name: "emp_no"
|
63
|
+
t.index ["emp_no"], name: "emp_no"
|
64
64
|
end
|
65
65
|
ERB
|
66
66
|
end
|
@@ -4,28 +4,28 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
4
4
|
context 'when execute' do
|
5
5
|
let(:dsl) do
|
6
6
|
erbh(<<-ERB)
|
7
|
-
create_table "authors",
|
7
|
+
create_table "authors", id: :integer, force: :cascade do |t|
|
8
8
|
t.string "name", null: false
|
9
9
|
end
|
10
10
|
|
11
|
-
create_table "books",
|
11
|
+
create_table "books", id: :integer, force: :cascade do |t|
|
12
12
|
t.string "title", null: false
|
13
13
|
t.integer "author_id", null: false
|
14
|
-
t.index ["author_id"], name: "idx_author_id"
|
14
|
+
t.index ["author_id"], name: "idx_author_id"
|
15
15
|
end
|
16
16
|
ERB
|
17
17
|
end
|
18
18
|
|
19
19
|
let(:dsl_with_execute) do
|
20
20
|
erbh(<<-ERB)
|
21
|
-
create_table "authors",
|
21
|
+
create_table "authors", id: :integer, force: :cascade do |t|
|
22
22
|
t.string "name", null: false
|
23
23
|
end
|
24
24
|
|
25
|
-
create_table "books",
|
25
|
+
create_table "books", id: :integer, force: :cascade do |t|
|
26
26
|
t.string "title", null: false
|
27
27
|
t.integer "author_id", null: false
|
28
|
-
t.index ["author_id"], name: "idx_author_id"
|
28
|
+
t.index ["author_id"], name: "idx_author_id"
|
29
29
|
end
|
30
30
|
|
31
31
|
execute("ALTER TABLE books ADD CONSTRAINT fk_author FOREIGN KEY (author_id) REFERENCES authors (id)") do |c|
|
@@ -48,7 +48,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
48
48
|
`title` varchar(255) NOT NULL,
|
49
49
|
`author_id` int(11) NOT NULL,
|
50
50
|
PRIMARY KEY (`id`),
|
51
|
-
KEY `idx_author_id` (`author_id`)
|
51
|
+
KEY `idx_author_id` (`author_id`)
|
52
52
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8
|
53
53
|
ERB
|
54
54
|
|
@@ -64,7 +64,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
64
64
|
`title` varchar(255) NOT NULL,
|
65
65
|
`author_id` int(11) NOT NULL,
|
66
66
|
PRIMARY KEY (`id`),
|
67
|
-
KEY `idx_author_id` (`author_id`)
|
67
|
+
KEY `idx_author_id` (`author_id`),
|
68
68
|
CONSTRAINT `fk_author` FOREIGN KEY (`author_id`) REFERENCES `authors` (`id`)
|
69
69
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8
|
70
70
|
ERB
|
@@ -74,14 +74,14 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
74
74
|
context 'when not execute' do
|
75
75
|
let(:dsl) do
|
76
76
|
erbh(<<-ERB)
|
77
|
-
create_table "authors",
|
77
|
+
create_table "authors", id: :integer, force: :cascade do |t|
|
78
78
|
t.string "name", null: false
|
79
79
|
end
|
80
80
|
|
81
|
-
create_table "books",
|
81
|
+
create_table "books", id: :integer, force: :cascade do |t|
|
82
82
|
t.string "title", null: false
|
83
83
|
t.integer "author_id", null: false
|
84
|
-
t.index ["author_id"], name: "idx_author_id"
|
84
|
+
t.index ["author_id"], name: "idx_author_id"
|
85
85
|
end
|
86
86
|
add_foreign_key "books", "authors", name: "fk_author"
|
87
87
|
ERB
|
@@ -89,14 +89,14 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
89
89
|
|
90
90
|
let(:dsl_with_execute) do
|
91
91
|
erbh(<<-ERB)
|
92
|
-
create_table "authors",
|
92
|
+
create_table "authors", id: :integer, force: :cascade do |t|
|
93
93
|
t.string "name", null: false
|
94
94
|
end
|
95
95
|
|
96
|
-
create_table "books",
|
96
|
+
create_table "books", id: :integer, force: :cascade do |t|
|
97
97
|
t.string "title", null: false
|
98
98
|
t.integer "author_id", null: false
|
99
|
-
t.index ["author_id"], name: "idx_author_id"
|
99
|
+
t.index ["author_id"], name: "idx_author_id"
|
100
100
|
end
|
101
101
|
|
102
102
|
execute("ALTER TABLE books ADD CONSTRAINT fk_author FOREIGN KEY (author_id) REFERENCES authors (id)") do |c|
|
@@ -121,7 +121,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
121
121
|
`title` varchar(255) NOT NULL,
|
122
122
|
`author_id` int(11) NOT NULL,
|
123
123
|
PRIMARY KEY (`id`),
|
124
|
-
KEY `idx_author_id` (`author_id`)
|
124
|
+
KEY `idx_author_id` (`author_id`),
|
125
125
|
CONSTRAINT `fk_author` FOREIGN KEY (`author_id`) REFERENCES `authors` (`id`)
|
126
126
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8
|
127
127
|
ERB
|
@@ -136,7 +136,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
136
136
|
`title` varchar(255) NOT NULL,
|
137
137
|
`author_id` int(11) NOT NULL,
|
138
138
|
PRIMARY KEY (`id`),
|
139
|
-
KEY `idx_author_id` (`author_id`)
|
139
|
+
KEY `idx_author_id` (`author_id`),
|
140
140
|
CONSTRAINT `fk_author` FOREIGN KEY (`author_id`) REFERENCES `authors` (`id`)
|
141
141
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8
|
142
142
|
ERB
|
@@ -146,28 +146,28 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
146
146
|
context 'when execute (noop)' do
|
147
147
|
let(:dsl) do
|
148
148
|
erbh(<<-ERB)
|
149
|
-
create_table "authors",
|
149
|
+
create_table "authors", id: :integer, force: :cascade do |t|
|
150
150
|
t.string "name", null: false
|
151
151
|
end
|
152
152
|
|
153
|
-
create_table "books",
|
153
|
+
create_table "books", id: :integer, force: :cascade do |t|
|
154
154
|
t.string "title", null: false
|
155
155
|
t.integer "author_id", null: false
|
156
|
-
t.index ["author_id"], name: "idx_author_id"
|
156
|
+
t.index ["author_id"], name: "idx_author_id"
|
157
157
|
end
|
158
158
|
ERB
|
159
159
|
end
|
160
160
|
|
161
161
|
let(:dsl_with_execute) do
|
162
162
|
erbh(<<-ERB)
|
163
|
-
create_table "authors",
|
163
|
+
create_table "authors", id: :integer, force: :cascade do |t|
|
164
164
|
t.string "name", null: false
|
165
165
|
end
|
166
166
|
|
167
|
-
create_table "books",
|
167
|
+
create_table "books", id: :integer, force: :cascade do |t|
|
168
168
|
t.string "title", null: false
|
169
169
|
t.integer "author_id", null: false
|
170
|
-
t.index ["author_id"], name: "idx_author_id"
|
170
|
+
t.index ["author_id"], name: "idx_author_id"
|
171
171
|
end
|
172
172
|
|
173
173
|
execute("ALTER TABLE books ADD CONSTRAINT fk_author FOREIGN KEY (author_id) REFERENCES authors (id)") do |c|
|
@@ -190,7 +190,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
190
190
|
`title` varchar(255) NOT NULL,
|
191
191
|
`author_id` int(11) NOT NULL,
|
192
192
|
PRIMARY KEY (`id`),
|
193
|
-
KEY `idx_author_id` (`author_id`)
|
193
|
+
KEY `idx_author_id` (`author_id`)
|
194
194
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8
|
195
195
|
ERB
|
196
196
|
|
@@ -206,7 +206,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
206
206
|
`title` varchar(255) NOT NULL,
|
207
207
|
`author_id` int(11) NOT NULL,
|
208
208
|
PRIMARY KEY (`id`),
|
209
|
-
KEY `idx_author_id` (`author_id`)
|
209
|
+
KEY `idx_author_id` (`author_id`)
|
210
210
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8
|
211
211
|
ERB
|
212
212
|
}
|
@@ -215,14 +215,14 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
215
215
|
context 'when not execute (noop)' do
|
216
216
|
let(:dsl) do
|
217
217
|
erbh(<<-ERB)
|
218
|
-
create_table "authors",
|
218
|
+
create_table "authors", id: :integer, force: :cascade do |t|
|
219
219
|
t.string "name", null: false
|
220
220
|
end
|
221
221
|
|
222
|
-
create_table "books",
|
222
|
+
create_table "books", id: :integer, force: :cascade do |t|
|
223
223
|
t.string "title", null: false
|
224
224
|
t.integer "author_id", null: false
|
225
|
-
t.index ["author_id"], name: "idx_author_id"
|
225
|
+
t.index ["author_id"], name: "idx_author_id"
|
226
226
|
end
|
227
227
|
add_foreign_key "books", "authors", name: "fk_author"
|
228
228
|
ERB
|
@@ -230,14 +230,14 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
230
230
|
|
231
231
|
let(:dsl_with_execute) do
|
232
232
|
erbh(<<-ERB)
|
233
|
-
create_table "authors",
|
233
|
+
create_table "authors", id: :integer, force: :cascade do |t|
|
234
234
|
t.string "name", null: false
|
235
235
|
end
|
236
236
|
|
237
|
-
create_table "books",
|
237
|
+
create_table "books", id: :integer, force: :cascade do |t|
|
238
238
|
t.string "title", null: false
|
239
239
|
t.integer "author_id", null: false
|
240
|
-
t.index ["author_id"], name: "idx_author_id"
|
240
|
+
t.index ["author_id"], name: "idx_author_id"
|
241
241
|
end
|
242
242
|
|
243
243
|
execute("ALTER TABLE books ADD CONSTRAINT fk_author FOREIGN KEY (author_id) REFERENCES authors (id)") do |c|
|
@@ -262,7 +262,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
262
262
|
`title` varchar(255) NOT NULL,
|
263
263
|
`author_id` int(11) NOT NULL,
|
264
264
|
PRIMARY KEY (`id`),
|
265
|
-
KEY `idx_author_id` (`author_id`)
|
265
|
+
KEY `idx_author_id` (`author_id`),
|
266
266
|
CONSTRAINT `fk_author` FOREIGN KEY (`author_id`) REFERENCES `authors` (`id`)
|
267
267
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8
|
268
268
|
ERB
|
@@ -279,7 +279,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
279
279
|
`title` varchar(255) NOT NULL,
|
280
280
|
`author_id` int(11) NOT NULL,
|
281
281
|
PRIMARY KEY (`id`),
|
282
|
-
KEY `idx_author_id` (`author_id`)
|
282
|
+
KEY `idx_author_id` (`author_id`),
|
283
283
|
CONSTRAINT `fk_author` FOREIGN KEY (`author_id`) REFERENCES `authors` (`id`)
|
284
284
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8
|
285
285
|
ERB
|
@@ -7,7 +7,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
7
7
|
create_table "employee_clubs", force: :cascade do |t|
|
8
8
|
t.integer "emp_no", null: false
|
9
9
|
t.integer "club_id", null: false
|
10
|
-
t.index ["emp_no", "club_id"], name: "idx_emp_no_club_id"
|
10
|
+
t.index ["emp_no", "club_id"], name: "idx_emp_no_club_id"
|
11
11
|
end
|
12
12
|
|
13
13
|
create_table "employees", primary_key: "emp_no", force: :cascade do |t|
|
@@ -26,7 +26,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
26
26
|
t.integer "emp_no", null: false
|
27
27
|
t.integer "club_id", null: false
|
28
28
|
t.string "any_col", null: false, ignore: true
|
29
|
-
t.index ["emp_no", "club_id"], name: "idx_emp_no_club_id"
|
29
|
+
t.index ["emp_no", "club_id"], name: "idx_emp_no_club_id"
|
30
30
|
end
|
31
31
|
|
32
32
|
create_table "employees", primary_key: "emp_no", force: :cascade do |t|
|
@@ -56,7 +56,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
56
56
|
create_table "employee_clubs", force: :cascade do |t|
|
57
57
|
t.integer "emp_no", null: false
|
58
58
|
t.integer "club_id", null: false
|
59
|
-
t.index ["emp_no", "club_id"], name: "idx_emp_no_club_id"
|
59
|
+
t.index ["emp_no", "club_id"], name: "idx_emp_no_club_id"
|
60
60
|
end
|
61
61
|
|
62
62
|
create_table "employees", primary_key: "emp_no", force: :cascade do |t|
|
@@ -74,7 +74,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
74
74
|
create_table "employee_clubs", force: :cascade do |t|
|
75
75
|
t.integer "emp_no", null: false
|
76
76
|
t.integer "club_id", ignore: true
|
77
|
-
t.index ["emp_no", "club_id"], name: "idx_emp_no_club_id"
|
77
|
+
t.index ["emp_no", "club_id"], name: "idx_emp_no_club_id"
|
78
78
|
end
|
79
79
|
|
80
80
|
create_table "employees", primary_key: "emp_no", force: :cascade do |t|
|
@@ -6,13 +6,13 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
6
6
|
erbh(<<-ERB)
|
7
7
|
create_table "clubs", force: :cascade do |t|
|
8
8
|
t.string "name", default: "", null: false
|
9
|
-
t.index ["name"], name: "idx_name", unique: true,
|
9
|
+
t.index ["name"], name: "idx_name", unique: true, ignore: true
|
10
10
|
end
|
11
11
|
|
12
12
|
create_table "employee_clubs", force: :cascade do |t|
|
13
13
|
t.integer "emp_no", null: false
|
14
14
|
t.integer "club_id", null: false
|
15
|
-
t.index ["emp_no", "club_id"], name: "idx_emp_no_club_id",
|
15
|
+
t.index ["emp_no", "club_id"], name: "idx_emp_no_club_id", ignore: true
|
16
16
|
end
|
17
17
|
|
18
18
|
create_table "titles", id: false, force: :cascade do |t|
|
@@ -20,7 +20,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
20
20
|
t.string "title", limit: 50, null: false
|
21
21
|
t.date "from_date", null: false
|
22
22
|
t.date "to_date"
|
23
|
-
t.index ["emp_no"], name: "emp_no",
|
23
|
+
t.index ["emp_no"], name: "emp_no", ignore: true
|
24
24
|
end
|
25
25
|
ERB
|
26
26
|
end
|
@@ -64,7 +64,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
64
64
|
t.integer "salary", null: false
|
65
65
|
t.date "from_date", null: false
|
66
66
|
t.date "to_date", null: false
|
67
|
-
t.index ["emp_no"], name: "emp_no"
|
67
|
+
t.index ["emp_no"], name: "emp_no"
|
68
68
|
end
|
69
69
|
ERB
|
70
70
|
end
|
@@ -76,7 +76,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
76
76
|
t.integer "salary", null: false
|
77
77
|
t.date "from_date", null: false
|
78
78
|
t.date "to_date", null: false
|
79
|
-
t.index ["from_date"], name: "emp_no",
|
79
|
+
t.index ["from_date"], name: "emp_no", ignore: true
|
80
80
|
end
|
81
81
|
ERB
|
82
82
|
end
|