ridgepole 0.8.12 → 0.8.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/lib/ridgepole/default_limit.rb +1 -1
- data/lib/ridgepole/dsl_parser/table_definition.rb +44 -41
- data/lib/ridgepole/version.rb +1 -1
- data/ridgepole.gemspec +3 -1
- data/spec/postgresql/migrate/migrate_add_column_spec.rb +11 -4
- data/spec/postgresql/migrate/migrate_change_column_spec.rb +4 -0
- data/spec/postgresql/migrate/migrate_drop_column_spec.rb +11 -4
- metadata +32 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4c68b630030e34fb6e399e053d7d5c43245487c81d0869f9783b05e1135b5e2e
|
4
|
+
data.tar.gz: b7061e1c9c0bdf8e7509ab3601e397031edd2d9397975b178bac12ddb669c413
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8bbfcabaad944ad5ed18c5b809e06243582c9f3977890e499c2b400af7f268206876174d0cd3b6184e67b33ef67d5bd6226b63c88c13d820c9ed4fab5f5bdbdc
|
7
|
+
data.tar.gz: 7ed62d44a593d40b8c3d8b91b6d0ea7c10ae99337789db4ffbdffc9bf43cfb6b2e2fc81959cca1e823a9adf40968717d264f965aa4edb4e591bed55cff3c7c9d
|
data/README.md
CHANGED
@@ -127,6 +127,8 @@ It defines DB schema using [Rails DSL](http://guides.rubyonrails.org/migrations.
|
|
127
127
|
* Support t.reference() foreign_key option ([pull#316](https://github.com/winebarrel/ridgepole/pull/316))
|
128
128
|
* `>= 0.8.12`
|
129
129
|
* Pluralize column specified by `references` ([pull#317](https://github.com/winebarrel/ridgepole/pull/317))
|
130
|
+
* `>= 0.8.13`
|
131
|
+
* Support `serial` and `bigserial` column types ([pull#321](https://github.com/winebarrel/ridgepole/pull/321))
|
130
132
|
</details>
|
131
133
|
|
132
134
|
## Installation
|
@@ -22,57 +22,60 @@ module Ridgepole
|
|
22
22
|
|
23
23
|
DEFAULT_PRIMARY_KEY_TYPE = Gem::Version.new(ActiveRecord::VERSION::STRING) >= Gem::Version.new('5.1') ? :bigint : :integer
|
24
24
|
|
25
|
-
TYPES =
|
25
|
+
TYPES = {
|
26
26
|
# https://github.com/rails/rails/blob/v4.2.1/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb#L274
|
27
|
-
:
|
28
|
-
:
|
29
|
-
:
|
30
|
-
:
|
31
|
-
:
|
32
|
-
:
|
33
|
-
:
|
34
|
-
:
|
35
|
-
:
|
36
|
-
:
|
37
|
-
:
|
38
|
-
:
|
27
|
+
string: {},
|
28
|
+
text: {},
|
29
|
+
integer: {},
|
30
|
+
bigint: {},
|
31
|
+
float: {},
|
32
|
+
decimal: {},
|
33
|
+
datetime: {},
|
34
|
+
timestamp: {},
|
35
|
+
time: {},
|
36
|
+
date: {},
|
37
|
+
binary: {},
|
38
|
+
boolean: {},
|
39
39
|
|
40
40
|
# https://github.com/rails/rails/blob/v4.2.1/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb#L79
|
41
|
-
:
|
42
|
-
:
|
43
|
-
:
|
44
|
-
:
|
45
|
-
:
|
46
|
-
:
|
47
|
-
:
|
48
|
-
:
|
49
|
-
:
|
50
|
-
:
|
51
|
-
:
|
52
|
-
:
|
53
|
-
:
|
54
|
-
:
|
55
|
-
:
|
56
|
-
:
|
57
|
-
:
|
58
|
-
:
|
59
|
-
:
|
60
|
-
:
|
61
|
-
:
|
62
|
-
:
|
63
|
-
:
|
64
|
-
:
|
41
|
+
serial: { null: false },
|
42
|
+
bigserial: { null: false },
|
43
|
+
daterange: {},
|
44
|
+
numrange: {},
|
45
|
+
tsrange: {},
|
46
|
+
tstzrange: {},
|
47
|
+
int4range: {},
|
48
|
+
int8range: {},
|
49
|
+
# binary: {}, # dup key
|
50
|
+
# boolean: {}, # dup key
|
51
|
+
# bigint: {}, # dup key
|
52
|
+
xml: {},
|
53
|
+
tsvector: {},
|
54
|
+
hstore: {},
|
55
|
+
inet: {},
|
56
|
+
cidr: {},
|
57
|
+
macaddr: {},
|
58
|
+
uuid: {},
|
59
|
+
json: {},
|
60
|
+
jsonb: {},
|
61
|
+
ltree: {},
|
62
|
+
citext: {},
|
63
|
+
point: {},
|
64
|
+
bit: {},
|
65
|
+
bit_varying: {},
|
66
|
+
money: {},
|
65
67
|
|
66
68
|
# https://github.com/rails/rails/blob/v5.1.1/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb#L184
|
67
|
-
:
|
69
|
+
virtual: {},
|
68
70
|
|
69
71
|
# https://github.com/rails/rails/blob/v5.0.4/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb#L53
|
70
|
-
:
|
71
|
-
|
72
|
+
# json: {}, # dup key
|
73
|
+
}.freeze
|
72
74
|
|
73
|
-
TYPES.each do |column_type|
|
75
|
+
TYPES.each do |column_type, default_options|
|
74
76
|
define_method column_type do |*args|
|
75
77
|
options = args.extract_options!
|
78
|
+
options = default_options.merge(options)
|
76
79
|
column_names = args
|
77
80
|
column_names.each { |name| column(name, column_type, options) }
|
78
81
|
end
|
data/lib/ridgepole/version.rb
CHANGED
data/ridgepole.gemspec
CHANGED
@@ -36,5 +36,7 @@ Gem::Specification.new do |spec|
|
|
36
36
|
spec.add_development_dependency 'rspec', '>= 3.0.0'
|
37
37
|
spec.add_development_dependency 'rspec-match_fuzzy', '>= 0.1.3'
|
38
38
|
spec.add_development_dependency 'rspec-match_ruby', '>= 0.1.3'
|
39
|
-
spec.add_development_dependency 'rubocop', '>=
|
39
|
+
spec.add_development_dependency 'rubocop', '>= 1.7.0'
|
40
|
+
spec.add_development_dependency 'rubocop-rake', '>= 0.5.1'
|
41
|
+
spec.add_development_dependency 'rubocop-rspec', '>= 2.1.0'
|
40
42
|
end
|
@@ -116,10 +116,12 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
116
116
|
end
|
117
117
|
|
118
118
|
create_table "titles", id: false, force: :cascade do |t|
|
119
|
-
t.integer
|
120
|
-
t.string
|
121
|
-
t.date
|
122
|
-
t.date
|
119
|
+
t.integer "emp_no", null: false
|
120
|
+
t.string "title", limit: 50, null: false
|
121
|
+
t.date "from_date", null: false
|
122
|
+
t.date "to_date"
|
123
|
+
t.serial "title_no", null: false
|
124
|
+
t.bigserial "title_bigno", null: false
|
123
125
|
t.index ["emp_no"], name: "idx_titles_emp_no", <%= i cond(5.0, using: :btree) %>
|
124
126
|
end
|
125
127
|
ERB
|
@@ -149,6 +151,11 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
149
151
|
t.column("age", :integer, **{:null=>false})
|
150
152
|
t.column("updated_at", :date, **{})
|
151
153
|
end
|
154
|
+
|
155
|
+
change_table("titles", bulk: true) do |t|
|
156
|
+
t.column("title_no", :serial, **{:null=>false})
|
157
|
+
t.column("title_bigno", :bigserial, **{:null=>false})
|
158
|
+
end
|
152
159
|
RUBY
|
153
160
|
delta.migrate
|
154
161
|
expect(subject.dump).to match_ruby expected_dsl
|
@@ -157,6 +157,8 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
157
157
|
create_table "clubs", force: :cascade do |t|
|
158
158
|
t.string "name", default: "", null: false
|
159
159
|
t.text "desc"
|
160
|
+
t.serial "club_no"
|
161
|
+
t.bigserial "club_bigno"
|
160
162
|
end
|
161
163
|
ERB
|
162
164
|
end
|
@@ -166,6 +168,8 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
166
168
|
create_table "clubs", force: :cascade do |t|
|
167
169
|
t.string "name", default: "", null: false
|
168
170
|
t.text "desc"
|
171
|
+
t.serial "club_no"
|
172
|
+
t.bigserial "club_bigno"
|
169
173
|
end
|
170
174
|
ERB
|
171
175
|
end
|
@@ -54,10 +54,12 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
54
54
|
end
|
55
55
|
|
56
56
|
create_table "titles", id: false, force: :cascade do |t|
|
57
|
-
t.integer
|
58
|
-
t.string
|
59
|
-
t.date
|
60
|
-
t.date
|
57
|
+
t.integer "emp_no", null: false
|
58
|
+
t.string "title", limit: 50, null: false
|
59
|
+
t.date "from_date", null: false
|
60
|
+
t.date "to_date"
|
61
|
+
t.serial "title_no", null: false
|
62
|
+
t.bigserial "title_bigno", null: false
|
61
63
|
t.index ["emp_no"], name: "idx_titles_emp_no", <%= i cond(5.0, using: :btree) %>
|
62
64
|
end
|
63
65
|
ERB
|
@@ -148,6 +150,11 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
148
150
|
t.remove("last_name")
|
149
151
|
t.remove("hire_date")
|
150
152
|
end
|
153
|
+
|
154
|
+
change_table("titles", bulk: true) do |t|
|
155
|
+
t.remove("title_no")
|
156
|
+
t.remove("title_bigno")
|
157
|
+
end
|
151
158
|
RUBY
|
152
159
|
delta.migrate
|
153
160
|
expect(subject.dump).to match_ruby 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.8.
|
4
|
+
version: 0.8.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Genki Sugawara
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -218,14 +218,42 @@ dependencies:
|
|
218
218
|
requirements:
|
219
219
|
- - ">="
|
220
220
|
- !ruby/object:Gem::Version
|
221
|
-
version:
|
221
|
+
version: 1.7.0
|
222
222
|
type: :development
|
223
223
|
prerelease: false
|
224
224
|
version_requirements: !ruby/object:Gem::Requirement
|
225
225
|
requirements:
|
226
226
|
- - ">="
|
227
227
|
- !ruby/object:Gem::Version
|
228
|
-
version:
|
228
|
+
version: 1.7.0
|
229
|
+
- !ruby/object:Gem::Dependency
|
230
|
+
name: rubocop-rake
|
231
|
+
requirement: !ruby/object:Gem::Requirement
|
232
|
+
requirements:
|
233
|
+
- - ">="
|
234
|
+
- !ruby/object:Gem::Version
|
235
|
+
version: 0.5.1
|
236
|
+
type: :development
|
237
|
+
prerelease: false
|
238
|
+
version_requirements: !ruby/object:Gem::Requirement
|
239
|
+
requirements:
|
240
|
+
- - ">="
|
241
|
+
- !ruby/object:Gem::Version
|
242
|
+
version: 0.5.1
|
243
|
+
- !ruby/object:Gem::Dependency
|
244
|
+
name: rubocop-rspec
|
245
|
+
requirement: !ruby/object:Gem::Requirement
|
246
|
+
requirements:
|
247
|
+
- - ">="
|
248
|
+
- !ruby/object:Gem::Version
|
249
|
+
version: 2.1.0
|
250
|
+
type: :development
|
251
|
+
prerelease: false
|
252
|
+
version_requirements: !ruby/object:Gem::Requirement
|
253
|
+
requirements:
|
254
|
+
- - ">="
|
255
|
+
- !ruby/object:Gem::Version
|
256
|
+
version: 2.1.0
|
229
257
|
description: Ridgepole is a tool to manage DB schema. It defines DB schema using Rails
|
230
258
|
DSL, and updates DB schema according to DSL.
|
231
259
|
email:
|