ridgepole 0.6.0.beta4 → 0.6.0.beta5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bc1b762a10fbde926c1087d0908416e96c3c10ed
4
- data.tar.gz: b0e1bce4be3f05dbfe958baae95f81c6b5f5bbc0
3
+ metadata.gz: a35d445a5a8f6d0916949a9c293d749ada5c8e4a
4
+ data.tar.gz: c1f9977f87611fcd14d1f3ea08e8b25c4fd0f891
5
5
  SHA512:
6
- metadata.gz: 8a39a465ca7cdbf447b68fc16a4bcc6a8c4adcbe49861244ebad89766ed298f7a5bd106a54dee5872de30c04f45e0e78a83a41fceab4e0415473fa2ca37fe6fd
7
- data.tar.gz: ec19f3aee132852785a6c3198b36212c617e17d3c54c98c2286db13567edc3a12031419c0535c19e582800f4d48cff460c0faf6a221362879a6475bb63b0e089
6
+ metadata.gz: e997a7af8390461cc35f9222fb0d153cd7a406634f27f5747c574076a8cf616587ba3a136594edc1fb678fd7c8b0b97013ce9c2f83027983de497872a2a95ec5
7
+ data.tar.gz: a03173968378ff62b6ed0460f42ac7432a4764faba1d0a7793e7f62697035fc7fa8feaa70d38c9be47a3328929b17fb404fbb5b0933b948d5ad87c9689f81d9d
data/README.md CHANGED
@@ -35,6 +35,7 @@ It defines DB schema using [Rails DSL](http://guides.rubyonrails.org/migrations.
35
35
  * foreigner
36
36
  * Disable sqlite support
37
37
  * Add PostgreSQL test
38
+ * Remove `--mysql-awesome-unsigned-pk` option
38
39
 
39
40
  ## Installation
40
41
 
@@ -79,7 +80,6 @@ Usage: ridgepole [options]
79
80
  -t, --tables TABLES
80
81
  --ignore-tables TABLES
81
82
  --enable-mysql-awesome
82
- --mysql-awesome-unsigned-pk
83
83
  --dump-without-table-options
84
84
  --index-removed-drop-column
85
85
  -r, --require LIBS
data/bin/ridgepole CHANGED
@@ -105,7 +105,6 @@ ARGV.options do |opt|
105
105
  opt.on('-t', '--tables TABLES', Array) {|v| options[:tables] = v }
106
106
  opt.on('', '--ignore-tables TABLES', Array) {|v| options[:ignore_tables] = v.map {|i| Regexp.new(i) } }
107
107
  opt.on('', '--enable-mysql-awesome') { options[:enable_mysql_awesome] = true }
108
- opt.on('', '--mysql-awesome-unsigned-pk') { options[:mysql_awesome_unsigned_pk] = true }
109
108
  opt.on('', '--dump-without-table-options') { options[:dump_without_table_options] = true }
110
109
  opt.on('', '--index-removed-drop-column') { options[:index_removed_drop_column] = true }
111
110
  opt.on('-r' , '--require LIBS', Array) {|v| v.each {|i| require i } }
@@ -16,10 +16,6 @@ class Ridgepole::Client
16
16
 
17
17
  if @options[:enable_mysql_awesome]
18
18
  require 'activerecord/mysql/awesome/base'
19
-
20
- if @options[:mysql_awesome_unsigned_pk]
21
- require 'ridgepole/ext/mysql_awesome.rb'
22
- end
23
19
  end
24
20
  end
25
21
 
@@ -1,3 +1,3 @@
1
1
  module Ridgepole
2
- VERSION = '0.6.0.beta4'
2
+ VERSION = '0.6.0.beta5'
3
3
  end
@@ -36,7 +36,6 @@ describe 'ridgepole' do
36
36
  -t, --tables TABLES
37
37
  --ignore-tables TABLES
38
38
  --enable-mysql-awesome
39
- --mysql-awesome-unsigned-pk
40
39
  --dump-without-table-options
41
40
  --index-removed-drop-column
42
41
  -r, --require LIBS
@@ -10,7 +10,6 @@ describe 'Ridgepole::Client.dump' do
10
10
  if mysql_awesome_enabled?
11
11
  opts[:enable_mysql_awesome] = true
12
12
  opts[:dump_without_table_options] = true
13
- opts[:mysql_awesome_unsigned_pk] = true
14
13
  else
15
14
  opts[:enable_mysql_unsigned] = true
16
15
  end
@@ -7,7 +7,7 @@ create_table "parent", force: :cascade do |t|
7
7
  end
8
8
 
9
9
  create_table "child", force: :cascade do |t|
10
- t.integer "parent_id"#{unsigned_if_enabled}
10
+ t.integer "parent_id"
11
11
  end
12
12
 
13
13
  add_index "child", ["parent_id"], name: "par_id", using: :btree
@@ -18,13 +18,13 @@ add_foreign_key "child", "parent", name: "child_ibfk_1", on_delete: :cascade
18
18
 
19
19
  let(:sorted_actual_dsl) {
20
20
  <<-RUBY
21
- create_table "child"#{unsigned_if_enabled}, force: :cascade do |t|
22
- t.integer "parent_id", limit: 4#{unsigned_if_enabled}
21
+ create_table "child", force: :cascade do |t|
22
+ t.integer "parent_id", limit: 4
23
23
  end
24
24
 
25
25
  add_index "child", ["parent_id"], name: "par_id", using: :btree
26
26
 
27
- create_table "parent"#{unsigned_if_enabled}, force: :cascade do |t|
27
+ create_table "parent", force: :cascade do |t|
28
28
  end
29
29
 
30
30
  add_foreign_key "child", "parent", name: "child_ibfk_1", on_delete: :cascade
@@ -33,13 +33,13 @@ add_foreign_key "child", "parent", name: "child_ibfk_1", on_delete: :cascade
33
33
 
34
34
  let(:expected_dsl) {
35
35
  <<-RUBY
36
- create_table "child"#{unsigned_if_enabled}, force: :cascade do |t|
37
- t.integer "parent_id", limit: 4#{unsigned_if_enabled}
36
+ create_table "child", force: :cascade do |t|
37
+ t.integer "parent_id", limit: 4
38
38
  end
39
39
 
40
40
  add_index "child", ["parent_id"], name: "par_id", using: :btree
41
41
 
42
- create_table "parent"#{unsigned_if_enabled}, force: :cascade do |t|
42
+ create_table "parent", force: :cascade do |t|
43
43
  end
44
44
 
45
45
  add_foreign_key "child", "parent", name: "child_ibfk_1"
@@ -60,7 +60,7 @@ create_table "parent", force: :cascade do |t|
60
60
  end
61
61
 
62
62
  create_table "child", force: :cascade do |t|
63
- t.integer "parent_id", unsigned: true
63
+ t.integer "parent_id"
64
64
  end
65
65
 
66
66
  add_index "child", ["parent_id"], name: "par_id", using: :btree
@@ -72,13 +72,13 @@ add_foreign_key "child", "parent", name: "child_ibfk_1"
72
72
  let(:sorted_dsl) {
73
73
  <<-RUBY
74
74
 
75
- create_table "child"#{unsigned_if_enabled}, force: :cascade do |t|
76
- t.integer "parent_id", limit: 4#{unsigned_if_enabled}
75
+ create_table "child", force: :cascade do |t|
76
+ t.integer "parent_id", limit: 4
77
77
  end
78
78
 
79
79
  add_index "child", ["parent_id"], name: "par_id", using: :btree
80
80
 
81
- create_table "parent"#{unsigned_if_enabled}, force: :cascade do |t|
81
+ create_table "parent", force: :cascade do |t|
82
82
  end
83
83
 
84
84
  add_foreign_key "child", "parent", name: "child_ibfk_1"
@@ -3,11 +3,11 @@ describe 'Ridgepole::Client#diff -> migrate' do
3
3
  context 'when drop fk' do
4
4
  let(:actual_dsl) {
5
5
  <<-RUBY
6
- create_table "parent"#{unsigned_if_enabled}, force: :cascade do |t|
6
+ create_table "parent", force: :cascade do |t|
7
7
  end
8
8
 
9
- create_table "child"#{unsigned_if_enabled}, force: :cascade do |t|
10
- t.integer "parent_id"#{unsigned_if_enabled}
9
+ create_table "child", force: :cascade do |t|
10
+ t.integer "parent_id"
11
11
  end
12
12
 
13
13
  add_index "child", ["parent_id"], name: "par_id", using: :btree
@@ -25,13 +25,13 @@ add_foreign_key "child", "parent", name: "child_ibfk_1"
25
25
 
26
26
  let(:expected_dsl) {
27
27
  <<-RUBY
28
- create_table "child"#{unsigned_if_enabled}, force: :cascade do |t|
29
- t.integer "parent_id", limit: 4#{unsigned_if_enabled}
28
+ create_table "child", force: :cascade do |t|
29
+ t.integer "parent_id", limit: 4
30
30
  end
31
31
 
32
32
  add_index "child", ["parent_id"], name: "par_id", using: :btree
33
33
 
34
- create_table "parent"#{unsigned_if_enabled}, force: :cascade do |t|
34
+ create_table "parent", force: :cascade do |t|
35
35
  end
36
36
  RUBY
37
37
  }
@@ -75,7 +75,7 @@ end
75
75
 
76
76
 
77
77
  create_table "child", force: :cascade do |t|
78
- t.integer "parent_id", unsigned: true
78
+ t.integer "parent_id"
79
79
  end
80
80
 
81
81
  add_index "child", ["parent_id"], name: "par_id", using: :btree
@@ -86,13 +86,13 @@ add_foreign_key "child", "parent", name: "child_ibfk_1"
86
86
 
87
87
  let(:sorted_dsl) {
88
88
  <<-RUBY
89
- create_table "child"#{unsigned_if_enabled}, force: :cascade do |t|
90
- t.integer "parent_id", limit: 4#{unsigned_if_enabled}
89
+ create_table "child", force: :cascade do |t|
90
+ t.integer "parent_id", limit: 4
91
91
  end
92
92
 
93
93
  add_index "child", ["parent_id"], name: "par_id", using: :btree
94
94
 
95
- create_table "parent"#{unsigned_if_enabled}, force: :cascade do |t|
95
+ create_table "parent", force: :cascade do |t|
96
96
  end
97
97
 
98
98
  add_foreign_key "child", "parent", name: "child_ibfk_1"
@@ -75,13 +75,13 @@ describe 'Ridgepole::Client#diff -> migrate' do
75
75
  context 'when not execute' do
76
76
  let(:dsl) {
77
77
  <<-RUBY
78
- create_table "authors"#{unsigned_if_enabled}, force: :cascade do |t|
78
+ create_table "authors", force: :cascade do |t|
79
79
  t.string "name", limit: 255, null: false
80
80
  end
81
81
 
82
- create_table "books"#{unsigned_if_enabled}, force: :cascade do |t|
82
+ create_table "books", force: :cascade do |t|
83
83
  t.string "title", limit: 255, null: false
84
- t.integer "author_id", limit: 4, null: false#{unsigned_if_enabled}
84
+ t.integer "author_id", limit: 4, null: false
85
85
  end
86
86
 
87
87
  add_index "books", ["author_id"], name: "idx_author_id", using: :btree
@@ -97,7 +97,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
97
97
 
98
98
  create_table "books", force: :cascade do |t|
99
99
  t.string "title", null: false
100
- t.integer "author_id", limit: 4, null: false#{unsigned_if_enabled}
100
+ t.integer "author_id", limit: 4, null: false
101
101
  end
102
102
 
103
103
  add_index "books", ["author_id"], name: "idx_author_id", using: :btree
@@ -120,9 +120,9 @@ describe 'Ridgepole::Client#diff -> migrate' do
120
120
 
121
121
  expect(show_create_table(:books).strip).to eq <<-SQL.strip_heredoc.strip
122
122
  CREATE TABLE `books` (
123
- `id` #{if_mysql_awesome_enabled('int(10) unsigned', 'int(11)')} NOT NULL AUTO_INCREMENT,
123
+ `id` int(11) NOT NULL AUTO_INCREMENT,
124
124
  `title` varchar(255) NOT NULL,
125
- `author_id` #{if_mysql_awesome_enabled('int(10) unsigned', 'int(11)')} NOT NULL,
125
+ `author_id` int(11) NOT NULL,
126
126
  PRIMARY KEY (`id`),
127
127
  KEY `idx_author_id` (`author_id`) USING BTREE,
128
128
  CONSTRAINT `fk_author` FOREIGN KEY (`author_id`) REFERENCES `authors` (`id`)
@@ -135,9 +135,9 @@ describe 'Ridgepole::Client#diff -> migrate' do
135
135
 
136
136
  expect(show_create_table(:books).strip).to eq <<-SQL.strip_heredoc.strip
137
137
  CREATE TABLE `books` (
138
- `id` #{if_mysql_awesome_enabled('int(10) unsigned', 'int(11)')} NOT NULL AUTO_INCREMENT,
138
+ `id` int(11) NOT NULL AUTO_INCREMENT,
139
139
  `title` varchar(255) NOT NULL,
140
- `author_id` #{if_mysql_awesome_enabled('int(10) unsigned', 'int(11)')} NOT NULL,
140
+ `author_id` int(11) NOT NULL,
141
141
  PRIMARY KEY (`id`),
142
142
  KEY `idx_author_id` (`author_id`) USING BTREE,
143
143
  CONSTRAINT `fk_author` FOREIGN KEY (`author_id`) REFERENCES `authors` (`id`)
@@ -220,13 +220,13 @@ describe 'Ridgepole::Client#diff -> migrate' do
220
220
  context 'when not execute (noop)' do
221
221
  let(:dsl) {
222
222
  <<-RUBY
223
- create_table "authors"#{unsigned_if_enabled}, force: :cascade do |t|
223
+ create_table "authors", force: :cascade do |t|
224
224
  t.string "name", limit: 255, null: false
225
225
  end
226
226
 
227
- create_table "books"#{unsigned_if_enabled}, force: :cascade do |t|
227
+ create_table "books", force: :cascade do |t|
228
228
  t.string "title", limit: 255, null: false
229
- t.integer "author_id", limit: 4, null: false#{unsigned_if_enabled}
229
+ t.integer "author_id", limit: 4, null: false
230
230
  end
231
231
 
232
232
  add_index "books", ["author_id"], name: "idx_author_id", using: :btree
@@ -242,7 +242,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
242
242
 
243
243
  create_table "books", force: :cascade do |t|
244
244
  t.string "title", null: false
245
- t.integer "author_id", limit: 4, null: false#{unsigned_if_enabled}
245
+ t.integer "author_id", limit: 4, null: false
246
246
  end
247
247
 
248
248
  add_index "books", ["author_id"], name: "idx_author_id", using: :btree
@@ -265,9 +265,9 @@ describe 'Ridgepole::Client#diff -> migrate' do
265
265
 
266
266
  expect(show_create_table(:books).strip).to eq <<-SQL.strip_heredoc.strip
267
267
  CREATE TABLE `books` (
268
- `id` #{if_mysql_awesome_enabled('int(10) unsigned', 'int(11)')} NOT NULL AUTO_INCREMENT,
268
+ `id` int(11) NOT NULL AUTO_INCREMENT,
269
269
  `title` varchar(255) NOT NULL,
270
- `author_id` #{if_mysql_awesome_enabled('int(10) unsigned', 'int(11)')} NOT NULL,
270
+ `author_id` int(11) NOT NULL,
271
271
  PRIMARY KEY (`id`),
272
272
  KEY `idx_author_id` (`author_id`) USING BTREE,
273
273
  CONSTRAINT `fk_author` FOREIGN KEY (`author_id`) REFERENCES `authors` (`id`)
@@ -282,9 +282,9 @@ describe 'Ridgepole::Client#diff -> migrate' do
282
282
 
283
283
  expect(show_create_table(:books).strip).to eq <<-SQL.strip_heredoc.strip
284
284
  CREATE TABLE `books` (
285
- `id` #{if_mysql_awesome_enabled('int(10) unsigned', 'int(11)')} NOT NULL AUTO_INCREMENT,
285
+ `id` int(11) NOT NULL AUTO_INCREMENT,
286
286
  `title` varchar(255) NOT NULL,
287
- `author_id` #{if_mysql_awesome_enabled('int(10) unsigned', 'int(11)')} NOT NULL,
287
+ `author_id` int(11) NOT NULL,
288
288
  PRIMARY KEY (`id`),
289
289
  KEY `idx_author_id` (`author_id`) USING BTREE,
290
290
  CONSTRAINT `fk_author` FOREIGN KEY (`author_id`) REFERENCES `authors` (`id`)
@@ -83,9 +83,9 @@ describe 'Ridgepole::Client#diff -> migrate' do
83
83
  sql = sql.each_line.map {|i| i.strip }.join("\n")
84
84
 
85
85
  expect(sql).to eq <<-SQL.strip_heredoc.strip
86
- CREATE TABLE `clubs` (`id` #{if_mysql_awesome_enabled('int unsigned PRIMARY KEY AUTO_INCREMENT', 'int(11) auto_increment PRIMARY KEY')}, `name` varchar(255) DEFAULT '' NOT NULL) ENGINE=InnoDB
86
+ CREATE TABLE `clubs` (`id` #{if_mysql_awesome_enabled('int PRIMARY KEY AUTO_INCREMENT', 'int(11) auto_increment PRIMARY KEY')}, `name` varchar(255) DEFAULT '' NOT NULL) ENGINE=InnoDB
87
87
  CREATE UNIQUE INDEX `idx_name` USING btree ON `clubs` (`name`)
88
- CREATE TABLE `departments` (`dept_no` #{if_mysql_awesome_enabled('int unsigned PRIMARY KEY AUTO_INCREMENT', 'int(11) auto_increment PRIMARY KEY')}, `dept_name` varchar(40) NOT NULL) ENGINE=InnoDB
88
+ CREATE TABLE `departments` (`dept_no` #{if_mysql_awesome_enabled('int PRIMARY KEY AUTO_INCREMENT', 'int(11) auto_increment PRIMARY KEY')}, `dept_name` varchar(40) NOT NULL) ENGINE=InnoDB
89
89
  CREATE UNIQUE INDEX `dept_name` USING btree ON `departments` (`dept_name`)
90
90
  CREATE TABLE `dept_emp` (`emp_no` #{if_mysql_awesome_enabled('int', 'int(11)')} NOT NULL, `dept_no` varchar(4) NOT NULL, `from_date` date NOT NULL, `to_date` date NOT NULL) ENGINE=InnoDB
91
91
  CREATE INDEX `dept_no` USING btree ON `dept_emp` (`dept_no`)
@@ -93,9 +93,9 @@ describe 'Ridgepole::Client#diff -> migrate' do
93
93
  CREATE TABLE `dept_manager` (`dept_no` varchar(4) NOT NULL, `emp_no` #{if_mysql_awesome_enabled('int', 'int(11)')} NOT NULL, `from_date` date NOT NULL, `to_date` date NOT NULL) ENGINE=InnoDB
94
94
  CREATE INDEX `dept_no` USING btree ON `dept_manager` (`dept_no`)
95
95
  CREATE INDEX `emp_no` USING btree ON `dept_manager` (`emp_no`)
96
- CREATE TABLE `employee_clubs` (`id` #{if_mysql_awesome_enabled('int unsigned PRIMARY KEY AUTO_INCREMENT', 'int(11) auto_increment PRIMARY KEY')}, `emp_no` #{if_mysql_awesome_enabled('int unsigned', 'int(11)')} NOT NULL, `club_id` #{if_mysql_awesome_enabled('int unsigned', 'int(11)')} NOT NULL) ENGINE=InnoDB
96
+ CREATE TABLE `employee_clubs` (`id` #{if_mysql_awesome_enabled('int PRIMARY KEY AUTO_INCREMENT', 'int(11) auto_increment PRIMARY KEY')}, `emp_no` #{if_mysql_awesome_enabled('int unsigned', 'int(11)')} NOT NULL, `club_id` #{if_mysql_awesome_enabled('int unsigned', 'int(11)')} NOT NULL) ENGINE=InnoDB
97
97
  CREATE INDEX `idx_emp_no_club_id` USING btree ON `employee_clubs` (`emp_no`, `club_id`)
98
- CREATE TABLE `employees` (`emp_no` #{if_mysql_awesome_enabled('int unsigned PRIMARY KEY AUTO_INCREMENT', 'int(11) auto_increment PRIMARY KEY')}, `birth_date` date NOT NULL, `first_name` varchar(14) NOT NULL, `last_name` varchar(16) NOT NULL, `gender` varchar(1) NOT NULL, `hire_date` date NOT NULL) ENGINE=InnoDB
98
+ CREATE TABLE `employees` (`emp_no` #{if_mysql_awesome_enabled('int PRIMARY KEY AUTO_INCREMENT', 'int(11) auto_increment PRIMARY KEY')}, `birth_date` date NOT NULL, `first_name` varchar(14) NOT NULL, `last_name` varchar(16) NOT NULL, `gender` varchar(1) NOT NULL, `hire_date` date NOT NULL) ENGINE=InnoDB
99
99
  CREATE TABLE `salaries` (`emp_no` #{if_mysql_awesome_enabled('int', 'int(11)')} NOT NULL, `salary` #{if_mysql_awesome_enabled('int', 'int(11)')} NOT NULL, `from_date` date NOT NULL, `to_date` date NOT NULL) ENGINE=InnoDB
100
100
  CREATE INDEX `emp_no` USING btree ON `salaries` (`emp_no`)
101
101
  CREATE TABLE `titles` (`emp_no` #{if_mysql_awesome_enabled('int', 'int(11)')} NOT NULL, `title` varchar(50) NOT NULL, `from_date` date NOT NULL, `to_date` date) ENGINE=InnoDB
@@ -113,17 +113,17 @@ describe 'Ridgepole::Client#diff -> migrate' do
113
113
  sql = sql.each_line.map {|i| i.strip }.join("\n")
114
114
 
115
115
  expect(sql).to eq <<-SQL.strip_heredoc.strip
116
- CREATE TABLE `clubs` (`id` #{if_mysql_awesome_enabled('int unsigned PRIMARY KEY AUTO_INCREMENT', 'int(11) auto_increment PRIMARY KEY')}, `name` varchar(255) DEFAULT '' NOT NULL) ENGINE=InnoDB
116
+ CREATE TABLE `clubs` (`id` #{if_mysql_awesome_enabled('int PRIMARY KEY AUTO_INCREMENT', 'int(11) auto_increment PRIMARY KEY')}, `name` varchar(255) DEFAULT '' NOT NULL) ENGINE=InnoDB
117
117
  ALTER TABLE `clubs` ADD UNIQUE INDEX idx_name (`name`)
118
- CREATE TABLE `departments` (`dept_no` #{if_mysql_awesome_enabled('int unsigned PRIMARY KEY AUTO_INCREMENT', 'int(11) auto_increment PRIMARY KEY')}, `dept_name` varchar(40) NOT NULL) ENGINE=InnoDB
118
+ CREATE TABLE `departments` (`dept_no` #{if_mysql_awesome_enabled('int PRIMARY KEY AUTO_INCREMENT', 'int(11) auto_increment PRIMARY KEY')}, `dept_name` varchar(40) NOT NULL) ENGINE=InnoDB
119
119
  ALTER TABLE `departments` ADD UNIQUE INDEX dept_name (`dept_name`)
120
120
  CREATE TABLE `dept_emp` (`emp_no` #{if_mysql_awesome_enabled('int', 'int(11)')} NOT NULL, `dept_no` varchar(4) NOT NULL, `from_date` date NOT NULL, `to_date` date NOT NULL) ENGINE=InnoDB
121
121
  ALTER TABLE `dept_emp` ADD INDEX dept_no (`dept_no`), ADD INDEX emp_no (`emp_no`)
122
122
  CREATE TABLE `dept_manager` (`dept_no` varchar(4) NOT NULL, `emp_no` #{if_mysql_awesome_enabled('int', 'int(11)')} NOT NULL, `from_date` date NOT NULL, `to_date` date NOT NULL) ENGINE=InnoDB
123
123
  ALTER TABLE `dept_manager` ADD INDEX dept_no (`dept_no`), ADD INDEX emp_no (`emp_no`)
124
- CREATE TABLE `employee_clubs` (`id` #{if_mysql_awesome_enabled('int unsigned PRIMARY KEY AUTO_INCREMENT', 'int(11) auto_increment PRIMARY KEY')}, `emp_no` #{if_mysql_awesome_enabled('int unsigned', 'int(11)')} NOT NULL, `club_id` #{if_mysql_awesome_enabled('int unsigned', 'int(11)')} NOT NULL) ENGINE=InnoDB
124
+ CREATE TABLE `employee_clubs` (`id` #{if_mysql_awesome_enabled('int PRIMARY KEY AUTO_INCREMENT', 'int(11) auto_increment PRIMARY KEY')}, `emp_no` #{if_mysql_awesome_enabled('int unsigned', 'int(11)')} NOT NULL, `club_id` #{if_mysql_awesome_enabled('int unsigned', 'int(11)')} NOT NULL) ENGINE=InnoDB
125
125
  ALTER TABLE `employee_clubs` ADD INDEX idx_emp_no_club_id (`emp_no`, `club_id`)
126
- CREATE TABLE `employees` (`emp_no` #{if_mysql_awesome_enabled('int unsigned PRIMARY KEY AUTO_INCREMENT', 'int(11) auto_increment PRIMARY KEY')}, `birth_date` date NOT NULL, `first_name` varchar(14) NOT NULL, `last_name` varchar(16) NOT NULL, `gender` varchar(1) NOT NULL, `hire_date` date NOT NULL) ENGINE=InnoDB
126
+ CREATE TABLE `employees` (`emp_no` #{if_mysql_awesome_enabled('int PRIMARY KEY AUTO_INCREMENT', 'int(11) auto_increment PRIMARY KEY')}, `birth_date` date NOT NULL, `first_name` varchar(14) NOT NULL, `last_name` varchar(16) NOT NULL, `gender` varchar(1) NOT NULL, `hire_date` date NOT NULL) ENGINE=InnoDB
127
127
  CREATE TABLE `salaries` (`emp_no` #{if_mysql_awesome_enabled('int', 'int(11)')} NOT NULL, `salary` #{if_mysql_awesome_enabled('int', 'int(11)')} NOT NULL, `from_date` date NOT NULL, `to_date` date NOT NULL) ENGINE=InnoDB
128
128
  ALTER TABLE `salaries` ADD INDEX emp_no (`emp_no`)
129
129
  CREATE TABLE `titles` (`emp_no` #{if_mysql_awesome_enabled('int', 'int(11)')} NOT NULL, `title` varchar(50) NOT NULL, `from_date` date NOT NULL, `to_date` date) ENGINE=InnoDB
@@ -215,9 +215,9 @@ describe 'Ridgepole::Client#diff -> migrate' do
215
215
  sql = sql.each_line.map {|i| i.strip }.join("\n")
216
216
 
217
217
  expect(sql).to eq <<-SQL.strip_heredoc.strip
218
- CREATE TABLE `clubs` (`id` #{if_mysql_awesome_enabled('int unsigned PRIMARY KEY AUTO_INCREMENT', 'int(11) auto_increment PRIMARY KEY')}, `name` varchar(255) DEFAULT '' NOT NULL) ENGINE=InnoDB
218
+ CREATE TABLE `clubs` (`id` #{if_mysql_awesome_enabled('int PRIMARY KEY AUTO_INCREMENT', 'int(11) auto_increment PRIMARY KEY')}, `name` varchar(255) DEFAULT '' NOT NULL) ENGINE=InnoDB
219
219
  CREATE UNIQUE INDEX `idx_name` USING btree ON `clubs` (`name`)
220
- CREATE TABLE `departments` (`dept_no` #{if_mysql_awesome_enabled('int unsigned PRIMARY KEY AUTO_INCREMENT', 'int(11) auto_increment PRIMARY KEY')}, `dept_name` varchar(40) NOT NULL) ENGINE=InnoDB
220
+ CREATE TABLE `departments` (`dept_no` #{if_mysql_awesome_enabled('int PRIMARY KEY AUTO_INCREMENT', 'int(11) auto_increment PRIMARY KEY')}, `dept_name` varchar(40) NOT NULL) ENGINE=InnoDB
221
221
  CREATE UNIQUE INDEX `dept_name` USING btree ON `departments` (`dept_name`)
222
222
  CREATE TABLE `dept_emp` (`emp_no` #{if_mysql_awesome_enabled('int', 'int(11)')} NOT NULL, `dept_no` varchar(4) NOT NULL, `from_date` date NOT NULL, `to_date` date NOT NULL) ENGINE=InnoDB
223
223
  CREATE INDEX `dept_no` USING btree ON `dept_emp` (`dept_no`)
@@ -225,9 +225,9 @@ describe 'Ridgepole::Client#diff -> migrate' do
225
225
  CREATE TABLE `dept_manager` (`dept_no` varchar(4) NOT NULL, `emp_no` #{if_mysql_awesome_enabled('int', 'int(11)')} NOT NULL, `from_date` date NOT NULL, `to_date` date NOT NULL) ENGINE=InnoDB
226
226
  CREATE INDEX `dept_no` USING btree ON `dept_manager` (`dept_no`)
227
227
  CREATE INDEX `emp_no` USING btree ON `dept_manager` (`emp_no`)
228
- CREATE TABLE `employee_clubs` (`id` #{if_mysql_awesome_enabled('int unsigned PRIMARY KEY AUTO_INCREMENT', 'int(11) auto_increment PRIMARY KEY')}, `emp_no` #{if_mysql_awesome_enabled('int unsigned', 'int(11)')} NOT NULL, `club_id` #{if_mysql_awesome_enabled('int unsigned', 'int(11)')} NOT NULL) ENGINE=InnoDB
228
+ CREATE TABLE `employee_clubs` (`id` #{if_mysql_awesome_enabled('int PRIMARY KEY AUTO_INCREMENT', 'int(11) auto_increment PRIMARY KEY')}, `emp_no` #{if_mysql_awesome_enabled('int unsigned', 'int(11)')} NOT NULL, `club_id` #{if_mysql_awesome_enabled('int unsigned', 'int(11)')} NOT NULL) ENGINE=InnoDB
229
229
  CREATE INDEX `idx_emp_no_club_id` USING btree ON `employee_clubs` (`emp_no`, `club_id`)
230
- CREATE TABLE `employees` (`emp_no` #{if_mysql_awesome_enabled('int unsigned PRIMARY KEY AUTO_INCREMENT', 'int(11) auto_increment PRIMARY KEY')}, `birth_date` date NOT NULL, `first_name` varchar(14) NOT NULL, `last_name` varchar(16) NOT NULL, `gender` varchar(1) NOT NULL, `hire_date` date NOT NULL) ENGINE=InnoDB
230
+ CREATE TABLE `employees` (`emp_no` #{if_mysql_awesome_enabled('int PRIMARY KEY AUTO_INCREMENT', 'int(11) auto_increment PRIMARY KEY')}, `birth_date` date NOT NULL, `first_name` varchar(14) NOT NULL, `last_name` varchar(16) NOT NULL, `gender` varchar(1) NOT NULL, `hire_date` date NOT NULL) ENGINE=InnoDB
231
231
  CREATE TABLE `salaries` (`emp_no` #{if_mysql_awesome_enabled('int', 'int(11)')} NOT NULL, `salary` #{if_mysql_awesome_enabled('int', 'int(11)')} NOT NULL, `from_date` date NOT NULL, `to_date` date NOT NULL) ENGINE=InnoDB
232
232
  CREATE INDEX `emp_no` USING btree ON `salaries` (`emp_no`)
233
233
  CREATE TABLE `titles` (`emp_no` #{if_mysql_awesome_enabled('int', 'int(11)')} NOT NULL, `title` varchar(50) NOT NULL, `from_date` date NOT NULL, `to_date` date) ENGINE=InnoDB
@@ -45,7 +45,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
45
45
 
46
46
  let(:expected_dsl) {
47
47
  <<-RUBY
48
- create_table "employees", primary_key: "emp_no"#{unsigned_if_enabled}, force: :cascade do |t|
48
+ create_table "employees", primary_key: "emp_no", 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
@@ -112,7 +112,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
112
112
 
113
113
  let(:before_dsl) {
114
114
  <<-RUBY
115
- create_table "employees", primary_key: "emp_no"#{unsigned_if_enabled}, force: :cascade do |t|
115
+ create_table "employees", primary_key: "emp_no", force: :cascade do |t|
116
116
  t.date "birth_date", null: false
117
117
  t.string "first_name", limit: 14, null: false
118
118
  t.string "last_name", limit: 16, null: false
@@ -124,7 +124,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
124
124
 
125
125
  let(:after_dsl) {
126
126
  <<-RUBY
127
- create_table "employees", primary_key: "emp_no"#{unsigned_if_enabled}, force: :cascade do |t|
127
+ create_table "employees", primary_key: "emp_no", force: :cascade do |t|
128
128
  t.date "birth_date", null: false
129
129
  t.string "first_name", limit: 15, null: false
130
130
  t.string "last_name", limit: 16, null: false
@@ -37,8 +37,8 @@ describe 'Ridgepole::Client#diff -> migrate' do
37
37
  add_index "dept_manager", ["emp_no"], name: "emp_no", using: :btree
38
38
 
39
39
  create_table "employee_clubs", force: :cascade do |t|
40
- t.integer "emp_no", null: false#{unsigned_if_enabled}
41
- t.integer "club_id", null: false#{unsigned_if_enabled}
40
+ t.integer "emp_no", null: false
41
+ t.integer "club_id", null: false
42
42
  end
43
43
 
44
44
  add_index "employee_clubs", ["emp_no", "club_id"], name: "idx_emp_no_club_id", using: :btree
@@ -73,13 +73,13 @@ describe 'Ridgepole::Client#diff -> migrate' do
73
73
 
74
74
  let(:expected_dsl) {
75
75
  <<-RUBY
76
- create_table "clubs"#{unsigned_if_enabled}, force: :cascade do |t|
76
+ create_table "clubs", force: :cascade do |t|
77
77
  t.string "name", limit: 255, default: "", null: false
78
78
  end
79
79
 
80
80
  add_index "clubs", ["name"], name: "idx_name", unique: true, using: :btree
81
81
 
82
- create_table "departments", primary_key: "dept_no"#{unsigned_if_enabled}, force: :cascade do |t|
82
+ create_table "departments", primary_key: "dept_no", force: :cascade do |t|
83
83
  t.string "dept_name", limit: 40, null: false
84
84
  end
85
85
 
@@ -105,14 +105,14 @@ describe 'Ridgepole::Client#diff -> migrate' do
105
105
  add_index "dept_manager", ["dept_no"], name: "dept_no", using: :btree
106
106
  add_index "dept_manager", ["emp_no"], name: "emp_no", using: :btree
107
107
 
108
- create_table "employee_clubs"#{unsigned_if_enabled}, force: :cascade do |t|
109
- t.integer "emp_no", limit: 4, null: false#{unsigned_if_enabled}
110
- t.integer "club_id", limit: 4, null: false#{unsigned_if_enabled}
108
+ create_table "employee_clubs", force: :cascade do |t|
109
+ t.integer "emp_no", limit: 4, null: false
110
+ t.integer "club_id", limit: 4, null: false
111
111
  end
112
112
 
113
113
  add_index "employee_clubs", ["emp_no", "club_id"], name: "idx_emp_no_club_id", using: :btree
114
114
 
115
- create_table "employees", primary_key: "emp_no"#{unsigned_if_enabled}, force: :cascade do |t|
115
+ create_table "employees", primary_key: "emp_no", force: :cascade do |t|
116
116
  t.date "birth_date", null: false
117
117
  t.string "first_name", limit: 14, null: false
118
118
  t.string "last_name", limit: 16, null: false
@@ -45,7 +45,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
45
45
 
46
46
  let(:expected_dsl) {
47
47
  <<-RUBY
48
- create_table "employees", primary_key: "emp_no"#{unsigned_if_enabled}, force: :cascade do |t|
48
+ create_table "employees", primary_key: "emp_no", 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
@@ -112,7 +112,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
112
112
 
113
113
  let(:before_dsl) {
114
114
  <<-RUBY
115
- create_table "employees", primary_key: "emp_no"#{unsigned_if_enabled}, force: :cascade do |t|
115
+ create_table "employees", primary_key: "emp_no", force: :cascade do |t|
116
116
  t.date "birth_date", null: false
117
117
  t.string "first_name", limit: 14, null: false
118
118
  t.string "last_name", limit: 16, null: false
@@ -124,7 +124,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
124
124
 
125
125
  let(:after_dsl) {
126
126
  <<-RUBY
127
- create_table "employees", primary_key: "emp_no"#{unsigned_if_enabled}, force: :cascade do |t|
127
+ create_table "employees", primary_key: "emp_no", force: :cascade do |t|
128
128
  t.date "birth_date", null: false
129
129
  t.string "first_name", limit: 15, null: false
130
130
  t.string "last_name", limit: 16, null: false
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ridgepole
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0.beta4
4
+ version: 0.6.0.beta5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Genki Sugawara
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-25 00:00:00.000000000 Z
11
+ date: 2015-04-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -148,7 +148,6 @@ files:
148
148
  - lib/ridgepole/dsl_parser.rb
149
149
  - lib/ridgepole/dumper.rb
150
150
  - lib/ridgepole/execute_expander.rb
151
- - lib/ridgepole/ext/mysql_awesome.rb
152
151
  - lib/ridgepole/logger.rb
153
152
  - lib/ridgepole/migration_ext.rb
154
153
  - lib/ridgepole/schema_dumper_ext.rb
@@ -1,12 +0,0 @@
1
- # XXX: https://github.com/waka/activerecord-mysql-unsigned/blob/v0.3.1/lib/activerecord-mysql-unsigned/active_record/v3/connection_adapters/abstract/schema_definitions.rb#L14
2
- class ActiveRecord::ConnectionAdapters::TableDefinition
3
- alias primary_key_without_unsigned primary_key
4
-
5
- def primary_key(name, type = :primary_key, options = {})
6
- if options.has_key?(:id)
7
- primary_key_without_unsigned(name, type, options)
8
- else
9
- primary_key_without_unsigned(name, type, options.merge(primary_key: true).reverse_merge(unsigned: true))
10
- end
11
- end
12
- end