ridgepole 0.7.0.beta10 → 0.7.0.beta11

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: 43d1094d18230aec0edeb8cfc3ba63783b074e54
4
- data.tar.gz: 3dcc6e2ead2ecd1eae6f5abd09865f272ee0ac6c
3
+ metadata.gz: ecc5673186f25067b337cfc75180d44b82bba7ce
4
+ data.tar.gz: 1601ea4b2ab780f97048bdc82b1896cffa3395fe
5
5
  SHA512:
6
- metadata.gz: '08568bf10b61386b12462595b19c6a9ee527423f7a72224978a202dd6f5a6b0c953d69669c5f3821318b72834b669f2165fa84b081657434af4ccb63224a7958'
7
- data.tar.gz: fdd40f8896581ddfb80e1f5921329c8a3bdc6eb202c60cf345e1df72eb2c842b1ae3c071d111ec3e8dc003c5d16ce723e15c99e48b18acae028818f72f390310
6
+ metadata.gz: ba82871050164aca91fbcc7346a1d892bbc02de322f850ff70c6dd5ab41366b6a6bb1ffa609c7ad74f30be35ba839ccb0720d95bf2551721070d9a57e1514b37
7
+ data.tar.gz: a7e2278fd069aa686a2a9a652234d3ae069e23a4b46b822272b1310bcfadc4560f99e8e35984fb0e5aebd32bd35555f1d7fe916deeb913ce4d6d6da5ca3d45e8
data/README.md CHANGED
@@ -9,7 +9,7 @@ It defines DB schema using [Rails DSL](http://guides.rubyonrails.org/migrations.
9
9
  [![Build Status](https://travis-ci.org/winebarrel/ridgepole.svg?branch=0.6)](https://travis-ci.org/winebarrel/ridgepole)
10
10
  [![Coverage Status](https://coveralls.io/repos/github/winebarrel/ridgepole/badge.svg?branch=0.6)](https://coveralls.io/github/winebarrel/ridgepole?branch=0.6)
11
11
 
12
- [![Edge Version](https://img.shields.io/badge/edge_version-0.7.0.beta10-brightgreen.svg)](https://rubygems.org/gems/ridgepole/versions/0.7.0.beta10)
12
+ [![Edge Version](https://img.shields.io/badge/edge_version-0.7.0.beta11-brightgreen.svg)](https://rubygems.org/gems/ridgepole/versions/0.7.0.beta11)
13
13
  [![Build Status](https://travis-ci.org/winebarrel/ridgepole.svg?branch=0.7)](https://travis-ci.org/winebarrel/ridgepole)
14
14
  [![Coverage Status](https://coveralls.io/repos/github/winebarrel/ridgepole/badge.svg?branch=0.7)](https://coveralls.io/github/winebarrel/ridgepole?branch=0.7)
15
15
 
@@ -77,6 +77,7 @@ It defines DB schema using [Rails DSL](http://guides.rubyonrails.org/migrations.
77
77
  * Fix change fk order
78
78
  * Add `--check-relation-type` option
79
79
  * Add `--skip-column-comment-change` option
80
+ * Add `--default-bigint-limit` option
80
81
 
81
82
  ## Installation
82
83
 
@@ -107,6 +108,7 @@ Usage: ridgepole [options]
107
108
  --bulk-change
108
109
  --default-bool-limit LIMIT
109
110
  --default-int-limit LIMIT
111
+ --default-bigint-limit LIMIT
110
112
  --default-float-limit LIMIT
111
113
  --default-string-limit LIMIT
112
114
  --default-text-limit LIMIT
data/bin/ridgepole CHANGED
@@ -21,6 +21,7 @@ EOS
21
21
  COLUMN_TYPES = {
22
22
  :boolean => :bool,
23
23
  :integer => :int,
24
+ :bigint => :bigint,
24
25
  :float => :float,
25
26
  :string => :string,
26
27
  :text => :text,
@@ -3,6 +3,7 @@ class Ridgepole::DefaultsLimit
3
3
  :mysql2 => {
4
4
  :boolean => 1,
5
5
  :integer => 4,
6
+ :bigint => 8,
6
7
  :float => 24,
7
8
  :string => 255,
8
9
  :text => 65535,
@@ -1,3 +1,3 @@
1
1
  module Ridgepole
2
- VERSION = '0.7.0.beta10'
2
+ VERSION = '0.7.0.beta11'
3
3
  end
@@ -25,6 +25,7 @@ describe 'ridgepole' do
25
25
  --bulk-change
26
26
  --default-bool-limit LIMIT
27
27
  --default-int-limit LIMIT
28
+ --default-bigint-limit LIMIT
28
29
  --default-float-limit LIMIT
29
30
  --default-string-limit LIMIT
30
31
  --default-text-limit LIMIT
@@ -53,7 +53,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
53
53
  let(:expected_dsl) {
54
54
  <<-EOS
55
55
  create_table "dept_emp", id: false, force: :cascade do |t|
56
- t.integer "emp_no", limit: 4, null: false
56
+ t.integer "emp_no", limit: 3, null: false
57
57
  t.integer "emp_no2", null: false
58
58
  t.string "dept_no", limit: 4, null: false
59
59
  t.date "from_date", null: false
@@ -63,17 +63,17 @@ describe 'Ridgepole::Client#diff -> migrate' do
63
63
  }
64
64
 
65
65
  before { subject.diff(actual_dsl).migrate }
66
- subject { client(:default_int_limit => 11) }
66
+ subject { client(:default_integer_limit => 3) }
67
67
 
68
68
  it {
69
69
  delta = subject.diff(expected_dsl)
70
70
  expect(delta.differ?).to be_truthy
71
- expect(subject.dump).to match_fuzzy actual_dsl
71
+ expect(subject.dump).to match_fuzzy actual_dsl.sub(/"emp_no"/, '"emp_no", limit: 3')
72
72
  migrated, sql = delta.migrate(:noop => true)
73
73
  expect(migrated).to be_truthy
74
- expect(subject.dump).to match_fuzzy actual_dsl
74
+ expect(subject.dump).to match_fuzzy actual_dsl.sub(/"emp_no"/, '"emp_no", limit: 3')
75
75
 
76
- expect(sql).to match_fuzzy erbh("ALTER TABLE `dept_emp` ADD `emp_no2` int NOT NULL AFTER `emp_no`")
76
+ expect(sql).to match_fuzzy erbh("ALTER TABLE `dept_emp` ADD `emp_no2` mediumint NOT NULL AFTER `emp_no`")
77
77
  }
78
78
  end
79
79
 
@@ -92,7 +92,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
92
92
  let(:expected_dsl) {
93
93
  <<-EOS
94
94
  create_table "dept_emp", id: false, force: :cascade do |t|
95
- t.integer "emp_no", limit: 4, null: false
95
+ t.integer "emp_no", limit: 3, null: false
96
96
  t.integer "emp_no2", limit: 4, null: false
97
97
  t.string "dept_no", limit: 4, null: false
98
98
  t.date "from_date", null: false
@@ -102,7 +102,46 @@ describe 'Ridgepole::Client#diff -> migrate' do
102
102
  }
103
103
 
104
104
  before { subject.diff(actual_dsl).migrate }
105
- subject { client(:default_int_limit => 11) }
105
+ subject { client(:default_integer_limit => 3) }
106
+
107
+ it {
108
+ delta = subject.diff(expected_dsl)
109
+ expect(delta.differ?).to be_truthy
110
+ expect(subject.dump).to match_fuzzy actual_dsl.sub(/"emp_no"/, '"emp_no", limit: 3')
111
+ migrated, sql = delta.migrate(:noop => true)
112
+ expect(migrated).to be_truthy
113
+ expect(subject.dump).to match_fuzzy actual_dsl.sub(/"emp_no"/, '"emp_no", limit: 3')
114
+
115
+ expect(sql).to match_fuzzy erbh("ALTER TABLE `dept_emp` ADD `emp_no2` int NOT NULL AFTER `emp_no`")
116
+ }
117
+ end
118
+
119
+ context 'when add column (bigint/noop)' do
120
+ let(:actual_dsl) {
121
+ erbh(<<-EOS)
122
+ create_table "dept_emp", id: false, force: :cascade do |t|
123
+ t.bigint "emp_no", null: false
124
+ t.string "dept_no", limit: 4, null: false
125
+ t.date "from_date", null: false
126
+ t.date "to_date", null: false
127
+ end
128
+ EOS
129
+ }
130
+
131
+ let(:expected_dsl) {
132
+ <<-EOS
133
+ create_table "dept_emp", id: false, force: :cascade do |t|
134
+ t.bigint "emp_no", limit: 9, null: false
135
+ t.integer "emp_no2", null: false
136
+ t.string "dept_no", limit: 4, null: false
137
+ t.date "from_date", null: false
138
+ t.date "to_date", null: false
139
+ end
140
+ EOS
141
+ }
142
+
143
+ before { subject.diff(actual_dsl).migrate }
144
+ subject { client(:default_bigint_limit => 9) }
106
145
 
107
146
  it {
108
147
  delta = subject.diff(expected_dsl)
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.7.0.beta10
4
+ version: 0.7.0.beta11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Genki Sugawara
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-28 00:00:00.000000000 Z
11
+ date: 2017-06-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord