ridgepole 0.5.3.beta4 → 0.6.0.beta

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +22 -50
  3. data/bin/ridgepole +8 -18
  4. data/lib/ridgepole/client.rb +10 -16
  5. data/lib/ridgepole/delta.rb +57 -19
  6. data/lib/ridgepole/diff.rb +45 -14
  7. data/lib/ridgepole/dsl_parser.rb +38 -8
  8. data/lib/ridgepole/execute_expander.rb +0 -29
  9. data/lib/ridgepole/ext/mysql_awesome.rb +1 -5
  10. data/lib/ridgepole/version.rb +1 -1
  11. data/lib/ridgepole.rb +10 -2
  12. data/ridgepole.gemspec +3 -8
  13. data/spec/bigint_pk/bigint_pkspec.rb +2 -2
  14. data/spec/cli/ridgepole_spec.rb +3 -5
  15. data/spec/collation/collation_spec.rb +35 -35
  16. data/spec/diff/diff2_spec.rb +18 -18
  17. data/spec/diff/diff_spec.rb +18 -18
  18. data/spec/dump/dump_class_method_spec.rb +18 -18
  19. data/spec/dump/dump_some_tables_spec.rb +12 -12
  20. data/spec/dump/dump_spec.rb +18 -18
  21. data/spec/dump/dump_without_table_options_spec.rb +6 -6
  22. data/spec/migrate/check_orphan_index_spec.rb +8 -8
  23. data/spec/migrate/migrate_add_column2_spec.rb +15 -15
  24. data/spec/migrate/migrate_add_column_spec.rb +40 -40
  25. data/spec/migrate/migrate_change_column2_spec.rb +5 -5
  26. data/spec/migrate/migrate_change_column3_spec.rb +26 -26
  27. data/spec/migrate/migrate_change_column_float_spec.rb +7 -7
  28. data/spec/migrate/migrate_change_column_spec.rb +42 -42
  29. data/spec/migrate/migrate_change_index2_spec.rb +13 -13
  30. data/spec/migrate/migrate_change_index3_spec.rb +26 -26
  31. data/spec/migrate/migrate_change_index4_spec.rb +28 -28
  32. data/spec/migrate/migrate_change_index_spec.rb +46 -46
  33. data/spec/migrate/migrate_change_table_option_spec.rb +2 -2
  34. data/spec/migrate/migrate_create_index_spec.rb +18 -18
  35. data/spec/migrate/migrate_create_table_spec.rb +18 -18
  36. data/spec/migrate/migrate_create_table_with_options_spec.rb +3 -3
  37. data/spec/migrate/migrate_drop_column_and_index_2_spec.rb +35 -35
  38. data/spec/migrate/migrate_drop_column_and_index_spec.rb +33 -33
  39. data/spec/migrate/migrate_drop_column_spec.rb +36 -36
  40. data/spec/migrate/migrate_drop_index_spec.rb +18 -18
  41. data/spec/migrate/migrate_drop_table_spec.rb +24 -24
  42. data/spec/migrate/migrate_duplicate_index_spec.rb +1 -1
  43. data/spec/migrate/migrate_duplicate_table_spec.rb +2 -2
  44. data/spec/migrate/migrate_empty_spec.rb +18 -18
  45. data/spec/migrate/migrate_execute_spec.rb +58 -49
  46. data/spec/migrate/migrate_merge_mode_spec.rb +38 -38
  47. data/spec/migrate/migrate_noop_spec.rb +40 -40
  48. data/spec/migrate/migrate_rename_column_spec.rb +37 -37
  49. data/spec/migrate/migrate_rename_table_spec.rb +39 -39
  50. data/spec/migrate/migrate_same_default_null_spec.rb +4 -4
  51. data/spec/migrate/migrate_same_spec.rb +18 -18
  52. data/spec/migrate/migrate_script_error_spec.rb +8 -8
  53. data/spec/migrate/migrate_skip_rename_column_spec.rb +36 -36
  54. data/spec/migrate/migrate_skip_rename_table_spec.rb +36 -36
  55. data/spec/migrate/migrate_with_ignore_tables_spec.rb +12 -12
  56. data/spec/migrate/migrate_with_pre_post_query_spec.rb +32 -32
  57. data/spec/migrate/migrate_with_tables_spec.rb +12 -12
  58. data/spec/migrate_0/migrate_change_fk_spec.rb +11 -11
  59. data/spec/migrate_0/migrate_create_fk_spec.rb +29 -30
  60. data/spec/migrate_0/migrate_drop_fk_spec.rb +22 -23
  61. data/spec/spec_helper.rb +24 -2
  62. metadata +10 -89
  63. data/lib/ridgepole/ext/foreign_key.rb +0 -121
  64. data/spec/0_diff/dump_disable_unsigned_spec.rb +0 -75
  65. data/spec/comment/comment_spec.rb +0 -179
  66. data/spec/migrate/migrate_same_default_unsigned_spec.rb +0 -63
  67. data/spec/~pkdump/pkdump_spec.rb +0 -67
