ridgepole 0.5.2.beta4 → 0.5.2.beta5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/bin/ridgepole +2 -0
- data/lib/ridgepole/ext/mysql_awesome.rb +3 -3
- data/lib/ridgepole/version.rb +1 -1
- data/ridgepole.gemspec +1 -1
- data/spec/bigint_pk/bigint_pkspec.rb +26 -3
- data/spec/dump/dump_class_method_spec.rb +2 -2
- data/spec/dump/dump_some_tables_spec.rb +2 -2
- data/spec/dump/dump_spec.rb +2 -2
- data/spec/migrate/migrate_same_spec.rb +2 -2
- data/spec/~pkdump/pkdump_spec.rb +55 -53
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: de9a514d07eefef782978b4596ba99e7f6e2b34a
|
4
|
+
data.tar.gz: 11d93af89a4e11c2bbcef22288526ed5a33d8b71
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3289ea853a8e50f5f848aed1185a12e664c6e09ad1641122a33503d05e8084e47d63b224b157a2080a2659d7a633c56ade149e5435c612af971b790ea5b90887
|
7
|
+
data.tar.gz: 6853b8ace7855d16ef49219cc12b53cbd1498b6e89180441936f55bcdbd9daf2714d3fac8c4207ba6fc366030f438ab95465bedf322a64d9677d74bdb4d36ef0
|
data/README.md
CHANGED
@@ -24,8 +24,8 @@ It defines DB schema using [Rails DSL](http://guides.rubyonrails.org/migrations.
|
|
24
24
|
* Add `--enable-migration-comments` option ([migration_comments](https://github.com/pinnymz/migration_comments) is required)
|
25
25
|
* Fix rails version `< 4.2.0`
|
26
26
|
* `>= 0.5.2`
|
27
|
-
* Add `--enable-mysql-awesome` option ([activerecord-mysql-awesome](https://github.com/kamipo/activerecord-mysql-awesome) is required)
|
28
|
-
* It is not possible to enable both `--enable-migration-comments` and `--enable-mysql-awesome`
|
27
|
+
* Add `--enable-mysql-awesome` option ([activerecord-mysql-awesome](https://github.com/kamipo/activerecord-mysql-awesome) is required `>= 0.0.3`)
|
28
|
+
* It is not possible to enable both `--enable-mysql-awesome` and --enable-migration-comments`, `--enable-mysql-awesome` and --enable-mysql-unsigned`, `--enable-mysql-awesome` and --enable-mysql-pkdump`
|
29
29
|
* Fix foreigner version `<= 1.7.1`
|
30
30
|
|
31
31
|
## Installation
|
@@ -193,7 +193,7 @@ create_table "articles", force: true, options: "ENGINE=InnoDB DEFAULT CHARSET=ut
|
|
193
193
|
t.text "text", null: false, collation: "utf8mb4_bin"
|
194
194
|
t.datetime "created_at"
|
195
195
|
t.datetime "updated_at"
|
196
|
-
|
196
|
+
end
|
197
197
|
```
|
198
198
|
|
199
199
|
## bigint support
|
data/bin/ridgepole
CHANGED
@@ -120,6 +120,8 @@ ARGV.options do |opt|
|
|
120
120
|
raise "It is not possible to enable both `--enable-mysql-awesome` and `--enable-migration-comments`"
|
121
121
|
elsif options[:enable_mysql_unsigned]
|
122
122
|
raise "It is not possible to enable both `--enable-mysql-awesome` and `--enable-mysql-unsigned`"
|
123
|
+
elsif options[:enable_mysql_pkdump]
|
124
|
+
raise "It is not possible to enable both `--enable-mysql-awesome` and `--enable-mysql-pkdump`"
|
123
125
|
end
|
124
126
|
end
|
125
127
|
rescue => e
|
@@ -1,8 +1,8 @@
|
|
1
|
-
require 'active_record/connection_adapters/abstract/schema_definitions'
|
2
|
-
|
3
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
|
4
2
|
class ActiveRecord::ConnectionAdapters::TableDefinition
|
3
|
+
alias primary_key_without_unsigned primary_key
|
4
|
+
|
5
5
|
def primary_key(name, type = :primary_key, options = {})
|
6
|
-
|
6
|
+
primary_key_without_unsigned(name, type, options.merge(primary_key: true).reverse_merge(unsigned: true))
|
7
7
|
end
|
8
8
|
end
|
data/lib/ridgepole/version.rb
CHANGED
data/ridgepole.gemspec
CHANGED
@@ -28,5 +28,5 @@ Gem::Specification.new do |spec|
|
|
28
28
|
spec.add_development_dependency 'foreigner', '<= 1.7.1'
|
29
29
|
spec.add_development_dependency 'activerecord-mysql-pkdump', '>= 0.1.0'
|
30
30
|
spec.add_development_dependency 'migration_comments'
|
31
|
-
spec.add_development_dependency 'activerecord-mysql-awesome'
|
31
|
+
spec.add_development_dependency 'activerecord-mysql-awesome', '>= 0.0.3'
|
32
32
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
if mysql_awesome_enabled?
|
2
2
|
describe 'Ridgepole::Client (with bigint pk)' do
|
3
|
-
let(:
|
3
|
+
let(:dsl1) {
|
4
4
|
<<-RUBY
|
5
5
|
create_table "books", id: :primary_key, limit: 8, force: true do |t|
|
6
6
|
t.string "title", null: false
|
@@ -11,13 +11,36 @@ if mysql_awesome_enabled?
|
|
11
11
|
RUBY
|
12
12
|
}
|
13
13
|
|
14
|
-
|
14
|
+
let(:dsl2) {
|
15
|
+
<<-RUBY
|
16
|
+
create_table "books", id: :bigint, force: true do |t|
|
17
|
+
t.string "title", null: false
|
18
|
+
t.integer "author_id", null: false
|
19
|
+
t.datetime "created_at"
|
20
|
+
t.datetime "updated_at"
|
21
|
+
end
|
22
|
+
RUBY
|
23
|
+
}
|
24
|
+
|
25
|
+
context 'when with limit:8' do
|
26
|
+
subject { client }
|
27
|
+
|
28
|
+
before { subject.diff(dsl1).migrate }
|
29
|
+
|
30
|
+
it {
|
31
|
+
expect(show_create_table(:books)).to include '`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT'
|
32
|
+
expect(subject.dump).to eq dsl2.strip_heredoc.strip
|
33
|
+
}
|
34
|
+
end
|
35
|
+
|
36
|
+
context 'when with id:bigint' do
|
15
37
|
subject { client }
|
16
38
|
|
17
|
-
before { subject.diff(
|
39
|
+
before { subject.diff(dsl2).migrate }
|
18
40
|
|
19
41
|
it {
|
20
42
|
expect(show_create_table(:books)).to include '`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT'
|
43
|
+
expect(subject.dump).to eq dsl2.strip_heredoc.strip
|
21
44
|
}
|
22
45
|
end
|
23
46
|
end
|
@@ -24,7 +24,7 @@ describe 'Ridgepole::Client.dump' do
|
|
24
24
|
|
25
25
|
add_index "clubs", ["name"], name: "idx_name", unique: true, using: :btree
|
26
26
|
|
27
|
-
create_table "departments", primary_key: "dept_no", force: true do |t|
|
27
|
+
create_table "departments", primary_key: "dept_no",#{mysql_awesome_enabled? ? ' id: :string, limit: 4,' : ''} force: true do |t|
|
28
28
|
t.string "dept_name", limit: 40, null: false
|
29
29
|
end
|
30
30
|
|
@@ -57,7 +57,7 @@ describe 'Ridgepole::Client.dump' do
|
|
57
57
|
|
58
58
|
add_index "employee_clubs", ["emp_no", "club_id"], name: "idx_emp_no_club_id", using: :btree
|
59
59
|
|
60
|
-
create_table "employees", primary_key: "emp_no", force: true do |t|
|
60
|
+
create_table "employees", primary_key: "emp_no",#{mysql_awesome_enabled? ? ' id: :integer,' : ''} force: true do |t|
|
61
61
|
t.date "birth_date", null: false
|
62
62
|
t.string "first_name", limit: 14, null: false
|
63
63
|
t.string "last_name", limit: 16, null: false
|
@@ -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", force: true do |t|
|
8
|
+
create_table "employees", primary_key: "emp_no",#{mysql_awesome_enabled? ? ' id: :integer,' : ''} force: true 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
|
@@ -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", force: true do |t|
|
43
|
+
create_table "employees", primary_key: "emp_no",#{mysql_awesome_enabled? ? ' id: :integer,' : ''} force: true 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
|
data/spec/dump/dump_spec.rb
CHANGED
@@ -11,7 +11,7 @@ describe 'Ridgepole::Client#dump' do
|
|
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",#{mysql_awesome_enabled? ? ' id: :string, limit: 4,' : ''} force: true do |t|
|
15
15
|
t.string "dept_name", limit: 40, null: false
|
16
16
|
end
|
17
17
|
|
@@ -44,7 +44,7 @@ describe 'Ridgepole::Client#dump' do
|
|
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", force: true do |t|
|
47
|
+
create_table "employees", primary_key: "emp_no",#{mysql_awesome_enabled? ? ' id: :integer,' : ''} force: true 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
|
@@ -8,7 +8,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
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",#{mysql_awesome_enabled? ? ' id: :string, limit: 4,' : ''} force: true do |t|
|
12
12
|
t.string "dept_name", limit: 40, null: false
|
13
13
|
end
|
14
14
|
|
@@ -41,7 +41,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
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",#{mysql_awesome_enabled? ? ' id: :integer,' : ''} force: true 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
|
data/spec/~pkdump/pkdump_spec.rb
CHANGED
@@ -1,65 +1,67 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
1
|
+
unless mysql_awesome_enabled?
|
2
|
+
describe 'Ridgepole::Client (with pkdump)' do
|
3
|
+
let(:dsl) {
|
4
|
+
<<-RUBY
|
5
|
+
create_table "authors", id: "bigint(20) PRIMARY KEY auto_increment", force: true do |t|
|
6
|
+
t.string "name", null: false
|
7
|
+
t.datetime "created_at"
|
8
|
+
t.datetime "updated_at"
|
9
|
+
end
|
9
10
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
11
|
+
create_table "books", id: "bigint(20) PRIMARY KEY auto_increment", force: true do |t|
|
12
|
+
t.string "title", null: false
|
13
|
+
t.integer "author_id", null: false
|
14
|
+
t.datetime "created_at"
|
15
|
+
t.datetime "updated_at"
|
16
|
+
end
|
17
|
+
RUBY
|
18
|
+
}
|
18
19
|
|
19
|
-
|
20
|
-
|
20
|
+
context 'when dump with activerecord-mysql-pkdump' do
|
21
|
+
subject { client(enable_mysql_pkdump: true) }
|
21
22
|
|
22
|
-
|
23
|
+
before { subject.diff(dsl).migrate }
|
23
24
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
25
|
+
it {
|
26
|
+
expect(subject.dump).to eq dsl.strip_heredoc.strip
|
27
|
+
}
|
28
|
+
end
|
28
29
|
|
29
|
-
|
30
|
-
|
30
|
+
context 'when create with activerecord-mysql-pkdump' do
|
31
|
+
subject { client(enable_mysql_pkdump: true) }
|
31
32
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
33
|
+
it {
|
34
|
+
delta = subject.diff(dsl)
|
35
|
+
expect(delta.differ?).to be_truthy
|
36
|
+
expect(subject.dump.delete_empty_lines).to eq ''
|
37
|
+
delta.migrate
|
38
|
+
expect(subject.dump.delete_empty_lines).to eq dsl.strip_heredoc.strip.delete_empty_lines
|
39
|
+
}
|
40
|
+
end
|
40
41
|
|
41
|
-
|
42
|
-
|
42
|
+
context 'update create with activerecord-mysql-pkdump' do
|
43
|
+
subject { client(enable_mysql_pkdump: true) }
|
43
44
|
|
44
|
-
|
45
|
+
before { subject.diff(dsl).migrate }
|
45
46
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
47
|
+
let(:dsl2) {
|
48
|
+
<<-RUBY
|
49
|
+
create_table "books", id: "bigint(20) PRIMARY KEY auto_increment", force: true do |t|
|
50
|
+
t.string "title2", null: false
|
51
|
+
t.integer "author_id", null: false
|
52
|
+
t.datetime "created_at"
|
53
|
+
t.datetime "updated_at"
|
54
|
+
end
|
55
|
+
RUBY
|
56
|
+
}
|
56
57
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
58
|
+
it {
|
59
|
+
delta = subject.diff(dsl2)
|
60
|
+
expect(delta.differ?).to be_truthy
|
61
|
+
expect(subject.dump.delete_empty_lines).to eq dsl.strip_heredoc.strip.delete_empty_lines
|
62
|
+
delta.migrate
|
63
|
+
expect(subject.dump.delete_empty_lines).to eq dsl2.strip_heredoc.strip.delete_empty_lines
|
64
|
+
}
|
65
|
+
end
|
64
66
|
end
|
65
67
|
end
|
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.5.2.
|
4
|
+
version: 0.5.2.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-01-
|
11
|
+
date: 2015-01-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -156,14 +156,14 @@ dependencies:
|
|
156
156
|
requirements:
|
157
157
|
- - '>='
|
158
158
|
- !ruby/object:Gem::Version
|
159
|
-
version:
|
159
|
+
version: 0.0.3
|
160
160
|
type: :development
|
161
161
|
prerelease: false
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
163
163
|
requirements:
|
164
164
|
- - '>='
|
165
165
|
- !ruby/object:Gem::Version
|
166
|
-
version:
|
166
|
+
version: 0.0.3
|
167
167
|
description: Ridgepole is a tool to manage DB schema. It defines DB schema using Rails
|
168
168
|
DSL, and updates DB schema according to DSL.
|
169
169
|
email:
|