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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 56ee14dd171b5e6888ea56c015bbc37c65105ec6
4
- data.tar.gz: 39425456d6e6a931918122ef2791f55f17e03154
3
+ metadata.gz: ae69c3f7da066d33e2e54bb5f8b6fcbfc5d42d36
4
+ data.tar.gz: 354fed4e3f679ef14b5bd5d97523e58ee07d11bc
5
5
  SHA512:
6
- metadata.gz: be023093493f6c5ab36f58e13f7a7c4ea1482c7f9b3955d83a0727627297921cc5cf380e4f7252a16a34cb7ca409468665421cc13383c3bf55abaf5f2a1182fc
7
- data.tar.gz: ac0a15b7d6e76bccdcb07df562cb9e7f8e16d835761d80c3783c4def499da72e35b57f2d5d5b9dc449cd9b8203a309b63e1203b3f43a61839bc870d2be45fd6d
6
+ metadata.gz: 3cd38079ebe1d5d1a112f4737c26579aa0bbce185e4e2159db12c2faa825a2f6db677a1086c77bffa93dc8af874bf9786d9608c93c2907b05c5aec487cc19b61
7
+ data.tar.gz: 798ab1ed0a0dc0e8368781577713b57fd73eb3d5ecdc0a6594bf87c6937fbd14e586f1dd2f9eb52682cd0621a4f6ce1bcdcdfdbf8e1531fef8bd2b8ca4ca3f5d
@@ -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[:options])
106
- normalize_column_options!(to_attrs[:options])
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!(opts)
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)
@@ -1,3 +1,3 @@
1
1
  module Ridgepole
2
- VERSION = '0.4.5'
2
+ VERSION = '0.4.6'
3
3
  end
@@ -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.5
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-03 00:00:00.000000000 Z
11
+ date: 2014-09-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord