ridgepole 0.9.2 → 0.9.3

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
  SHA256:
3
- metadata.gz: a762662665b42c22bb32b659ae668644d13f41b41df82e69769c9c1a3a734f5f
4
- data.tar.gz: dae6ee8668accb92507a2b35874d59178d250ae8a0ede0eb7e802a17a4f19635
3
+ metadata.gz: 3453e48af2d76cbb35301fcc70d7177f0016c47f4279593b6adbf269190d0b01
4
+ data.tar.gz: e4e61ed5bbbfae92a0660244a4e021fc387d945ccd5e85971d20c1ff184dc79f
5
5
  SHA512:
6
- metadata.gz: 8ed8b55d0b0acfa7126d53f97ac76b228138369ec3b5c6351bdaf0806565d0cf8cc5c8ac2b0928f9329c07aba08edfff311e6340fec42e78e627eb228f72b6b3
7
- data.tar.gz: 4c46611a9eae8bfa9461087e12847a12a62539e132ac01ace71ac3a336a48fcb17437583c7f71af5a922f7839c31b76736be544c945b75ebedd4e2d52d753ca5
6
+ metadata.gz: aa213105207d7a0a73adae7254885966fb06b0e0cc22cec7e2e44f7bd2082f7a6b10b2e7d8b5c5822c57b333447cd8ebb591db691b95a541f1493adcf3d46153
7
+ data.tar.gz: 3e1a1c8bbcde1f7d313df1a151d5ca3096e1bba911a099cc4e8969b877941dd85061d2c3d18c17afff976c5119d3cc00f9c9966f9037af5365d8d5b0c87243c0
data/README.md CHANGED
@@ -139,6 +139,8 @@ It defines DB schema using [Rails DSL](http://guides.rubyonrails.org/migrations.
139
139
  * Support `t.foreign_key` ([pull#348](https://github.com/winebarrel/ridgepole/pull/348))
140
140
  * `>= 0.9.2`
141
141
  * Support `t.column index option` ([pull#353](https://github.com/winebarrel/ridgepole/pull/353))
142
+ * `>= 0.9.3`
143
+ * Fix `limit` option for `t.integer` ([pull#354](https://github.com/winebarrel/ridgepole/pull/453))
142
144
  </details>
143
145
 
144
146
  **Notice**
@@ -399,9 +399,13 @@ module Ridgepole
399
399
  if Ridgepole::ConnectionAdapters.mysql?
400
400
  opts[:unsigned] = false unless opts.key?(:unsigned)
401
401
 
402
- if (attrs[:type] == :integer) && (opts[:limit] == Ridgepole::DefaultsLimit.default_limit(:bigint, @options))
403
- attrs[:type] = :bigint
404
- opts.delete(:limit)
402
+ if attrs[:type] == :integer && opts[:limit]
403
+ min = Ridgepole::DefaultsLimit.default_limit(:integer, @options)
404
+ max = Ridgepole::DefaultsLimit.default_limit(:bigint, @options)
405
+ if min < opts[:limit] && opts[:limit] <= max
406
+ attrs[:type] = :bigint
407
+ opts.delete(:limit)
408
+ end
405
409
  end
406
410
 
407
411
  if opts[:size] && (attrs[:type] == :text || attrs[:type] == :blob || attrs[:type] == :binary)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ridgepole
4
- VERSION = '0.9.2'
4
+ VERSION = '0.9.3'
5
5
  end
@@ -5,7 +5,11 @@ describe 'Ridgepole::Client#diff -> migrate' do
5
5
  let(:dsl) do
6
6
  erbh(<<-ERB)
7
7
  create_table "salaries", id: false, force: :cascade do |t|
8
- t.integer "emp_no", limit: 8, null: false
8
+ t.integer "emp_no_int", limit: 4, null: false
9
+ t.integer "emp_no_bigint5", limit: 5, null: false
10
+ t.integer "emp_no_bigint6", limit: 6, null: false
11
+ t.integer "emp_no_bigint7", limit: 7, null: false
12
+ t.integer "emp_no_bigint8", limit: 8, null: false
9
13
  t.float "salary", <%= i cond('< 5.2.0.beta2', limit: 24) %>, null: false
10
14
  t.date "from_date", null: false
11
15
  t.date "to_date", null: false
@@ -17,7 +21,12 @@ describe 'Ridgepole::Client#diff -> migrate' do
17
21
  subject { client }
18
22
 
19
23
  it {
20
- expect(subject.dump).to match_ruby dsl.sub(/t.integer "emp_no", limit: 8/, 't.bigint "emp_no"')
24
+ expect(subject.dump).to match_ruby dsl
25
+ .sub(/t.integer "emp_no_int", limit: 4/, 't.integer "emp_no_int"')
26
+ .sub(/t.integer "emp_no_bigint5", limit: 5/, 't.bigint "emp_no_bigint5"')
27
+ .sub(/t.integer "emp_no_bigint6", limit: 6/, 't.bigint "emp_no_bigint6"')
28
+ .sub(/t.integer "emp_no_bigint7", limit: 7/, 't.bigint "emp_no_bigint7"')
29
+ .sub(/t.integer "emp_no_bigint8", limit: 8/, 't.bigint "emp_no_bigint8"')
21
30
  delta = subject.diff(dsl)
22
31
  expect(delta.differ?).to be_falsey
23
32
  }
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.9.2
4
+ version: 0.9.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Genki Sugawara
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-13 00:00:00.000000000 Z
11
+ date: 2021-04-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord