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
data/ridgepole.gemspec CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
  spec.email = ['sugawara@cookpad.com']
11
11
  spec.summary = %q{Ridgepole is a tool to manage DB schema.}
12
12
  spec.description = %q{Ridgepole is a tool to manage DB schema. It defines DB schema using Rails DSL, and updates DB schema according to DSL.}
13
- spec.homepage = 'http://ridgepole.codenize.tools/'
13
+ spec.homepage = 'https://github.com/winebarrel/ridgepole/tree/v0.6.0'
14
14
  spec.license = 'MIT'
15
15
 
16
16
  spec.files = `git ls-files -z`.split("\x0")
@@ -18,16 +18,11 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ['lib']
20
20
 
21
- spec.add_dependency 'activerecord', '< 4.2.0'
21
+ spec.add_dependency 'activerecord', '~> 4.2.1'
22
22
  spec.add_development_dependency 'bundler'
23
23
  spec.add_development_dependency 'rake'
24
24
  spec.add_development_dependency 'rspec', '>= 3.0.0'
25
25
  spec.add_development_dependency 'mysql2'
26
- spec.add_development_dependency 'sqlite3'
27
26
  spec.add_development_dependency 'coveralls'
28
- spec.add_development_dependency 'activerecord-mysql-unsigned', '~> 0.3.1'
29
- spec.add_development_dependency 'foreigner', '<= 1.7.1'
30
- spec.add_development_dependency 'activerecord-mysql-pkdump', '>= 0.1.0'
31
- spec.add_development_dependency 'migration_comments'
32
- spec.add_development_dependency 'activerecord-mysql-awesome', '<= 0.0.4'
27
+ spec.add_development_dependency 'activerecord-mysql-awesome', '>= 0.0.7'
33
28
  end
@@ -2,7 +2,7 @@ if mysql_awesome_enabled?
2
2
  describe 'Ridgepole::Client (with bigint pk)' do
