ridgepole 0.4.10 → 0.4.11.beta

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: f1d584003fbd27702c2fc29781c9860993134373
4
- data.tar.gz: 2c5aae588f9b18515955fc99434e8919d8b87af8
3
+ metadata.gz: 0cab00f8047a1d75ecb40ecca4288723e3899937
4
+ data.tar.gz: 5e596040dd4eef322f92478eb1685a5758e5cd01
5
5
  SHA512:
6
- metadata.gz: 94841e78eee16e09d990824b759d08bd9d130a81668da42fab85e05ff382fa71529e4b45f098d9d728d62a3b2733951427cb1371b6d4d28b2e019bad5aa4de86
7
- data.tar.gz: aced3591d88cfc8bfee2575c5d51bbf9a2fac2d6a57fd1e492f786a267358dcadd58f8e0e673a047a4103a4fd0839e89fd23872a868c24a410b465e1ed6ba685
6
+ metadata.gz: bfd48592704cced4b14eccbcadb2d9ebd5b79b55e569fb3c348e8369925f6eb137336140b54af7acb5403efb75fbda58e37a3bc9699d31f9c1f9ecb58f6e2da6
7
+ data.tar.gz: 06afedd97e0da203b6a74781c268c82f9bce2611d19e21a40f280e4691e0f8e62252bd8336d6cacb14ed43cf1b94764917cfcc0302c31de059e4983e2e575654
data/README.md CHANGED
@@ -14,6 +14,8 @@ It defines DB schema using [Rails DSL](http://guides.rubyonrails.org/migrations.
14
14
  * `>= 0.4.8`
15
15
  * `activerecord-mysql-unsigned` is now optional. Please pass `--enable-mysql-unsigned` after you install [activerecord-mysql-unsigned](https://github.com/waka/activerecord-mysql-unsigned) if you want to use.
16
16
  * Please pass `--enable-foreigner` after you install [foreigner](https://github.com/matthuhiggins/foreigner) if you want to use the foreign key.
17
+ * `>= 0.4.11`
18
+ * Add `--enable-mysql-pkdump` option.
17
19
 
18
20
  ## Installation
19
21
 
@@ -53,6 +55,7 @@ Usage: ridgepole [options]
53
55
  -t, --tables TABLES
54
56
  --ignore-tables TABLES
55
57
  --enable-mysql-unsigned
58
+ --enable-mysql-pkdump
56
59
  --enable-foreigner
57
60
  --log-file LOG_FILE
58
61
  --verbose
@@ -153,6 +156,17 @@ add_index "child", ["parent_id"], name: "par_ind", using: :btree
153
156
  add_foreign_key "child", "parent", name: "child_ibfk_1", dependent: :delete
154
157
  ```
155
158
 
159
+ ## bigint support
160
+ Export of `bigint` PK is enabled by passing `--enable-mysql-pkdump` ([activerecord-mysql-pkdump](https://github.com/winebarrel/activerecord-mysql-pkdump) is required)
161
+
162
+ ```ruby
163
+ create_table "books", id: "bigint(20) PRIMARY KEY auto_increment", force: true do |t|
164
+ t.string "title", null: false
165
+ t.integer "author_id", null: false
166
+ t.datetime "created_at"
167
+ t.datetime "updated_at"
168
+ end
169
+ ```
156
170
 
157
171
  ## Execute
158
172
  ```ruby
data/bin/ridgepole CHANGED
@@ -92,6 +92,7 @@ ARGV.options do |opt|
92
92
  opt.on('-t', '--tables TABLES', Array) {|v| options[:tables] = v }
93
93
  opt.on('', '--ignore-tables TABLES', Array) {|v| options[:ignore_tables] = v.map {|i| Regexp.new(i) } }
94
94
  opt.on('', '--enable-mysql-unsigned') { options[:enable_mysql_unsigned] = true }
95
+ opt.on('', '--enable-mysql-pkdump') { options[:enable_mysql_pkdump] = true }
95
96
  opt.on('', '--enable-foreigner') { options[:enable_foreigner] = true }
96
97
  opt.on('' , '--log-file LOG_FILE') {|v| options[:log_file] = v }
97
98
  opt.on('' , '--verbose') { Ridgepole::Logger.verbose = true }
@@ -11,6 +11,10 @@ class Ridgepole::Client
11
11
  require 'activerecord-mysql-unsigned/base'
12
12
  end
13
13
 
14
+ if @options[:enable_mysql_pkdump]
15
+ require 'activerecord-mysql-pkdump'
16
+ end
17
+
14
18
  if @options[:enable_foreigner]
15
19
  Ridgepole::ForeignKey.init
16
20
  end
@@ -1,3 +1,3 @@
1
1
  module Ridgepole
2
- VERSION = '0.4.10'
2
+ VERSION = '0.4.11.beta'
3
3
  end
data/ridgepole.gemspec CHANGED
@@ -26,4 +26,5 @@ Gem::Specification.new do |spec|
26
26
  spec.add_development_dependency 'coveralls'
27
27
  spec.add_development_dependency 'activerecord-mysql-unsigned', '>= 0.2.0'
28
28
  spec.add_development_dependency 'foreigner'
29
+ spec.add_development_dependency 'activerecord-mysql-pkdump', '>= 0.1.0'
29
30
  end
@@ -30,6 +30,7 @@ describe 'ridgepole' do
30
30
  -t, --tables TABLES
31
31
  --ignore-tables TABLES
32
32
  --enable-mysql-unsigned
33
+ --enable-mysql-pkdump
33
34
  --enable-foreigner
34
35
  --log-file LOG_FILE
35
36
  --verbose
@@ -0,0 +1,65 @@
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
9
+
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
+ }
18
+
19
+ context 'when dump with activerecord-mysql-pkdump' do
20
+ subject { client(enable_mysql_pkdump: true) }
21
+
22
+ before { subject.diff(dsl).migrate }
23
+
24
+ it {
25
+ expect(subject.dump).to eq dsl.strip_heredoc.strip
26
+ }
27
+ end
28
+
29
+ context 'when create with activerecord-mysql-pkdump' do
30
+ subject { client(enable_foreigner: true) }
31
+
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
40
+
41
+ context 'update create with activerecord-mysql-pkdump' do
42
+ subject { client(enable_foreigner: true) }
43
+
44
+ before { subject.diff(dsl).migrate }
45
+
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
+ }
56
+
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
+ }
64
+ end
65
+ 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.4.10
4
+ version: 0.4.11.beta
5
5
  platform: ruby
