ridgepole 0.7.3 → 0.7.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +0 -3
- data/README.md +5 -3
- data/lib/ridgepole/dsl_parser/context.rb +2 -0
- data/lib/ridgepole/version.rb +1 -1
- data/ridgepole.gemspec +1 -1
- data/spec/mysql/fk/migrate_change_fk2_spec.rb +45 -0
- metadata +8 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9e1f7e2e2dcdca2d9af34e642e60289ee5666551
|
4
|
+
data.tar.gz: db223194fa6fff23ee8d8f5beeba4736f77a7f79
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d83dda15c6f6ba6374abfc165c688418d678d078d5ce1764f918c35209a3c67a1c61a04666b346be81076a4a19f6cd1622b6f876d79308c55401e9b14229706
|
7
|
+
data.tar.gz: 15cf3590d6a87f73744136b3b9f5170abedf673ccce912b16d3f6440fd7632d79e11704b6e642c890fb4260d46f92a8b57fe086cd651fb90d0250c0695b23d44
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -5,10 +5,10 @@ Ridgepole is a tool to manage DB schema.
|
|
5
5
|
It defines DB schema using [Rails DSL](http://guides.rubyonrails.org/migrations.html#types-of-schema-dumps), and updates DB schema according to DSL.
|
6
6
|
(like Chef/Puppet)
|
7
7
|
|
8
|
-
[![Gem Version](https://badge.fury.io/rb/ridgepole.svg)](http://badge.fury.io/rb/ridgepole)
|
9
|
-
[![Unstable Version](https://img.shields.io/badge/unstable-0.7.3.beta3-green.svg?longCache=true&style=flat)](https://rubygems.org/gems/ridgepole/versions/0.7.3.beta3)
|
8
|
+
[![Gem Version](https://badge.fury.io/rb/ridgepole.svg)](http://badge.fury.io/rb/ridgepole)<!--
|
9
|
+
[![Unstable Version](https://img.shields.io/badge/unstable-0.7.3.beta3-green.svg?longCache=true&style=flat)](https://rubygems.org/gems/ridgepole/versions/0.7.3.beta3) -->
|
10
10
|
[![Build Status](https://travis-ci.org/winebarrel/ridgepole.svg?branch=0.7)](https://travis-ci.org/winebarrel/ridgepole)
|
11
|
-
|
11
|
+
[![Coverage Status](https://coveralls.io/repos/github/winebarrel/ridgepole/badge.svg?branch=0.7)](https://coveralls.io/github/winebarrel/ridgepole?branch=0.7)
|
12
12
|
|
13
13
|
**ChangeLog**
|
14
14
|
|
@@ -87,6 +87,8 @@ It defines DB schema using [Rails DSL](http://guides.rubyonrails.org/migrations.
|
|
87
87
|
* Add `--mysql-change-table-comment option` ([pull#166](https://github.com/winebarrel/ridgepole/pull/166))
|
88
88
|
* Refactoring with RuboCop
|
89
89
|
* Support primary key adding/dropping ([issue#246](https://github.com/winebarrel/ridgepole/issues/246))
|
90
|
+
* `>= 0.7.4`
|
91
|
+
* Fix `add_foreign_key` options ([issue#250](https://github.com/winebarrel/ridgepole/issues/250))
|
90
92
|
|
91
93
|
## Installation
|
92
94
|
|
@@ -86,6 +86,8 @@ module Ridgepole
|
|
86
86
|
from_table = from_table.to_s
|
87
87
|
to_table = to_table.to_s
|
88
88
|
options[:name] = options[:name].to_s if options[:name]
|
89
|
+
options[:primary_key] = options[:primary_key].to_s if options[:primary_key]
|
90
|
+
options[:column] = options[:column].to_s if options[:column]
|
89
91
|
@__definition[from_table] ||= {}
|
90
92
|
@__definition[from_table][:foreign_keys] ||= {}
|
91
93
|
idx = options[:name] || [from_table, to_table]
|
data/lib/ridgepole/version.rb
CHANGED
data/ridgepole.gemspec
CHANGED
@@ -28,7 +28,7 @@ Gem::Specification.new do |spec|
|
|
28
28
|
spec.add_development_dependency 'erbh', '>= 0.1.2'
|
29
29
|
spec.add_development_dependency 'hash_modern_inspect', '>= 0.1.1'
|
30
30
|
spec.add_development_dependency 'hash_order_helper', '>= 0.1.6'
|
31
|
-
spec.add_development_dependency 'mysql2'
|
31
|
+
spec.add_development_dependency 'mysql2'
|
32
32
|
spec.add_development_dependency 'pg'
|
33
33
|
spec.add_development_dependency 'rake'
|
34
34
|
spec.add_development_dependency 'rspec', '>= 3.0.0'
|
@@ -0,0 +1,45 @@
|
|
1
|
+
describe 'Ridgepole::Client#diff -> migrate' do
|
2
|
+
context 'when change fk' do
|
3
|
+
let(:actual_dsl) do
|
4
|
+
erbh(<<-ERB)
|
5
|
+
create_table "users", id: false, force: :cascade do |t|
|
6
|
+
t.bigint :my_original_id, null: false
|
7
|
+
t.index %i[my_original_id], unique: true
|
8
|
+
end
|
9
|
+
|
10
|
+
create_table "lessons", force: :cascade do |t|
|
11
|
+
t.bigint :user_id2, null: false
|
12
|
+
t.index %i[user_id2], name: :index_lessons_on_user_id2
|
13
|
+
end
|
14
|
+
|
15
|
+
add_foreign_key :lessons, :users, primary_key: :my_original_id, column: :user_id2
|
16
|
+
ERB
|
17
|
+
end
|
18
|
+
|
19
|
+
let(:expected_dsl) do
|
20
|
+
erbh(<<-ERB)
|
21
|
+
create_table "lessons", force: :cascade do |t|
|
22
|
+
t.bigint "user_id2", null: false
|
23
|
+
t.index ["user_id2"], name: "index_lessons_on_user_id2", <%= i cond(5.0, using: :btree) %>
|
24
|
+
end
|
25
|
+
|
26
|
+
create_table "users", id: false, force: :cascade do |t|
|
27
|
+
t.bigint "my_original_id", null: false
|
28
|
+
t.index ["my_original_id"], name: "index_users_on_my_original_id", unique: true, <%= i cond(5.0, using: :btree) %>
|
29
|
+
end
|
30
|
+
|
31
|
+
add_foreign_key "lessons", "users", primary_key: "my_original_id", column: "user_id2"
|
32
|
+
ERB
|
33
|
+
end
|
34
|
+
|
35
|
+
before { subject.diff(actual_dsl).migrate }
|
36
|
+
|
37
|
+
subject { client }
|
38
|
+
|
39
|
+
it {
|
40
|
+
expect(subject.diff(actual_dsl).differ?).to be_falsey
|
41
|
+
expect(subject.diff(expected_dsl).differ?).to be_falsey
|
42
|
+
expect(subject.dump).to match_ruby expected_dsl
|
43
|
+
}
|
44
|
+
end
|
45
|
+
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.7.
|
4
|
+
version: 0.7.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Genki Sugawara
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-08-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -132,16 +132,16 @@ dependencies:
|
|
132
132
|
name: mysql2
|
133
133
|
requirement: !ruby/object:Gem::Requirement
|
134
134
|
requirements:
|
135
|
-
- - "
|
135
|
+
- - ">="
|
136
136
|
- !ruby/object:Gem::Version
|
137
|
-
version: 0
|
137
|
+
version: '0'
|
138
138
|
type: :development
|
139
139
|
prerelease: false
|
140
140
|
version_requirements: !ruby/object:Gem::Requirement
|
141
141
|
requirements:
|
142
|
-
- - "
|
142
|
+
- - ">="
|
143
143
|
- !ruby/object:Gem::Version
|
144
|
-
version: 0
|
144
|
+
version: '0'
|
145
145
|
- !ruby/object:Gem::Dependency
|
146
146
|
name: pg
|
147
147
|
requirement: !ruby/object:Gem::Requirement
|
@@ -291,6 +291,7 @@ files:
|
|
291
291
|
- spec/mysql/dump/dump_spec.rb
|
292
292
|
- spec/mysql/dump/dump_unknown_column_type_spec.rb
|
293
293
|
- spec/mysql/dump/dump_without_table_options_spec.rb
|
294
|
+
- spec/mysql/fk/migrate_change_fk2_spec.rb
|
294
295
|
- spec/mysql/fk/migrate_change_fk_spec.rb
|
295
296
|
- spec/mysql/fk/migrate_create_fk_spec.rb
|
296
297
|
- spec/mysql/fk/migrate_drop_fk_spec.rb
|
@@ -448,6 +449,7 @@ test_files:
|
|
448
449
|
- spec/mysql/dump/dump_spec.rb
|
449
450
|
- spec/mysql/dump/dump_unknown_column_type_spec.rb
|
450
451
|
- spec/mysql/dump/dump_without_table_options_spec.rb
|
452
|
+
- spec/mysql/fk/migrate_change_fk2_spec.rb
|
451
453
|
- spec/mysql/fk/migrate_change_fk_spec.rb
|
452
454
|
- spec/mysql/fk/migrate_create_fk_spec.rb
|
453
455
|
- spec/mysql/fk/migrate_drop_fk_spec.rb
|