@@ -5,20 +5,20 @@ describe 'Ridgepole::Client#dump' do
5
5
 
6
6
  it {
7
7
  expect(subject.dump).to eq <<-RUBY.strip_heredoc.strip
8
- create_table "clubs", force: true do |t|
9
- t.string "name", default: "", null: false
8
+ create_table "clubs",#{if_mysql_awesome_enabled(' unsigned: true,')} force: :cascade do |t|
9
+ t.string "name", limit: 255, default: "", null: false
10
10
  end
11
11
 
12
12
  add_index "clubs", ["name"], name: "idx_name", unique: true, using: :btree
13
13
 
14
- create_table "departments", primary_key: "dept_no",#{mysql_awesome_enabled? ? ' id: :string, limit: 4,' : ''} force: true do |t|
14
+ create_table "departments", primary_key: "dept_no",#{mysql_awesome_enabled? ? ' id: :string, limit: 4,' : ''} force: :cascade do |t|
15
15
  t.string "dept_name", limit: 40, null: false
16
16
  end
17
17
 
18
18
  add_index "departments", ["dept_name"], name: "dept_name", unique: true, using: :btree
19
19
 
20
- create_table "dept_emp", id: false, force: true do |t|
21
- t.integer "emp_no", null: false
20
+ create_table "dept_emp", id: false, force: :cascade do |t|
21
+ t.integer "emp_no", limit: 4, null: false
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
@@ -27,9 +27,9 @@ describe 'Ridgepole::Client#dump' do
27
27
  add_index "dept_emp", ["dept_no"], name: "dept_no", using: :btree
28
28
  add_index "dept_emp", ["emp_no"], name: "emp_no", using: :btree
29
29
 
30
- create_table "dept_manager", id: false, force: true do |t|
30
+ create_table "dept_manager", id: false, force: :cascade do |t|
31
31
  t.string "dept_no", limit: 4, null: false
32
- t.integer "emp_no", null: false
32
+ t.integer "emp_no", limit: 4, null: false
33
33
  t.date "from_date", null: false
34
34
  t.date "to_date", null: false
35
35
  end
@@ -37,14 +37,14 @@ describe 'Ridgepole::Client#dump' do
37
37
  add_index "dept_manager", ["dept_no"], name: "dept_no", using: :btree
38
38
  add_index "dept_manager", ["emp_no"], name: "emp_no", using: :btree
39
39
 
40
- create_table "employee_clubs", force: true do |t|
41
- t.integer "emp_no", null: false, unsigned: true
42
- t.integer "club_id", null: false, unsigned: true
40
+ create_table "employee_clubs",#{if_mysql_awesome_enabled(' unsigned: true,')} force: :cascade do |t|
41
+ t.integer "emp_no", limit: 4, null: false#{unsigned_if_enabled}
42
+ t.integer "club_id", limit: 4, null: false#{unsigned_if_enabled}
43
43
  end
44
44
 
45
45
  add_index "employee_clubs", ["emp_no", "club_id"], name: "idx_emp_no_club_id", using: :btree
46
46
 
47
- create_table "employees", primary_key: "emp_no",#{mysql_awesome_enabled? ? ' id: :integer,' : ''} force: true do |t|
47
+ create_table "employees", primary_key: "emp_no",#{if_mysql_awesome_enabled(' id: :integer, limit: 4,')} force: :cascade do |t|
48
48
  t.date "birth_date", null: false
49
49
  t.string "first_name", limit: 14, null: false
50
50
  t.string "last_name", limit: 16, null: false
@@ -52,17 +52,17 @@ describe 'Ridgepole::Client#dump' do
52
52
  t.date "hire_date", null: false
53
53
  end
54
54
 
55
- create_table "salaries", id: false, force: true do |t|
56
- t.integer "emp_no", null: false
57
- t.integer "salary", null: false
58
- t.date "from_date", null: false
59
- t.date "to_date", null: false
55
+ create_table "salaries", id: false, force: :cascade do |t|
56
+ t.integer "emp_no", limit: 4, null: false
57
+ t.integer "salary", limit: 4, null: false
58
+ t.date "from_date", null: false
59
+ t.date "to_date", null: false
60
60
  end
61
61
 
62
62
  add_index "salaries", ["emp_no"], name: "emp_no", using: :btree
63
63
 
64
- create_table "titles", id: false, force: true do |t|
65
- t.integer "emp_no", null: false
64
+ create_table "titles", id: false, force: :cascade do |t|
65
+ t.integer "emp_no", limit: 4, null: false
66
66
  t.string "title", limit: 50, null: false
67
67
  t.date "from_date", null: false
68
68
  t.date "to_date"
@@ -2,9 +2,9 @@ if mysql_awesome_enabled?
2
2
  describe 'Ridgepole::Client#dump' do
3
3
  let(:actual_dsl) {
4
4
  <<-'RUBY'
5
- create_table "books", force: true, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='\"london\" bridge \"is\" falling \"down\"'" do |t|
6
- t.string "title", null: false
7
- t.integer "author_id", null: false
5
+ create_table "books", unsigned: true, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='\"london\" bridge \"is\" falling \"down\"'" do |t|
6
+ t.string "title", limit: 255, null: false
7
+ t.integer "author_id", limit: 4, null: false
8
8
  t.datetime "created_at"
9
9
  t.datetime "updated_at"
10
10
  end
@@ -14,9 +14,9 @@ if mysql_awesome_enabled?
14
14
  context 'when without table options' do
15
15
  let(:expected_dsl) {
16
16
  <<-RUBY
17
- create_table "books", force: true do |t|
18
- t.string "title", null: false
19
- t.integer "author_id", null: false
17
+ create_table "books", unsigned: true, force: :cascade do |t|
18
+ t.string "title", limit: 255, null: false
19
+ t.integer "author_id", limit: 4, null: false
20
20
  t.datetime "created_at"
21
21
  t.datetime "updated_at"
22
22
  end
@@ -3,19 +3,19 @@ describe 'Ridgepole::Client#diff -> migrate' do
3
3
  let(:actual_dsl) { '' }
4
4
  let(:expected_dsl) {
5
5
  <<-RUBY
6
- create_table "clubs", force: true do |t|
6
+ create_table "clubs", force: :cascade do |t|
7
7
  t.string "name", default: "", null: false
8
8
  end
9
9
 
10
10
  add_index "clubs", ["name"], name: "idx_name", unique: true, using: :btree
11
11
 
12
- create_table "departments", primary_key: "dept_no", force: true do |t|
12
+ create_table "departments", primary_key: "dept_no", force: :cascade do |t|
13
13
  t.string "dept_name", limit: 40, null: false
14
14
  end
15
15
 
16
16
  add_index "departments", ["dept_name"], name: "dept_name", unique: true, using: :btree
17
17
 
18
- create_table "dept_emp", id: false, force: true do |t|
18
+ create_table "dept_emp", id: false, force: :cascade do |t|
19
19
  t.integer "emp_no", null: false
20
20
  t.string "dept_no", limit: 4, null: false
21
21
  t.date "from_date", null: false
@@ -25,7 +25,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
25
25
  add_index "dept_emp", ["dept_no"], name: "dept_no", using: :btree
26
26
  add_index "dept_emp", ["emp_no"], name: "emp_no", using: :btree
27
27
 
28
- create_table "dept_manager", id: false, force: true do |t|
28
+ create_table "dept_manager", id: false, force: :cascade do |t|
29
29
  t.string "dept_no", limit: 4, null: false
30
30
  t.integer "emp_no", null: false
31
31
  t.date "from_date", null: false
@@ -35,14 +35,14 @@ describe 'Ridgepole::Client#diff -> migrate' do
35
35
  add_index "Xdept_manager", ["dept_no"], name: "dept_no", using: :btree
36
36
  add_index "Xdept_manager", ["emp_no"], name: "emp_no", using: :btree
37
37
 
38
- create_table "employee_clubs", force: true do |t|
38
+ create_table "employee_clubs", 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
41
  end
42
42
 
43
43
  add_index "employee_clubs", ["emp_no", "club_id"], name: "idx_emp_no_club_id", using: :btree
44
44
 
45
- create_table "employees", primary_key: "emp_no", force: true do |t|
45
+ create_table "employees", primary_key: "emp_no", force: :cascade do |t|
46
46
  t.date "birth_date", null: false
47
47
  t.string "first_name", limit: 14, null: false
48
48
  t.string "last_name", limit: 16, null: false
@@ -50,7 +50,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
50
50
  t.date "hire_date", null: false
51
51
  end
52
52
 
53
- create_table "salaries", id: false, force: true do |t|
53
+ create_table "salaries", id: false, force: :cascade do |t|
54
54
  t.integer "emp_no", null: false
55
55
  t.integer "salary", null: false
56
56
  t.date "from_date", null: false
@@ -59,7 +59,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
59
59
 
60
60
  add_index "salaries", ["emp_no"], name: "emp_no", using: :btree
61
61
 
62
- create_table "titles", id: false, force: true do |t|
62
+ create_table "titles", id: false, force: :cascade do |t|
63
63
  t.integer "emp_no", null: false
64
64
  t.string "title", limit: 50, null: false
65
65
  t.date "from_date", null: false
@@ -2,8 +2,8 @@ describe 'Ridgepole::Client#diff -> migrate' do
2
2
  context 'when add column (int/noop) (1)' do
3
3
  let(:actual_dsl) {
4
4
  <<-RUBY
5
- create_table "dept_emp", id: false, force: true do |t|
6
- t.integer "emp_no", null: false
5
+ create_table "dept_emp", id: false, force: :cascade do |t|
6
+ t.integer "emp_no", limit: 4, null: false
7
7
  t.string "dept_no", limit: 4, null: false
8
8
  t.date "from_date", null: false
9
9
  t.date "to_date", null: false
@@ -13,8 +13,8 @@ describe 'Ridgepole::Client#diff -> migrate' do
13
13
 
14
14
  let(:expected_dsl) {
15
15
  <<-RUBY
16
- create_table "dept_emp", id: false, force: true do |t|
17
- t.integer "emp_no", null: false
16
+ create_table "dept_emp", id: false, force: :cascade do |t|
17
+ t.integer "emp_no", limit: 4, null: false
18
18
  t.integer "emp_no2", null: false
19
19
  t.string "dept_no", limit: 4, null: false
20
20
  t.date "from_date", null: false
@@ -35,15 +35,15 @@ describe 'Ridgepole::Client#diff -> migrate' do
35
35
  expect(subject.dump).to eq actual_dsl.strip_heredoc.strip
36
36
 
37
37
  sql = sql.each_line.map {|i| i.strip }.join("\n")
38
- expect(sql).to eq("ALTER TABLE `dept_emp` ADD `emp_no2` int NOT NULL AFTER `emp_no`")
38
+ expect(sql).to eq("ALTER TABLE `dept_emp` ADD `emp_no2` int#{if_mysql_awesome_enabled('', '(11)')} NOT NULL AFTER `emp_no`")
39
39
  }
40
40
  end
41
41
 
42
42
  context 'when add column (int/noop) (2)' do
43
43
  let(:actual_dsl) {
44
44
  <<-RUBY
45
- create_table "dept_emp", id: false, force: true do |t|
46
- t.integer "emp_no", null: false
45
+ create_table "dept_emp", id: false, force: :cascade do |t|
46
+ t.integer "emp_no", limit: 4, null: false
47
47
  t.string "dept_no", limit: 4, null: false
48
48
  t.date "from_date", null: false
49
49
  t.date "to_date", null: false
@@ -53,8 +53,8 @@ describe 'Ridgepole::Client#diff -> migrate' do
53
53
 
54
54
  let(:expected_dsl) {
55
55
  <<-RUBY
56
- create_table "dept_emp", id: false, force: true do |t|
57
- t.integer "emp_no", null: false
56
+ create_table "dept_emp", id: false, force: :cascade do |t|
57
+ t.integer "emp_no", limit: 4, null: false
58
58
  t.integer "emp_no2", null: false
59
59
  t.string "dept_no", limit: 4, null: false
60
60
  t.date "from_date", null: false
@@ -75,15 +75,15 @@ describe 'Ridgepole::Client#diff -> migrate' do
75
75
  expect(subject.dump).to eq actual_dsl.strip_heredoc.strip
76
76
 
77
77
  sql = sql.each_line.map {|i| i.strip }.join("\n")
78
- expect(sql).to eq("ALTER TABLE `dept_emp` ADD `emp_no2` int NOT NULL AFTER `emp_no`")
78
+ expect(sql).to eq("ALTER TABLE `dept_emp` ADD `emp_no2` int#{if_mysql_awesome_enabled('', '(11)')} NOT NULL AFTER `emp_no`")
79
79
  }
80
80
  end
81
81
 
82
82
  context 'when add column (int/noop) (3)' do
83
83
  let(:actual_dsl) {
84
84
  <<-RUBY
85
- create_table "dept_emp", id: false, force: true do |t|
86
- t.integer "emp_no", null: false
85
+ create_table "dept_emp", id: false, force: :cascade do |t|
86
+ t.integer "emp_no", limit: 4, null: false
87
87
  t.string "dept_no", limit: 4, null: false
88
88
  t.date "from_date", null: false
89
89
  t.date "to_date", null: false
@@ -93,8 +93,8 @@ describe 'Ridgepole::Client#diff -> migrate' do
93
93
 
94
94
  let(:expected_dsl) {
95
95
  <<-RUBY
96
- create_table "dept_emp", id: false, force: true do |t|
97
- t.integer "emp_no", null: false
96
+ create_table "dept_emp", id: false, force: :cascade do |t|
97
+ t.integer "emp_no", limit: 4, null: false
98
98
  t.integer "emp_no2", limit: 4, null: false
99
99
  t.string "dept_no", limit: 4, null: false
100
100
  t.date "from_date", null: false
@@ -115,7 +115,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
115
115
  expect(subject.dump).to eq actual_dsl.strip_heredoc.strip
116
116
 
117
117
  sql = sql.each_line.map {|i| i.strip }.join("\n")
118
- expect(sql).to eq("ALTER TABLE `dept_emp` ADD `emp_no2` int NOT NULL AFTER `emp_no`")
118
+ expect(sql).to eq("ALTER TABLE `dept_emp` ADD `emp_no2` int#{if_mysql_awesome_enabled('', '(11)')} NOT NULL AFTER `emp_no`")
119
119
  }
120
120
  end
121
121
  end
@@ -2,20 +2,20 @@ describe 'Ridgepole::Client#diff -> migrate' do
2
2
  context 'when add column' do
3
3
  let(:actual_dsl) {
4
4
  <<-RUBY
5
- create_table "clubs", force: true do |t|
6
- t.string "name", default: "", null: false
5
+ create_table "clubs"#{unsigned_if_enabled}, force: :cascade do |t|
6
+ t.string "name", limit: 255, default: "", null: false
7
7
  end
8
8
 
9
9
  add_index "clubs", ["name"], name: "idx_name", unique: true, using: :btree
10
10
 
11
- create_table "departments", primary_key: "dept_no", force: true do |t|
11
+ create_table "departments", primary_key: "dept_no"#{unsigned_if_enabled}, force: :cascade do |t|
12
12
  t.string "dept_name", limit: 40, null: false
13
13
  end
14
14
 
15
15
  add_index "departments", ["dept_name"], name: "dept_name", unique: true, using: :btree
16
16
 
17
- create_table "dept_emp", id: false, force: true do |t|
18
- t.integer "emp_no", null: false
17
+ create_table "dept_emp", id: false, force: :cascade do |t|
18
+ t.integer "emp_no", limit: 4, null: false
19
19
  t.string "dept_no", limit: 4, null: false
20
20
  t.date "from_date", null: false
21
21
  t.date "to_date", null: false
@@ -24,9 +24,9 @@ describe 'Ridgepole::Client#diff -> migrate' do
24
24
  add_index "dept_emp", ["dept_no"], name: "dept_no", using: :btree
25
25
  add_index "dept_emp", ["emp_no"], name: "emp_no", using: :btree
26
26
 
27
- create_table "dept_manager", id: false, force: true do |t|
27
+ create_table "dept_manager", id: false, force: :cascade do |t|
28
28
  t.string "dept_no", limit: 4, null: false
29
- t.integer "emp_no", null: false
29
+ t.integer "emp_no", limit: 4, null: false
30
30
  t.date "from_date", null: false
31
31
  t.date "to_date", null: false
32
32
  end
@@ -34,14 +34,14 @@ describe 'Ridgepole::Client#diff -> migrate' do
34
34
  add_index "dept_manager", ["dept_no"], name: "dept_no", using: :btree
35
35
  add_index "dept_manager", ["emp_no"], name: "emp_no", using: :btree
36
36
 
37
- create_table "employee_clubs", force: true do |t|
38
- t.integer "emp_no", null: false, unsigned: true
39
- t.integer "club_id", null: false, unsigned: true
37
+ create_table "employee_clubs"#{unsigned_if_enabled}, force: :cascade do |t|
38
+ t.integer "emp_no", limit: 4, null: false
39
+ t.integer "club_id", limit: 4, null: false
40
40
  end
41
41
 
42
42
  add_index "employee_clubs", ["emp_no", "club_id"], name: "idx_emp_no_club_id", using: :btree
43
43
 
44
- create_table "employees", primary_key: "emp_no", force: true do |t|
44
+ create_table "employees", primary_key: "emp_no"#{unsigned_if_enabled}, 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
@@ -49,17 +49,17 @@ describe 'Ridgepole::Client#diff -> migrate' do
49
49
  t.date "hire_date", null: false
50
50
  end
51
51
 
52
- create_table "salaries", id: false, force: true do |t|
53
- t.integer "emp_no", null: false
54
- t.integer "salary", null: false
55
- t.date "from_date", null: false
56
- t.date "to_date", null: false
52
+ create_table "salaries", id: false, force: :cascade do |t|
53
+ t.integer "emp_no", limit: 4, null: false
54
+ t.integer "salary", limit: 4, null: false
55
+ t.date "from_date", null: false
56
+ t.date "to_date", null: false
57
57
  end
58
58
 
59
59
  add_index "salaries", ["emp_no"], name: "emp_no", using: :btree
60
60
 
61
- create_table "titles", id: false, force: true do |t|
62
- t.integer "emp_no", null: false
61
+ create_table "titles", id: false, force: :cascade do |t|
62
+ t.integer "emp_no", limit: 4, null: false
63
63
  t.string "title", limit: 50, null: false
64
64
  t.date "from_date", null: false
65
65
  t.date "to_date"
@@ -71,20 +71,20 @@ describe 'Ridgepole::Client#diff -> migrate' do
71
71
 
72
72
  let(:expected_dsl) {
73
73
  <<-RUBY
74
- create_table "clubs", force: true do |t|
75
- t.string "name", default: "", null: false
74
+ create_table "clubs"#{unsigned_if_enabled}, force: :cascade do |t|
75
+ t.string "name", limit: 255, default: "", null: false
76
76
  end
77
77
 
78
78
  add_index "clubs", ["name"], name: "idx_name", unique: true, using: :btree
79
79
 
80
- create_table "departments", primary_key: "dept_no", force: true do |t|
80
+ create_table "departments", primary_key: "dept_no"#{unsigned_if_enabled}, force: :cascade do |t|
81
81
  t.string "dept_name", limit: 40, null: false
82
82
  end
83
83
 
84
84
  add_index "departments", ["dept_name"], name: "dept_name", unique: true, using: :btree
85
85
 
86
- create_table "dept_emp", id: false, force: true do |t|
87
- t.integer "emp_no", null: false
86
+ create_table "dept_emp", id: false, force: :cascade do |t|
87
+ t.integer "emp_no", limit: 4, null: false
88
88
  t.string "dept_no", limit: 4, null: false
89
89
  t.date "from_date", null: false
90
90
  t.date "to_date", null: false
@@ -93,9 +93,9 @@ describe 'Ridgepole::Client#diff -> migrate' do
93
93
  add_index "dept_emp", ["dept_no"], name: "dept_no", using: :btree
94
94
  add_index "dept_emp", ["emp_no"], name: "emp_no", using: :btree
95
95
 
96
- create_table "dept_manager", id: false, force: true do |t|
96
+ create_table "dept_manager", id: false, force: :cascade do |t|
97
97
  t.string "dept_no", limit: 4, null: false
98
- t.integer "emp_no", null: false
98
+ t.integer "emp_no", limit: 4, null: false
99
99
  t.date "from_date", null: false
100
100
  t.date "to_date", null: false
101
101
  end
@@ -103,35 +103,35 @@ describe 'Ridgepole::Client#diff -> migrate' do
103
103
  add_index "dept_manager", ["dept_no"], name: "dept_no", using: :btree
104
104
  add_index "dept_manager", ["emp_no"], name: "emp_no", using: :btree
105
105
 
106
- create_table "employee_clubs", force: true do |t|
107
- t.integer "emp_no", null: false, unsigned: true
108
- t.integer "club_id", null: false, unsigned: true
109
- t.string "any_col", null: false
106
+ create_table "employee_clubs"#{unsigned_if_enabled}, force: :cascade do |t|
107
+ t.integer "emp_no", limit: 4, null: false
108
+ t.integer "club_id", limit: 4, null: false
109
+ t.string "any_col", limit: 255, null: false
110
110
  end
111
111
 
112
112
  add_index "employee_clubs", ["emp_no", "club_id"], name: "idx_emp_no_club_id", using: :btree
113
113
 
114
- create_table "employees", primary_key: "emp_no", force: true do |t|
114
+ create_table "employees", primary_key: "emp_no"#{unsigned_if_enabled}, force: :cascade do |t|
115
115
  t.date "birth_date", null: false
116
116
  t.string "first_name", limit: 14, null: false
117
117
  t.string "last_name", limit: 16, null: false
118
118
  t.string "gender", limit: 1, null: false
119
119
  t.date "hire_date", null: false
120
- t.integer "age", null: false, unsigned: true
120
+ t.integer "age", limit: 4, null: false
121
121
  t.date "updated_at"
122
122
  end
123
123
 
124
- create_table "salaries", id: false, force: true do |t|
125
- t.integer "emp_no", null: false
126
- t.integer "salary", null: false
127
- t.date "from_date", null: false
128
- t.date "to_date", null: false
124
+ create_table "salaries", id: false, force: :cascade do |t|
125
+ t.integer "emp_no", limit: 4, null: false
126
+ t.integer "salary", limit: 4, null: false
127
+ t.date "from_date", null: false
128
+ t.date "to_date", null: false
129
129
  end
130
130
 
131
131
  add_index "salaries", ["emp_no"], name: "emp_no", using: :btree
132
132
 
133
- create_table "titles", id: false, force: true do |t|
134
- t.integer "emp_no", null: false
133
+ create_table "titles", id: false, force: :cascade do |t|
134
+ t.integer "emp_no", limit: 4, null: false
135
135
  t.string "title", limit: 50, null: false
136
136
  t.date "from_date", null: false
137
137
  t.date "to_date"
@@ -169,11 +169,11 @@ describe 'Ridgepole::Client#diff -> migrate' do
169
169
  expect(subject.dump).to eq actual_dsl.strip_heredoc.strip
170
170
  expect(delta.script).to eq <<-RUBY.strip_heredoc.strip
171
171
  change_table("employee_clubs", {:bulk => true}) do |t|
172
- t.column("any_col", :string, {:null=>false, :after=>"club_id"})
172
+ t.column("any_col", :string, {:limit=>255, :null=>false, :after=>"club_id"})
173
173
  end
174
174
 
175
175
  change_table("employees", {:bulk => true}) do |t|
176
- t.column("age", :integer, {:null=>false, :unsigned=>true, :after=>"hire_date"})
176
+ t.column("age", :integer, {:limit=>4, :null=>false, :after=>"hire_date"})
177
177
  t.column("updated_at", :date, {:after=>"age"})
178
178
  end
179
179
  RUBY
@@ -2,7 +2,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
2
2
  context 'when change column (no change)' do
3
3
  let(:actual_dsl) {
4
4
  <<-RUBY
5
- create_table "employees", primary_key: "emp_no", force: true do |t|
5
+ create_table "employees", primary_key: "emp_no", force: :cascade do |t|
6
6
  t.date "birth_date", null: false
7
7
  t.string "first_name", limit: 14, null: false
8
8
  t.string "last_name", limit: 16, null: false
@@ -16,7 +16,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
16
16
 
17
17
  let(:expected_dsl) {
18
18
  <<-RUBY
19
- create_table :employees, primary_key: :emp_no, force: true do |t|
19
+ create_table :employees, primary_key: :emp_no, force: :cascade do |t|
20
20
  t.date "birth_date", null: false
21
21
  t.string "first_name", limit: 14, null: false
22
22
  t.string "last_name", limit: 16, null: false
@@ -40,7 +40,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
40
40
  context 'when change column (change)' do
41
41
  let(:actual_dsl) {
42
42
  <<-RUBY
43
- create_table "employees", primary_key: "emp_no", force: true do |t|
43
+ create_table "employees", primary_key: "emp_no"#{unsigned_if_enabled}, force: :cascade do |t|
44
44
  t.date "birth_date", null: false
45
45
  t.string "first_name", limit: 14, null: false
46
46
  t.string "last_name", limit: 16, null: false
@@ -54,7 +54,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
54
54
 
55
55
  let(:dsl) {
56
56
  <<-RUBY
57
- create_table :employees, primary_key: :emp_no, force: true do |t|
57
+ create_table :employees, primary_key: :emp_no, force: :cascade do |t|
58
58
  t.date "birth_date", null: false
59
59
  t.string "first_name", limit: 14, null: false
60
60
  t.string "last_name", limit: 16, null: false
@@ -68,7 +68,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
68
68
 
69
69
  let(:expected_dsl) {
70
70
  <<-RUBY
71
- create_table "employees", primary_key: "emp_no", force: true do |t|
71
+ create_table "employees", primary_key: "emp_no"#{unsigned_if_enabled}, force: :cascade do |t|
72
72
  t.date "birth_date", null: false
73
73
  t.string "first_name", limit: 14, null: false
74
74
  t.string "last_name", limit: 16, null: false