ridgepole 0.4.5 → 0.4.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ridgepole/diff.rb +15 -3
- data/lib/ridgepole/version.rb +1 -1
- data/spec/diff/diff_spec.rb +1 -1
- data/spec/migrate/migrate_change_column_spec.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ae69c3f7da066d33e2e54bb5f8b6fcbfc5d42d36
|
4
|
+
data.tar.gz: 354fed4e3f679ef14b5bd5d97523e58ee07d11bc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3cd38079ebe1d5d1a112f4737c26579aa0bbce185e4e2159db12c2faa825a2f6db677a1086c77bffa93dc8af874bf9786d9608c93c2907b05c5aec487cc19b61
|
7
|
+
data.tar.gz: 798ab1ed0a0dc0e8368781577713b57fd73eb3d5ecdc0a6594bf87c6937fbd14e586f1dd2f9eb52682cd0621a4f6ce1bcdcdfdbf8e1531fef8bd2b8ca4ca3f5d
|
data/lib/ridgepole/diff.rb
CHANGED
@@ -102,8 +102,8 @@ class Ridgepole::Diff
|
|
102
102
|
|
103
103
|
to.each do |column_name, to_attrs|
|
104
104
|
if (from_attrs = from.delete(column_name))
|
105
|
-
normalize_column_options!(from_attrs
|
106
|
-
normalize_column_options!(to_attrs
|
105
|
+
normalize_column_options!(from_attrs)
|
106
|
+
normalize_column_options!(to_attrs)
|
107
107
|
|
108
108
|
if from_attrs != to_attrs
|
109
109
|
definition_delta[:change] ||= {}
|
@@ -233,9 +233,21 @@ class Ridgepole::Diff
|
|
233
233
|
end
|
234
234
|
end
|
235
235
|
|
236
|
-
def normalize_column_options!(
|
236
|
+
def normalize_column_options!(attrs)
|
237
|
+
opts = attrs[:options]
|
237
238
|
opts[:null] = true unless opts.has_key?(:null)
|
238
239
|
|
240
|
+
# XXX: MySQL only?
|
241
|
+
case attrs[:type]
|
242
|
+
when :string
|
243
|
+
opts.delete(:limit) if opts[:limit] == 255
|
244
|
+
end
|
245
|
+
|
246
|
+
# XXX: MySQL only?
|
247
|
+
if not opts.has_key?(:default) and opts[:null]
|
248
|
+
opts[:default] = nil
|
249
|
+
end
|
250
|
+
|
239
251
|
# XXX: MySQL only?
|
240
252
|
unless @options[:disable_mysql_unsigned]
|
241
253
|
opts[:unsigned] = false unless opts.has_key?(:unsigned)
|
data/lib/ridgepole/version.rb
CHANGED
data/spec/diff/diff_spec.rb
CHANGED
@@ -144,7 +144,7 @@ describe 'Ridgepole::Client.diff' do
|
|
144
144
|
delta = subject.diff(actual_dsl, expected_dsl)
|
145
145
|
expect(delta.differ?).to be_truthy
|
146
146
|
expect(delta.script).to eq <<-RUBY.strip_heredoc.strip
|
147
|
-
change_column("employee_clubs", "club_id", :integer, {:unsigned=>false, :null=>true})
|
147
|
+
change_column("employee_clubs", "club_id", :integer, {:unsigned=>false, :null=>true, :default=>nil})
|
148
148
|
|
149
149
|
change_column("employees", "last_name", :string, {:limit=>20, :default=>"XXX", :null=>false, :unsigned=>false})
|
150
150
|
change_column("employees", "gender", :string, {:limit=>2, :null=>false, :unsigned=>false})
|
@@ -166,7 +166,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
166
166
|
expect(subject.dump).to eq actual_dsl.strip_heredoc.strip
|
167
167
|
expect(delta.script).to eq <<-RUBY.strip_heredoc.strip
|
168
168
|
change_table("employee_clubs", {:bulk => true}) do |t|
|
169
|
-
t.change("club_id", :integer, {:unsigned=>false, :null=>true})
|
169
|
+
t.change("club_id", :integer, {:unsigned=>false, :null=>true, :default=>nil})
|
170
170
|
end
|
171
171
|
|
172
172
|
change_table("employees", {:bulk => true}) do |t|
|
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.
|
4
|
+
version: 0.4.6
|
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-09-
|
11
|
+
date: 2014-09-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|