ridgepole 0.6.0 → 0.6.1.beta
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +12 -2
- data/README.md +2 -0
- data/lib/ridgepole/dsl_parser.rb +27 -1
- data/lib/ridgepole/version.rb +1 -1
- data/ridgepole.gemspec +1 -1
- data/spec/postgresql/migrate/migrate_ext_cols_spec.rb +65 -0
- data/spec/postgresql/ridgepole_test_database.sql +4 -0
- metadata +7 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 99f9de7d2f7d60587f7f52945d75c1cca48a0a84
|
4
|
+
data.tar.gz: ac73999341deac1963b4aa2b64aa9fa25ca77644
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 33ce416732a85e04bfee72699ea2129d066fe5031dc499f32b9b6931101216521f7931e8ad882d94c1e3c7719f566399e8e411c367577036242c84c9d4bd5009
|
7
|
+
data.tar.gz: 4e2626ca6af897a3a5455c0fad39ae41e19150995dc5f79c8ddcc27664306d86ddb386a4286f63a9f7d699c09ba1cd2b545f12644635d0200647d842b2b9d1e2
|
data/.travis.yml
CHANGED
@@ -11,5 +11,15 @@ env:
|
|
11
11
|
- ENABLE_MYSQL_AWESOME=0
|
12
12
|
- ENABLE_MYSQL_AWESOME=1
|
13
13
|
- POSTGRESQL=1
|
14
|
-
|
15
|
-
postgresql
|
14
|
+
before_install:
|
15
|
+
- sudo /etc/init.d/postgresql stop
|
16
|
+
- sudo apt-get update
|
17
|
+
- sudo apt-get purge postgresql-9.1 postgresql-9.2 postgresql-9.3
|
18
|
+
- sudo apt-get install language-pack-es postgresql-9.4
|
19
|
+
- sudo chmod 777 /etc/postgresql/9.4/main/pg_hba.conf
|
20
|
+
- sudo echo "local all postgres trust" > /etc/postgresql/9.4/main/pg_hba.conf
|
21
|
+
- sudo echo "local all all trust" >> /etc/postgresql/9.4/main/pg_hba.conf
|
22
|
+
- sudo echo "host all all 127.0.0.1/32 trust" >> /etc/postgresql/9.4/main/pg_hba.conf
|
23
|
+
- sudo echo "host all all ::1/128 trust" >> /etc/postgresql/9.4/main/pg_hba.conf
|
24
|
+
- sudo /etc/init.d/postgresql restart
|
25
|
+
- psql --version
|
data/README.md
CHANGED
@@ -36,6 +36,8 @@ It defines DB schema using [Rails DSL](http://guides.rubyonrails.org/migrations.
|
|
36
36
|
* Disable sqlite support
|
37
37
|
* Add PostgreSQL test
|
38
38
|
* Remove `--mysql-awesome-unsigned-pk` option
|
39
|
+
* `>= 0.6.1`
|
40
|
+
* Support [PostgreSQL columns](https://github.com/winebarrel/rails/blob/v4.2.1/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb#L79)
|
39
41
|
|
40
42
|
## Installation
|
41
43
|
|
data/lib/ridgepole/dsl_parser.rb
CHANGED
@@ -22,8 +22,8 @@ class Ridgepole::DSLParser
|
|
22
22
|
}
|
23
23
|
end
|
24
24
|
|
25
|
-
# https://github.com/winebarrel/rails/blob/v4.2.1/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb#L274
|
26
25
|
TYPES = [
|
26
|
+
# https://github.com/winebarrel/rails/blob/v4.2.1/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb#L274
|
27
27
|
:string,
|
28
28
|
:text,
|
29
29
|
:integer,
|
@@ -36,6 +36,32 @@ class Ridgepole::DSLParser
|
|
36
36
|
:date,
|
37
37
|
:binary,
|
38
38
|
:boolean,
|
39
|
+
|
40
|
+
# https://github.com/winebarrel/rails/blob/v4.2.1/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb#L79
|
41
|
+
:daterange,
|
42
|
+
:numrange,
|
43
|
+
:tsrange,
|
44
|
+
:tstzrange,
|
45
|
+
:int4range,
|
46
|
+
:int8range,
|
47
|
+
:binary,
|
48
|
+
:boolean,
|
49
|
+
:bigint,
|
50
|
+
:xml,
|
51
|
+
:tsvector,
|
52
|
+
:hstore,
|
53
|
+
:inet,
|
54
|
+
:cidr,
|
55
|
+
:macaddr,
|
56
|
+
:uuid,
|
57
|
+
:json,
|
58
|
+
:jsonb,
|
59
|
+
:ltree,
|
60
|
+
:citext,
|
61
|
+
:point,
|
62
|
+
:bit,
|
63
|
+
:bit_varying,
|
64
|
+
:money,
|
39
65
|
]
|
40
66
|
|
41
67
|
TYPES.each do |column_type|
|
data/lib/ridgepole/version.rb
CHANGED
data/ridgepole.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ['sugawara@cookpad.com']
|
11
11
|
spec.summary = %q{Ridgepole is a tool to manage DB schema.}
|
12
12
|
spec.description = %q{Ridgepole is a tool to manage DB schema. It defines DB schema using Rails DSL, and updates DB schema according to DSL.}
|
13
|
-
spec.homepage = 'https://github.com/winebarrel/ridgepole
|
13
|
+
spec.homepage = 'https://github.com/winebarrel/ridgepole'
|
14
14
|
spec.license = 'MIT'
|
15
15
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0")
|
@@ -0,0 +1,65 @@
|
|
1
|
+
if postgresql?
|
2
|
+
describe 'Ridgepole::Client#diff -> migrate' do
|
3
|
+
context 'when add column (ext cols)' do
|
4
|
+
let(:actual_dsl) {
|
5
|
+
<<-RUBY
|
6
|
+
create_table "items", force: :cascade do |t|
|
7
|
+
t.string "name"
|
8
|
+
t.integer "price"
|
9
|
+
t.text "description"
|
10
|
+
t.datetime "created_at", null: false
|
11
|
+
t.datetime "updated_at", null: false
|
12
|
+
end
|
13
|
+
RUBY
|
14
|
+
}
|
15
|
+
|
16
|
+
let(:expected_dsl) {
|
17
|
+
<<-RUBY
|
18
|
+
create_table "items", force: :cascade do |t|
|
19
|
+
t.string "name"
|
20
|
+
t.integer "price"
|
21
|
+
t.text "description"
|
22
|
+
t.datetime "created_at", null: false
|
23
|
+
t.datetime "updated_at", null: false
|
24
|
+
t.daterange "daterange"
|
25
|
+
t.numrange "numrange"
|
26
|
+
t.tsrange "tsrange"
|
27
|
+
t.tstzrange "tstzrange"
|
28
|
+
t.int4range "int4range"
|
29
|
+
t.int8range "int8range"
|
30
|
+
t.binary "bytea"
|
31
|
+
t.boolean "boolean"
|
32
|
+
t.bigint "bigint"
|
33
|
+
t.xml "xml"
|
34
|
+
t.tsvector "tsvector"
|
35
|
+
t.hstore "hstore"
|
36
|
+
t.inet "inet"
|
37
|
+
t.cidr "cidr"
|
38
|
+
t.macaddr "macaddr"
|
39
|
+
t.uuid "uuid"
|
40
|
+
t.json "json"
|
41
|
+
t.jsonb "jsonb"
|
42
|
+
t.ltree "ltree"
|
43
|
+
t.citext "citext"
|
44
|
+
t.point "point"
|
45
|
+
t.bit "bit", limit: 1
|
46
|
+
t.bit_varying "bit varying"
|
47
|
+
t.money "money", scale: 2
|
48
|
+
end
|
49
|
+
RUBY
|
50
|
+
}
|
51
|
+
|
52
|
+
before { subject.diff(actual_dsl).migrate }
|
53
|
+
subject { client }
|
54
|
+
|
55
|
+
it {
|
56
|
+
delta = subject.diff(expected_dsl)
|
57
|
+
expect(delta.differ?).to be_truthy
|
58
|
+
expect(subject.dump).to eq actual_dsl.strip_heredoc.strip
|
59
|
+
delta.migrate
|
60
|
+
expected_dsl.sub!('t.bigint "bigint"', 't.integer "bigint", limit: 8')
|
61
|
+
expect(subject.dump).to eq expected_dsl.strip_heredoc.strip
|
62
|
+
}
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
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.6.
|
4
|
+
version: 0.6.1.beta
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Genki Sugawara
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05-
|
11
|
+
date: 2015-05-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -220,6 +220,7 @@ files:
|
|
220
220
|
- spec/postgresql/migrate/migrate_drop_column_with_index_spec.rb
|
221
221
|
- spec/postgresql/migrate/migrate_drop_index_spec.rb
|
222
222
|
- spec/postgresql/migrate/migrate_drop_table_spec.rb
|
223
|
+
- spec/postgresql/migrate/migrate_ext_cols_spec.rb
|
223
224
|
- spec/postgresql/migrate/migrate_rename_column_spec.rb
|
224
225
|
- spec/postgresql/migrate/migrate_rename_table_spec.rb
|
225
226
|
- spec/postgresql/migrate/migrate_same_spec.rb
|
@@ -227,7 +228,7 @@ files:
|
|
227
228
|
- spec/postgresql/ridgepole_test_tables.sql
|
228
229
|
- spec/spec_helper.rb
|
229
230
|
- spec/string_ext.rb
|
230
|
-
homepage: https://github.com/winebarrel/ridgepole
|
231
|
+
homepage: https://github.com/winebarrel/ridgepole
|
231
232
|
licenses:
|
232
233
|
- MIT
|
233
234
|
metadata: {}
|
@@ -242,9 +243,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
242
243
|
version: '0'
|
243
244
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
244
245
|
requirements:
|
245
|
-
- - '
|
246
|
+
- - '>'
|
246
247
|
- !ruby/object:Gem::Version
|
247
|
-
version:
|
248
|
+
version: 1.3.1
|
248
249
|
requirements: []
|
249
250
|
rubyforge_project:
|
250
251
|
rubygems_version: 2.0.14
|
@@ -319,6 +320,7 @@ test_files:
|
|
319
320
|
- spec/postgresql/migrate/migrate_drop_column_with_index_spec.rb
|
320
321
|
- spec/postgresql/migrate/migrate_drop_index_spec.rb
|
321
322
|
- spec/postgresql/migrate/migrate_drop_table_spec.rb
|
323
|
+
- spec/postgresql/migrate/migrate_ext_cols_spec.rb
|
322
324
|
- spec/postgresql/migrate/migrate_rename_column_spec.rb
|
323
325
|
- spec/postgresql/migrate/migrate_rename_table_spec.rb
|
324
326
|
- spec/postgresql/migrate/migrate_same_spec.rb
|