6
6
  authors:
7
7
  - Genki Sugawara
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-16 00:00:00.000000000 Z
11
+ date: 2014-11-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -122,6 +122,20 @@ dependencies:
122
122
  - - '>='
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: activerecord-mysql-pkdump
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - '>='
130
+ - !ruby/object:Gem::Version
131
+ version: 0.1.0
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - '>='
137
+ - !ruby/object:Gem::Version
138
+ version: 0.1.0
125
139
  description: Ridgepole is a tool to manage DB schema. It defines DB schema using Rails
126
140
  DSL, and updates DB schema according to DSL.
127
141
  email:
@@ -203,6 +217,7 @@ files:
203
217
  - spec/ridgepole_test_tables.sql
204
218
  - spec/spec_helper.rb
205
219
  - spec/string_ext.rb
220
+ - spec/~pkdump/pkdump_spec.rb
206
221
  homepage: https://github.com/winebarrel/ridgepole
207
222
  licenses:
208
223
  - MIT
@@ -218,9 +233,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
218
233
  version: '0'
219
234
  required_rubygems_version: !ruby/object:Gem::Requirement
220
235
  requirements:
221
- - - '>='
236
+ - - '>'
222
237
  - !ruby/object:Gem::Version
223
- version: '0'
238
+ version: 1.3.1
224
239
  requirements: []
225
240
  rubyforge_project:
226
241
  rubygems_version: 2.0.14
@@ -278,3 +293,4 @@ test_files:
278
293
  - spec/ridgepole_test_tables.sql
279
294
  - spec/spec_helper.rb
280
295
  - spec/string_ext.rb
296
+ - spec/~pkdump/pkdump_spec.rb