3
3
  let(:dsl1) {
4
4
  <<-RUBY
5
- create_table "books", id: :primary_key, limit: 8, force: true do |t|
5
+ create_table "books", id: :primary_key, limit: 8, force: :cascade do |t|
6
6
  t.string "title", null: false
7
7
  t.integer "author_id", null: false
8
8
  t.datetime "created_at"
@@ -13,7 +13,7 @@ if mysql_awesome_enabled?
13
13
 
14
14
  let(:dsl2) {
15
15
  <<-RUBY
16
- create_table "books", id: :bigint, force: true do |t|
16
+ create_table "books", id: :bigint, force: :cascade do |t|
17
17
  t.string "title", null: false
18
18
  t.integer "author_id", null: false
19
19
  t.datetime "created_at"
@@ -18,6 +18,9 @@ describe 'ridgepole' do
18
18
  --table-options OPTIONS
19
19
  --bulk-change
20
20
  --default-int-limit LIMIT
21
+ --default-float-limit LIMIT
22
+ --default-string-limit LIMIT
23
+ --default-text-limit LIMIT
21
24
  --pre-query QUERY
22
25
  --post-query QUERY
23
26
  -e, --export
@@ -29,13 +32,8 @@ describe 'ridgepole' do
29
32
  -o, --output FILE
30
33
  -t, --tables TABLES
31
34
  --ignore-tables TABLES
32
- --enable-mysql-unsigned
33
- --enable-mysql-pkdump
34
- --enable-foreigner
35
- --enable-migration-comments
36
35
  --enable-mysql-awesome
37
36
  --mysql-awesome-unsigned-pk
38
- --normalize-mysql-float
39
37
  --dump-without-table-options
40
38
  -r, --require LIBS
41
39
  --log-file LOG_FILE
@@ -3,22 +3,22 @@ if mysql_awesome_enabled?
3
3
  context 'when change column (add collation)' do
4
4
  let(:actual_dsl) {
5
5
  <<-RUBY
6
- create_table "employee_clubs", force: true do |t|
7
- t.integer "emp_no", null: false
8
- t.integer "club_id", null: false, unsigned: true
9
- t.string "string", null: false
10
- t.text "text", null: false
6
+ create_table "employee_clubs", unsigned: true, force: :cascade do |t|
7
+ t.integer "emp_no", limit: 4, null: false
8
+ t.integer "club_id", limit: 4, null: false, unsigned: true
9
+ t.string "string", limit: 255, null: false
10
+ t.text "text", limit: 65535, null: false
11
11
  end
12
12
  RUBY
13
13
  }
14
14
 
15
15
  let(:expected_dsl) {
16
16
  <<-RUBY
17
- create_table "employee_clubs", force: true do |t|
18
- t.integer "emp_no", null: false
19
- t.integer "club_id", null: false, unsigned: true
20
- t.string "string", null: false, collation: "ascii_bin"
21
- t.text "text", null: false, collation: "utf8mb4_bin"
17
+ create_table "employee_clubs", unsigned: true, force: :cascade do |t|
18
+ t.integer "emp_no", limit: 4, null: false
19
+ t.integer "club_id", limit: 4, null: false, unsigned: true
20
+ t.string "string", limit: 255, null: false, collation: "ascii_bin"
21
+ t.text "text", limit: 65535, null: false, collation: "utf8mb4_bin"
22
22
  end
23
23
  RUBY
24
24
  }
@@ -38,22 +38,22 @@ if mysql_awesome_enabled?
38
38
  context 'when change column (delete collation)' do
39
39
  let(:actual_dsl) {
40
40
  <<-RUBY
41
- create_table "employee_clubs", force: true do |t|
42
- t.integer "emp_no", null: false
43
- t.integer "club_id", null: false, unsigned: true
44
- t.string "string", null: false, collation: "ascii_bin"
45
- t.text "text", null: false, collation: "utf8mb4_bin"
41
+ create_table "employee_clubs", unsigned: true, force: :cascade do |t|
42
+ t.integer "emp_no", limit: 4, null: false
43
+ t.integer "club_id", limit: 4, null: false, unsigned: true
44
+ t.string "string", limit: 255, null: false, collation: "ascii_bin"
45
+ t.text "text", limit: 65535, null: false, collation: "utf8mb4_bin"
46
46
  end
47
47
  RUBY
48
48
  }
49
49
 
50
50
  let(:expected_dsl) {
51
51
  <<-RUBY
52
- create_table "employee_clubs", force: true do |t|
53
- t.integer "emp_no", null: false
54
- t.integer "club_id", null: false, unsigned: true
55
- t.string "string", null: false
56
- t.text "text", null: false
52
+ create_table "employee_clubs", unsigned: true, force: :cascade do |t|
53
+ t.integer "emp_no", limit: 4, null: false
54
+ t.integer "club_id", limit: 4, null: false, unsigned: true
55
+ t.string "string", limit: 255, null: false
56
+ t.text "text", limit: 65535, null: false
57
57
  end
58
58
  RUBY
59
59
  }
@@ -73,22 +73,22 @@ if mysql_awesome_enabled?
73
73
  context 'when change column (change collation)' do
74
74
  let(:actual_dsl) {
75
75
  <<-RUBY
76
- create_table "employee_clubs", force: true do |t|
77
- t.integer "emp_no", null: false
78
- t.integer "club_id", null: false, unsigned: true
79
- t.string "string", null: false, collation: "ascii_bin"
80
- t.text "text", null: false, collation: "utf8mb4_bin"
76
+ create_table "employee_clubs", unsigned: true, force: :cascade do |t|
77
+ t.integer "emp_no", limit: 4, null: false
78
+ t.integer "club_id", limit: 4, null: false, unsigned: true
79
+ t.string "string", limit: 255, null: false, collation: "ascii_bin"
80
+ t.text "text", limit: 65535, null: false, collation: "utf8mb4_bin"
81
81
  end
82
82
  RUBY
83
83
  }
84
84
 
85
85
  let(:expected_dsl) {
86
86
  <<-RUBY
87
- create_table "employee_clubs", force: true do |t|
88
- t.integer "emp_no", null: false
89
- t.integer "club_id", null: false, unsigned: true
90
- t.string "string", null: false, collation: "utf8mb4_bin"
91
- t.text "text", null: false, collation: "ascii_bin"
87
+ create_table "employee_clubs", unsigned: true, force: :cascade do |t|
88
+ t.integer "emp_no", limit: 4, null: false
89
+ t.integer "club_id", limit: 4, null: false, unsigned: true
90
+ t.string "string", limit: 255, null: false, collation: "utf8mb4_bin"
91
+ t.text "text", limit: 65535, null: false, collation: "ascii_bin"
92
92
  end
93
93
  RUBY
94
94
  }
@@ -108,11 +108,11 @@ if mysql_awesome_enabled?
108
108
  context 'when change column (no change collation)' do
109
109
  let(:actual_dsl) {
110
110
  <<-RUBY
111
- create_table "employee_clubs", force: true do |t|
112
- t.integer "emp_no", null: false
113
- t.integer "club_id", null: false, unsigned: true
114
- t.string "string", null: false, collation: "ascii_bin"
115
- t.text "text", null: false, collation: "utf8mb4_bin"
111
+ create_table "employee_clubs", unsigned: true, force: :cascade do |t|
112
+ t.integer "emp_no", limit: 4, null: false
113
+ t.integer "club_id", limit: 4, null: false, unsigned: true
114
+ t.string "string", limit: 255, null: false, collation: "ascii_bin"
115
+ t.text "text", limit: 65535, null: false, collation: "utf8mb4_bin"
116
116
  end
117
117
  RUBY
118
118
  }
@@ -5,19 +5,19 @@ describe 'Ridgepole::Client.diff' do
5
5
  let(:actual_dsl) {
6
6
  open("#{tmpdir}/file1.required", 'w') do |f|
7
7
  f.puts <<-RUBY
8
- create_table "clubs", force: true do |t|
8
+ create_table "clubs", force: :cascade do |t|
9
9
  t.string "name", 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", force: true do |t|
14
+ create_table "departments", primary_key: "dept_no", 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|
20
+ create_table "dept_emp", id: false, force: :cascade do |t|
21
21
  t.integer "emp_no", null: false
22
22
  t.string "dept_no", limit: 4, null: false
23
23
  t.date "from_date", null: false
@@ -27,7 +27,7 @@ describe 'Ridgepole::Client.diff' 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
32
  t.integer "emp_no", null: false
33
33
  t.date "from_date", null: false
@@ -44,14 +44,14 @@ describe 'Ridgepole::Client.diff' do
44
44
  f.puts <<-RUBY
45
45
  require "file1.required"
46
46
 
47
- create_table "employee_clubs", force: true do |t|
47
+ create_table "employee_clubs", force: :cascade do |t|
48
48
  t.integer "emp_no", null: false, unsigned: true
49
49
  t.integer "club_id", null: false, unsigned: true
50
50
  end
51
51
 
52
52
  add_index "employee_clubs", ["emp_no", "club_id"], name: "idx_emp_no_club_id", using: :btree
53
53
 
54
- create_table "employees", primary_key: "emp_no", force: true do |t|
54
+ create_table "employees", primary_key: "emp_no", force: :cascade do |t|
55
55
  t.date "birth_date", null: false
56
56
  t.string "first_name", limit: 14, null: false
57
57
  t.string "last_name", limit: 16, null: false
@@ -59,7 +59,7 @@ describe 'Ridgepole::Client.diff' do
59
59
  t.date "hire_date", null: false
60
60
  end
61
61
 
62
- create_table "salaries", id: false, force: true do |t|
62
+ create_table "salaries", id: false, force: :cascade do |t|
63
63
  t.integer "emp_no", null: false
64
64
  t.integer "salary", null: false
65
65
  t.date "from_date", null: false
@@ -68,7 +68,7 @@ describe 'Ridgepole::Client.diff' do
68
68
 
69
69
  add_index "salaries", ["emp_no"], name: "emp_no", using: :btree
70
70
 
71
- create_table "titles", id: false, force: true do |t|
71
+ create_table "titles", id: false, force: :cascade do |t|
72
72
  t.integer "emp_no", null: false
73
73
  t.string "title", limit: 50, null: false
74
74
  t.date "from_date", null: false
@@ -86,19 +86,19 @@ describe 'Ridgepole::Client.diff' do
86
86
  let(:expected_dsl) {
87
87
  open("#{tmpdir}/file2.required", 'w') do |f|
88
88
  f.puts <<-RUBY
89
- create_table "clubs", force: true do |t|
89
+ create_table "clubs", force: :cascade do |t|
90
90
  t.string "name", default: "", null: false
91
91
  end
92
92
 
93
93
  add_index "clubs", ["name"], name: "idx_name", unique: true, using: :btree
94
94
 
95
- create_table "departments", primary_key: "dept_no", force: true do |t|
95
+ create_table "departments", primary_key: "dept_no", force: :cascade do |t|
96
96
  t.string "dept_name", limit: 40, null: false
97
97
  end
98
98
 
99
99
  add_index "departments", ["dept_name"], name: "dept_name", unique: true, using: :btree
100
100
 
101
- create_table "dept_emp", id: false, force: true do |t|
101
+ create_table "dept_emp", id: false, force: :cascade do |t|
102
102
  t.integer "emp_no", null: false
103
103
  t.string "dept_no", limit: 4, null: false
104
104
  t.date "from_date", null: false
@@ -108,7 +108,7 @@ describe 'Ridgepole::Client.diff' do
108
108
  add_index "dept_emp", ["dept_no"], name: "dept_no", using: :btree
109
109
  add_index "dept_emp", ["emp_no"], name: "emp_no", using: :btree
110
110
 
111
- create_table "dept_manager", id: false, force: true do |t|
111
+ create_table "dept_manager", id: false, force: :cascade do |t|
112
112
  t.string "dept_no", limit: 4, null: false
113
113
  t.integer "emp_no", null: false
114
114
  t.date "from_date", null: false
@@ -125,14 +125,14 @@ describe 'Ridgepole::Client.diff' do
125
125
  f.puts <<-RUBY
126
126
  require "file2.required"
127
127
 
128
- create_table "employee_clubs", force: true do |t|
128
+ create_table "employee_clubs", force: :cascade do |t|
129
129
  t.integer "emp_no", unsigned: true, null: false
130
130
  t.integer "club_id", unsigned: false, null: true
131
131
  end
132
132
 
133
133
  add_index "employee_clubs", ["emp_no", "club_id"], name: "idx_emp_no_club_id", using: :btree
134
134
 
135
- create_table "employees", primary_key: "emp_no", force: true do |t|
135
+ create_table "employees", primary_key: "emp_no", force: :cascade do |t|
136
136
  t.date "birth_date", null: false
137
137
  t.string "first_name", limit: 14, null: false
138
138
  t.string "last_name", limit: 20, default: "XXX", null: false
@@ -140,7 +140,7 @@ describe 'Ridgepole::Client.diff' do
140
140
  t.date "hire_date", null: false
141
141
  end
142
142
 
143
- create_table "salaries", id: false, force: true do |t|
143
+ create_table "salaries", id: false, force: :cascade do |t|
144
144
  t.integer "emp_no", null: false
145
145
  t.integer "salary", null: false
146
146
  t.date "from_date", null: false
@@ -149,7 +149,7 @@ describe 'Ridgepole::Client.diff' do
149
149
 
150
150
  add_index "salaries", ["emp_no"], name: "emp_no", using: :btree
151
151
 
152
- create_table "titles", id: false, force: true do |t|
152
+ create_table "titles", id: false, force: :cascade do |t|
153
153
  t.integer "emp_no", null: false
154
154
  t.string "title", limit: 50, null: false
155
155
  t.date "from_date", null: false
@@ -172,8 +172,8 @@ describe 'Ridgepole::Client.diff' do
172
172
  expect(delta.script).to eq <<-RUBY.strip_heredoc.strip
173
173
  change_column("employee_clubs", "club_id", :integer, {:unsigned=>false, :null=>true, :default=>nil})
174
174
 
175
- change_column("employees", "last_name", :string, {:limit=>20, :default=>"XXX", :null=>false, :unsigned=>false})
176
- change_column("employees", "gender", :string, {:limit=>2, :null=>false, :unsigned=>false})
175
+ change_column("employees", "last_name", :string, {:limit=>20, :default=>"XXX", :null=>false})
176
+ change_column("employees", "gender", :string, {:limit=>2, :null=>false})
177
177
  RUBY
178
178
  }
179
179
 
@@ -2,19 +2,19 @@ describe 'Ridgepole::Client.diff' do
2
2
  context 'when change column' do
3
3
  let(:actual_dsl) {
4
4
  <<-RUBY
5
- create_table "clubs", force: true do |t|
5
+ create_table "clubs", force: :cascade do |t|
6
6
  t.string "name", 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", 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|
17
+ create_table "dept_emp", id: false, force: :cascade do |t|
18
18
  t.integer "emp_no", null: false
19
19
  t.string "dept_no", limit: 4, null: false
20
20
  t.date "from_date", null: false
@@ -24,7 +24,7 @@ describe 'Ridgepole::Client.diff' 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
29
  t.integer "emp_no", null: false
30
30
  t.date "from_date", null: false
@@ -34,14 +34,14 @@ describe 'Ridgepole::Client.diff' 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|
37
+ create_table "employee_clubs", force: :cascade do |t|
38
38
  t.integer "emp_no", null: false, unsigned: true
39
39
  t.integer "club_id", null: false, unsigned: true
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", 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,7 +49,7 @@ describe 'Ridgepole::Client.diff' do
49
49
  t.date "hire_date", null: false
50
50
  end
51
51
 
52
- create_table "salaries", id: false, force: true do |t|
52
+ create_table "salaries", id: false, force: :cascade do |t|
53
53
  t.integer "emp_no", null: false
54
54
  t.integer "salary", null: false
55
55
  t.date "from_date", null: false
@@ -58,7 +58,7 @@ describe 'Ridgepole::Client.diff' do
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|
61
+ create_table "titles", id: false, force: :cascade do |t|
62
62
  t.integer "emp_no", null: false
63
63
  t.string "title", limit: 50, null: false
64
64
  t.date "from_date", null: false
@@ -71,19 +71,19 @@ describe 'Ridgepole::Client.diff' do
71
71
 
72
72
  let(:expected_dsl) {
73
73
  <<-RUBY
74
- create_table "clubs", force: true do |t|
74
+ create_table "clubs", force: :cascade do |t|
75
75
  t.string "name", 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", 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|
86
+ create_table "dept_emp", id: false, force: :cascade do |t|
87
87
  t.integer "emp_no", null: false
88
88
  t.string "dept_no", limit: 4, null: false
89
89
  t.date "from_date", null: false
@@ -93,7 +93,7 @@ describe 'Ridgepole::Client.diff' 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
98
  t.integer "emp_no", null: false
99
99
  t.date "from_date", null: false
@@ -103,14 +103,14 @@ describe 'Ridgepole::Client.diff' 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|
106
+ create_table "employee_clubs", force: :cascade do |t|
107
107
  t.integer "emp_no", unsigned: true, null: false
108
108
  t.integer "club_id", unsigned: false, null: true
109
109
  end
110
110
 
111
111
  add_index "employee_clubs", ["emp_no", "club_id"], name: "idx_emp_no_club_id", using: :btree
112
112
 
113
- create_table "employees", primary_key: "emp_no", force: true do |t|
113
+ create_table "employees", primary_key: "emp_no", force: :cascade do |t|
114
114
  t.date "birth_date", null: false
115
115
  t.string "first_name", limit: 14, null: false
116
116
  t.string "last_name", limit: 20, default: "XXX", null: false
@@ -118,7 +118,7 @@ describe 'Ridgepole::Client.diff' do
118
118
  t.date "hire_date", null: false
119
119
  end
120
120
 
121
- create_table "salaries", id: false, force: true do |t|
121
+ create_table "salaries", id: false, force: :cascade do |t|
122
122
  t.integer "emp_no", null: false
123
123
  t.integer "salary", null: false
124
124
  t.date "from_date", null: false
@@ -127,7 +127,7 @@ describe 'Ridgepole::Client.diff' do
127
127
 
128
128
  add_index "salaries", ["emp_no"], name: "emp_no", using: :btree
129
129
 
130
- create_table "titles", id: false, force: true do |t|
130
+ create_table "titles", id: false, force: :cascade do |t|
131
131
  t.integer "emp_no", null: false
132
132
  t.string "title", limit: 50, null: false
133
133
  t.date "from_date", null: false
@@ -146,8 +146,8 @@ describe 'Ridgepole::Client.diff' do
146
146
  expect(delta.script).to eq <<-RUBY.strip_heredoc.strip
147
147
  change_column("employee_clubs", "club_id", :integer, {:unsigned=>false, :null=>true, :default=>nil})
148
148
 
149
- change_column("employees", "last_name", :string, {:limit=>20, :default=>"XXX", :null=>false, :unsigned=>false})
150
- change_column("employees", "gender", :string, {:limit=>2, :null=>false, :unsigned=>false})
149
+ change_column("employees", "last_name", :string, {:limit=>20, :default=>"XXX", :null=>false})
150
+ change_column("employees", "gender", :string, {:limit=>2, :null=>false})
151
151
  RUBY
152
152
  }
153
153
  end
@@ -19,20 +19,20 @@ describe 'Ridgepole::Client.dump' do
19
19
 
20
20
  it {
21
21
  expect(subject.dump(conn_spec, options)).to eq <<-RUBY.strip_heredoc.strip
22
- create_table "clubs", force: true do |t|
23
- t.string "name", default: "", null: false
22
+ create_table "clubs",#{if_mysql_awesome_enabled(' unsigned: true,')} force: :cascade do |t|
23
+ t.string "name", limit: 255, default: "", null: false
24
24
  end
25
25
 
26
26
  add_index "clubs", ["name"], name: "idx_name", unique: true, using: :btree
27
27
 
28
- create_table "departments", primary_key: "dept_no",#{mysql_awesome_enabled? ? ' id: :string, limit: 4,' : ''} force: true do |t|
28
+ create_table "departments", primary_key: "dept_no",#{mysql_awesome_enabled? ? ' id: :string, limit: 4,' : ''} force: :cascade do |t|
29
29
  t.string "dept_name", limit: 40, null: false
30
30
  end
31
31
 
32
32
  add_index "departments", ["dept_name"], name: "dept_name", unique: true, using: :btree
33
33
 
34
- create_table "dept_emp", id: false, force: true do |t|
35
- t.integer "emp_no", null: false
34
+ create_table "dept_emp", id: false, force: :cascade do |t|
35
+ t.integer "emp_no", limit: 4, null: false
36
36
  t.string "dept_no", limit: 4, null: false
37
37
  t.date "from_date", null: false
38
38
  t.date "to_date", null: false
@@ -41,9 +41,9 @@ describe 'Ridgepole::Client.dump' do
41
41
  add_index "dept_emp", ["dept_no"], name: "dept_no", using: :btree
42
42
  add_index "dept_emp", ["emp_no"], name: "emp_no", using: :btree
43
43
 
44
- create_table "dept_manager", id: false, force: true do |t|
44
+ create_table "dept_manager", id: false, force: :cascade do |t|
45
45
  t.string "dept_no", limit: 4, null: false
46
- t.integer "emp_no", null: false
46
+ t.integer "emp_no", limit: 4, null: false
47
47
  t.date "from_date", null: false
48
48
  t.date "to_date", null: false
49
49
  end
@@ -51,14 +51,14 @@ describe 'Ridgepole::Client.dump' do
51
51
  add_index "dept_manager", ["dept_no"], name: "dept_no", using: :btree
52
52
  add_index "dept_manager", ["emp_no"], name: "emp_no", using: :btree
53
53
 
54
- create_table "employee_clubs", force: true do |t|
55
- t.integer "emp_no", null: false, unsigned: true
56
- t.integer "club_id", null: false, unsigned: true
54
+ create_table "employee_clubs",#{if_mysql_awesome_enabled(' unsigned: true,')} force: :cascade do |t|
55
+ t.integer "emp_no", limit: 4, null: false#{unsigned_if_enabled}
56
+ t.integer "club_id", limit: 4, null: false#{unsigned_if_enabled}
57
57
  end
58
58
 
59
59
  add_index "employee_clubs", ["emp_no", "club_id"], name: "idx_emp_no_club_id", using: :btree
60
60
 
61
- create_table "employees", primary_key: "emp_no",#{mysql_awesome_enabled? ? ' id: :integer,' : ''} force: true do |t|
61
+ create_table "employees", primary_key: "emp_no",#{if_mysql_awesome_enabled(' id: :integer, limit: 4,')} force: :cascade do |t|
62
62
  t.date "birth_date", null: false
63
63
  t.string "first_name", limit: 14, null: false
64
64
  t.string "last_name", limit: 16, null: false
@@ -66,17 +66,17 @@ describe 'Ridgepole::Client.dump' do
66
66
  t.date "hire_date", null: false
67
67
  end
68
68
 
69
- create_table "salaries", id: false, force: true do |t|
70
- t.integer "emp_no", null: false
71
- t.integer "salary", null: false
72
- t.date "from_date", null: false
73
- t.date "to_date", null: false
69
+ create_table "salaries", id: false, force: :cascade do |t|
70
+ t.integer "emp_no", limit: 4, null: false
71
+ t.integer "salary", limit: 4, null: false
72
+ t.date "from_date", null: false
73
+ t.date "to_date", null: false
74
74
  end
75
75
 
76
76
  add_index "salaries", ["emp_no"], name: "emp_no", using: :btree
77
77
 
78
- create_table "titles", id: false, force: true do |t|
79
- t.integer "emp_no", null: false
78
+ create_table "titles", id: false, force: :cascade do |t|
79
+ t.integer "emp_no", limit: 4, null: false
80
80
  t.string "title", limit: 50, null: false
81
81
  t.date "from_date", null: false
82
82
  t.date "to_date"
@@ -5,7 +5,7 @@ describe 'Ridgepole::Client#dump' do
5
5
 
6
6
  it {
7
7
  expect(subject.dump).to eq <<-RUBY.strip_heredoc.strip
8
- create_table "employees", primary_key: "emp_no",#{mysql_awesome_enabled? ? ' id: :integer,' : ''} force: true do |t|
8
+ create_table "employees", primary_key: "emp_no",#{if_mysql_awesome_enabled(' id: :integer, limit: 4,')} force: :cascade do |t|
9
9
  t.date "birth_date", null: false
10
10
  t.string "first_name", limit: 14, null: false
11
11
  t.string "last_name", limit: 16, null: false
@@ -13,11 +13,11 @@ describe 'Ridgepole::Client#dump' do
13
13
  t.date "hire_date", null: false
14
14
  end
15
15
 
16
- create_table "salaries", id: false, force: true do |t|
17
- t.integer "emp_no", null: false
18
- t.integer "salary", null: false
19
- t.date "from_date", null: false
20
- t.date "to_date", null: false
16
+ create_table "salaries", id: false, force: :cascade do |t|
17
+ t.integer "emp_no", limit: 4, null: false
18
+ t.integer "salary", limit: 4, null: false
19
+ t.date "from_date", null: false
20
+ t.date "to_date", null: false
21
21
  end
22
22
 
23
23
  add_index "salaries", ["emp_no"], name: "emp_no", using: :btree
@@ -40,7 +40,7 @@ describe 'Ridgepole::Client#dump' do
40
40
 
41
41
  it {
42
42
  expect(subject.dump).to eq <<-RUBY.strip_heredoc.strip
43
- create_table "employees", primary_key: "emp_no",#{mysql_awesome_enabled? ? ' id: :integer,' : ''} force: true do |t|
43
+ create_table "employees", primary_key: "emp_no",#{if_mysql_awesome_enabled(' id: :integer, limit: 4,')} 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
@@ -48,11 +48,11 @@ describe 'Ridgepole::Client#dump' do
48
48
  t.date "hire_date", null: false
49
49
  end
50
50
 
51
- create_table "salaries", id: false, force: true do |t|
52
- t.integer "emp_no", null: false
53
- t.integer "salary", null: false
54
- t.date "from_date", null: false
55
- t.date "to_date", null: false
51
+ create_table "salaries", id: false, force: :cascade do |t|
52
+ t.integer "emp_no", limit: 4, null: false
53
+ t.integer "salary", limit: 4, null: false
54
+ t.date "from_date", null: false
55
+ t.date "to_date", null: false
56
56
  end
57
57
 
58
58
  add_index "salaries", ["emp_no"], name: "emp_no", using: :btree