ridgepole 0.6.5.beta2 → 0.6.5.beta3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Appraisals +1 -1
- data/README.md +8 -1
- data/gemfiles/activerecord_5.0.gemfile +1 -1
- data/lib/ridgepole/version.rb +1 -1
- data/spec/mysql/comment/comment_spec.rb +177 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9f55a300d2808032c178912f81d291ba094a867a
|
4
|
+
data.tar.gz: 20e173fc302bc246392f9efb96f4497c76154516
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 42b281cc0ebcb60117addc51ddba6b3b39b4358cc86fe804a5a184f2e96e4cff193e66d89b4dedc821e08d529e5ecf23874fa7ee4026b31533ad51f7d050d1c8
|
7
|
+
data.tar.gz: 4cdd724e376511e9cbbb82b269b4aecfc3657f3d6618744b90cb5c43bc8e5353e50cc2a9f1e5f2be85616fe72e92163f2fd7dd1728d0b8b42036ecec040e969b
|
data/Appraisals
CHANGED
data/README.md
CHANGED
@@ -54,6 +54,7 @@ It defines DB schema using [Rails DSL](http://guides.rubyonrails.org/migrations.
|
|
54
54
|
* Fix rails version `'>= 4.2', '< 6'`
|
55
55
|
* Support new types ([pull#84](https://github.com/winebarrel/ridgepole/pull/84))
|
56
56
|
* Support `default: -> { ... }` ([pull#85](https://github.com/winebarrel/ridgepole/pull/85))
|
57
|
+
* Support DDL Comment (Rails5 only)
|
57
58
|
|
58
59
|
## Installation
|
59
60
|
|
@@ -202,7 +203,7 @@ add_index "child", ["parent_id"], name: "par_ind", using: :btree
|
|
202
203
|
add_foreign_key "child", "parent", name: "child_ibfk_1"
|
203
204
|
```
|
204
205
|
|
205
|
-
## Collation
|
206
|
+
## Collation/Charset
|
206
207
|
You can use the column collation by passing `--enable-mysql-awesome` ([activerecord-mysql-awesome](https://github.com/kamipo/activerecord-mysql-awesome) is required)
|
207
208
|
|
208
209
|
```ruby
|
@@ -214,6 +215,12 @@ create_table "articles", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSE
|
|
214
215
|
end
|
215
216
|
```
|
216
217
|
|
218
|
+
Charset:
|
219
|
+
|
220
|
+
activerecord 5.0.0 and activerecord-mysql-awesome dumps a collation rather than charset because it does not determine the default collation for charset. Specifying a collation for each column would work if it is possible.
|
221
|
+
|
222
|
+
See `mysql> show character set;` to find charset / collation pair for your system.
|
223
|
+
|
217
224
|
## Execute
|
218
225
|
```ruby
|
219
226
|
create_table "authors", force: :cascade do |t|
|
data/lib/ridgepole/version.rb
CHANGED
@@ -0,0 +1,177 @@
|
|
1
|
+
describe 'Ridgepole::Client#diff -> migrate', condition: [:activerecord_5] do
|
2
|
+
context 'when change column (add comment)' do
|
3
|
+
let(:actual_dsl) {
|
4
|
+
<<-EOS
|
5
|
+
create_table "employee_clubs", force: :cascade do |t|
|
6
|
+
t.integer "emp_no", null: false
|
7
|
+
t.integer "club_id", null: false
|
8
|
+
t.string "string", null: false
|
9
|
+
t.text "text", limit: 65535, null: false
|
10
|
+
end
|
11
|
+
EOS
|
12
|
+
}
|
13
|
+
|
14
|
+
let(:expected_dsl) {
|
15
|
+
<<-EOS
|
16
|
+
create_table "employee_clubs", force: :cascade do |t|
|
17
|
+
t.integer "emp_no", null: false, comment: "any comment"
|
18
|
+
t.integer "club_id", null: false, comment: "any comment2"
|
19
|
+
t.string "string", null: false, comment: "any comment3"
|
20
|
+
t.text "text", limit: 65535, null: false, comment: "any comment4"
|
21
|
+
end
|
22
|
+
EOS
|
23
|
+
}
|
24
|
+
|
25
|
+
before { subject.diff(actual_dsl).migrate }
|
26
|
+
subject { client }
|
27
|
+
|
28
|
+
it {
|
29
|
+
delta = subject.diff(expected_dsl)
|
30
|
+
expect(delta.differ?).to be_truthy
|
31
|
+
expect(subject.dump).to match_fuzzy actual_dsl
|
32
|
+
delta.migrate
|
33
|
+
expect(subject.dump).to match_fuzzy expected_dsl
|
34
|
+
}
|
35
|
+
end
|
36
|
+
|
37
|
+
context 'when change column (delete comment)' do
|
38
|
+
let(:actual_dsl) {
|
39
|
+
<<-EOS
|
40
|
+
create_table "employee_clubs", force: :cascade do |t|
|
41
|
+
t.integer "emp_no", null: false, comment: "any comment"
|
42
|
+
t.integer "club_id", null: false, comment: "any comment2"
|
43
|
+
t.string "string", null: false, comment: "any comment3"
|
44
|
+
t.text "text", limit: 65535, null: false, comment: "any comment4"
|
45
|
+
end
|
46
|
+
EOS
|
47
|
+
}
|
48
|
+
|
49
|
+
let(:expected_dsl) {
|
50
|
+
<<-EOS
|
51
|
+
create_table "employee_clubs", force: :cascade do |t|
|
52
|
+
t.integer "emp_no", null: false
|
53
|
+
t.integer "club_id", null: false
|
54
|
+
t.string "string", null: false
|
55
|
+
t.text "text", limit: 65535, null: false
|
56
|
+
end
|
57
|
+
EOS
|
58
|
+
}
|
59
|
+
|
60
|
+
before { subject.diff(actual_dsl).migrate }
|
61
|
+
subject { client }
|
62
|
+
|
63
|
+
it {
|
64
|
+
delta = subject.diff(expected_dsl)
|
65
|
+
expect(delta.differ?).to be_truthy
|
66
|
+
expect(subject.dump).to match_fuzzy actual_dsl
|
67
|
+
delta.migrate
|
68
|
+
expect(subject.dump).to match_fuzzy expected_dsl
|
69
|
+
}
|
70
|
+
end
|
71
|
+
|
72
|
+
context 'when change column (change comment)' do
|
73
|
+
let(:actual_dsl) {
|
74
|
+
<<-EOS
|
75
|
+
create_table "employee_clubs", force: :cascade do |t|
|
76
|
+
t.integer "emp_no", null: false, comment: "any comment"
|
77
|
+
t.integer "club_id", null: false, comment: "any comment2"
|
78
|
+
t.string "string", null: false, comment: "any comment3"
|
79
|
+
t.text "text", limit: 65535, null: false, comment: "any comment4"
|
80
|
+
end
|
81
|
+
EOS
|
82
|
+
}
|
83
|
+
|
84
|
+
let(:expected_dsl) {
|
85
|
+
<<-EOS
|
86
|
+
create_table "employee_clubs", force: :cascade do |t|
|
87
|
+
t.integer "emp_no", null: false, comment: "other comment"
|
88
|
+
t.integer "club_id", null: false, comment: "other comment2"
|
89
|
+
t.string "string", null: false, comment: "other comment3"
|
90
|
+
t.text "text", limit: 65535, null: false, comment: "other comment4"
|
91
|
+
end
|
92
|
+
EOS
|
93
|
+
}
|
94
|
+
|
95
|
+
before { subject.diff(actual_dsl).migrate }
|
96
|
+
subject { client }
|
97
|
+
|
98
|
+
it {
|
99
|
+
delta = subject.diff(expected_dsl)
|
100
|
+
expect(delta.differ?).to be_truthy
|
101
|
+
expect(subject.dump).to match_fuzzy actual_dsl
|
102
|
+
delta.migrate
|
103
|
+
expect(subject.dump).to match_fuzzy expected_dsl
|
104
|
+
}
|
105
|
+
end
|
106
|
+
|
107
|
+
context 'when change column (no change comment)' do
|
108
|
+
let(:actual_dsl) {
|
109
|
+
<<-EOS
|
110
|
+
create_table "employee_clubs", force: :cascade do |t|
|
111
|
+
t.integer "emp_no", null: false, comment: "any comment"
|
112
|
+
t.integer "club_id", null: false, comment: "any comment2"
|
113
|
+
t.string "string", null: false, comment: "any comment3"
|
114
|
+
t.text "text", limit: 65535, null: false, comment: "any comment4"
|
115
|
+
end
|
116
|
+
EOS
|
117
|
+
}
|
118
|
+
|
119
|
+
before { subject.diff(actual_dsl).migrate }
|
120
|
+
subject { client }
|
121
|
+
|
122
|
+
it {
|
123
|
+
delta = subject.diff(actual_dsl)
|
124
|
+
expect(delta.differ?).to be_falsey
|
125
|
+
expect(subject.dump).to match_fuzzy actual_dsl
|
126
|
+
delta.migrate
|
127
|
+
expect(subject.dump).to match_fuzzy actual_dsl
|
128
|
+
}
|
129
|
+
end
|
130
|
+
|
131
|
+
context 'when create table (with comment)' do
|
132
|
+
let(:expected_dsl) {
|
133
|
+
<<-EOS
|
134
|
+
create_table "employee_clubs", force: :cascade, comment: "table comment" do |t|
|
135
|
+
t.integer "emp_no", null: false, comment: "other comment"
|
136
|
+
t.integer "club_id", null: false, comment: "other comment2"
|
137
|
+
t.string "string", null: false, comment: "other comment3"
|
138
|
+
t.text "text", limit: 65535, null: false, comment: "other comment4"
|
139
|
+
end
|
140
|
+
EOS
|
141
|
+
}
|
142
|
+
|
143
|
+
subject { client }
|
144
|
+
|
145
|
+
it {
|
146
|
+
delta = subject.diff(expected_dsl)
|
147
|
+
expect(delta.differ?).to be_truthy
|
148
|
+
expect(subject.dump.strip).to be_empty
|
149
|
+
delta.migrate
|
150
|
+
expect(subject.dump).to match_fuzzy expected_dsl
|
151
|
+
}
|
152
|
+
end
|
153
|
+
|
154
|
+
context 'when drop table (with comment)' do
|
155
|
+
let(:actual_dsl) {
|
156
|
+
<<-EOS
|
157
|
+
create_table "employee_clubs", force: :cascade, comment: "table comment" do |t|
|
158
|
+
t.integer "emp_no", null: false, comment: "other comment"
|
159
|
+
t.integer "club_id", null: false, comment: "other comment2"
|
160
|
+
t.string "string", null: false, comment: "other comment3"
|
161
|
+
t.text "text", limit: 65535, null: false, comment: "other comment4"
|
162
|
+
end
|
163
|
+
EOS
|
164
|
+
}
|
165
|
+
|
166
|
+
before { subject.diff(actual_dsl).migrate }
|
167
|
+
subject { client }
|
168
|
+
|
169
|
+
it {
|
170
|
+
delta = subject.diff('')
|
171
|
+
expect(delta.differ?).to be_truthy
|
172
|
+
expect(subject.dump).to match_fuzzy actual_dsl
|
173
|
+
delta.migrate
|
174
|
+
expect(subject.dump).to be_empty
|
175
|
+
}
|
176
|
+
end
|
177
|
+
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.5.
|
4
|
+
version: 0.6.5.beta3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Genki Sugawara
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-07-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -230,6 +230,7 @@ files:
|
|
230
230
|
- spec/mysql/cli/config_spec.rb
|
231
231
|
- spec/mysql/cli/ridgepole_spec.rb
|
232
232
|
- spec/mysql/collation/collation_spec.rb
|
233
|
+
- spec/mysql/comment/comment_spec.rb
|
233
234
|
- spec/mysql/default_lambda/default_lambda_spec.rb
|
234
235
|
- spec/mysql/diff/diff2_spec.rb
|
235
236
|
- spec/mysql/diff/diff_spec.rb
|
@@ -354,6 +355,7 @@ test_files:
|
|
354
355
|
- spec/mysql/cli/config_spec.rb
|
355
356
|
- spec/mysql/cli/ridgepole_spec.rb
|
356
357
|
- spec/mysql/collation/collation_spec.rb
|
358
|
+
- spec/mysql/comment/comment_spec.rb
|
357
359
|
- spec/mysql/default_lambda/default_lambda_spec.rb
|
358
360
|
- spec/mysql/diff/diff2_spec.rb
|
359
361
|
- spec/mysql/diff/diff_spec.rb
|