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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e907b4bef3d7a181ac9c118a7b75c225188127b8
4
- data.tar.gz: c658118bb1bf200595fe5267dc30d56c55e3bf24
3
+ metadata.gz: de9a514d07eefef782978b4596ba99e7f6e2b34a
4
+ data.tar.gz: 11d93af89a4e11c2bbcef22288526ed5a33d8b71
5
5
  SHA512:
6
- metadata.gz: bb3798aed413b710d9a2161dd81c896a299f67fe302d87f8470f508961d453907e3f4424e0a4cdbd2039f482754ebeaaa22badf304513b84761f15f05a97d432
7
- data.tar.gz: 4d1e8c3717861db095e2dec9d925d17039a5df09a0a053252ab716c84c2595786d269f92c4aa5170aadcf4219fdf35c2f8b41b54a48e48c380e0781817889e22
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
- endend
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
- column(name, type, options.merge(primary_key: true).reverse_merge(unsigned: true))
6
+ primary_key_without_unsigned(name, type, options.merge(primary_key: true).reverse_merge(unsigned: true))
7
7
  end
8
8
  end
@@ -1,3 +1,3 @@
1
1
  module Ridgepole
2
- VERSION = '0.5.2.beta4'
2
+ VERSION = '0.5.2.beta5'
3
3
  end
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(:dsl) {
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
- context 'when dump with activerecord-mysql-pkdump' do
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(dsl).migrate }
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
@@ -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
@@ -1,65 +1,67 @@
1
- describe 'Ridgepole::Client (with pkdump)' do
2
- let(:dsl) {
3
- <<-RUBY
4
- create_table "authors", id: "bigint(20) PRIMARY KEY auto_increment", force: true do |t|
5
- t.string "name", null: false
6
- t.datetime "created_at"
7
- t.datetime "updated_at"
8
- end
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
- create_table "books", id: "bigint(20) PRIMARY KEY auto_increment", force: true do |t|
11
- t.string "title", null: false
12
- t.integer "author_id", null: false
13
- t.datetime "created_at"
14
- t.datetime "updated_at"
15
- end
16
- RUBY
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
- context 'when dump with activerecord-mysql-pkdump' do
20
- subject { client(enable_mysql_pkdump: true) }
20
+ context 'when dump with activerecord-mysql-pkdump' do
21
+ subject { client(enable_mysql_pkdump: true) }
21
22
 
22
- before { subject.diff(dsl).migrate }
23
+ before { subject.diff(dsl).migrate }
23
24
 
24
- it {
25
- expect(subject.dump).to eq dsl.strip_heredoc.strip
26
- }
27
- end
25
+ it {
26
+ expect(subject.dump).to eq dsl.strip_heredoc.strip
27
+ }
28
+ end
28
29
 
29
- context 'when create with activerecord-mysql-pkdump' do
30
- subject { client(enable_mysql_pkdump: true) }
30
+ context 'when create with activerecord-mysql-pkdump' do
31
+ subject { client(enable_mysql_pkdump: true) }
31
32
 
32
- it {
33
- delta = subject.diff(dsl)
34
- expect(delta.differ?).to be_truthy
35
- expect(subject.dump.delete_empty_lines).to eq ''
36
- delta.migrate
37
- expect(subject.dump.delete_empty_lines).to eq dsl.strip_heredoc.strip.delete_empty_lines
38
- }
39
- end
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
- context 'update create with activerecord-mysql-pkdump' do
42
- subject { client(enable_mysql_pkdump: true) }
42
+ context 'update create with activerecord-mysql-pkdump' do
43
+ subject { client(enable_mysql_pkdump: true) }
43
44
 
44
- before { subject.diff(dsl).migrate }
45
+ before { subject.diff(dsl).migrate }
45
46
 
46
- let(:dsl2) {
47
- <<-RUBY
48
- create_table "books", id: "bigint(20) PRIMARY KEY auto_increment", force: true do |t|
49
- t.string "title2", null: false
50
- t.integer "author_id", null: false
51
- t.datetime "created_at"
52
- t.datetime "updated_at"
53
- end
54
- RUBY
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
- it {
58
- delta = subject.diff(dsl2)
59
- expect(delta.differ?).to be_truthy
60
- expect(subject.dump.delete_empty_lines).to eq dsl.strip_heredoc.strip.delete_empty_lines
61
- delta.migrate
62
- expect(subject.dump.delete_empty_lines).to eq dsl2.strip_heredoc.strip.delete_empty_lines
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.beta4
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-12 00:00:00.000000000 Z
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: '0'
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: '0'
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: