ridgepole 0.8.11 → 0.8.12

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
  SHA256:
3
- metadata.gz: 367dff4faf9fd7e94588cdefe290cf13953cf82b9dc5110e91cfd5d4ee2507a3
4
- data.tar.gz: 20ad65390cd7b12fe97e8fbae409aa5bc0d86a6c73c79a9916bfc55f46f03cb6
3
+ metadata.gz: 91c51bf51596b61eff43704847bd41b9f8035ceafd1f1e05e1cd72fc6632e582
4
+ data.tar.gz: 32aff893209c48b839286b7efe24d465e3dd808d3b8820f52a5fb4eb9ecbf606
5
5
  SHA512:
6
- metadata.gz: 94039eb4e75e2f0b218275ffec9b8a1b4c28ae5b9c93ad64b584793acbabc1ece9eb8ddde4e6d3097ffc6a9346ef36a6318334048d99c8e85050e0b9ef3088bd
7
- data.tar.gz: 5e4837104ea5b6b69e42fdcc82e29b71a33835ce8371b959c16f3c00b014047a88b3c01ecba74ab8d6e591fd3357d15019a1dc41c425ff4c10b49fcec6bbdc48
6
+ metadata.gz: 92c24eca95293b83ab73871c9baaff349e8d28be8ddc5583746d3beecf0b6986eb58127361654fc0742c95b68f9ac2c060ca689af98a9ca6558b78c960b2a35b
7
+ data.tar.gz: 6864c16bbd8723436219540b7a3ab0f5eccfb32ae5301ac827957b9671c8cf83d7a91ea13a9a364f3b94ef236d2b3334742adce0524f7cb22801d298757cb0cd
@@ -44,6 +44,7 @@ jobs:
44
44
  run: |
45
45
  for i in {1..60}; do docker-compose up -d && break; sleep 1; done
46
46
 
47
+ gem install bundler
47
48
  bundle config path vendor/bundle
48
49
  bundle install --jobs 4 --retry 3
49
50
 
data/README.md CHANGED
@@ -125,6 +125,8 @@ It defines DB schema using [Rails DSL](http://guides.rubyonrails.org/migrations.
125
125
  * `>= 0.8.11`
126
126
  * Fix FK index check support multiple PK ([pull#315](https://github.com/winebarrel/ridgepole/pull/315))
127
127
  * Support t.reference() foreign_key option ([pull#316](https://github.com/winebarrel/ridgepole/pull/316))
128
+ * `>= 0.8.12`
129
+ * Pluralize column specified by `references` ([pull#317](https://github.com/winebarrel/ridgepole/pull/317))
128
130
  </details>
129
131
 
130
132
  ## Installation
@@ -143,7 +143,7 @@ module Ridgepole
143
143
  if foreign_key_options # rubocop:disable Style/Next
144
144
  fk_opts = foreign_key_options.is_a?(Hash) ? foreign_key_options.dup : {}
145
145
  fk_opts.update(column: "#{col}_id") if col.to_s.singularize != col.to_s
146
- to_table = fk_opts.delete(:to_table) || col
146
+ to_table = fk_opts.delete(:to_table) || col.to_s.pluralize
147
147
  @base.add_foreign_key(@table_name, to_table, fk_opts)
148
148
  end
149
149
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ridgepole
4
- VERSION = '0.8.11'
4
+ VERSION = '0.8.12'
5
5
  end
@@ -99,9 +99,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
99
99
  t.string "last_name", limit: 16, null: false
100
100
  t.string "gender", limit: 1, null: false
101
101
  t.date "hire_date", null: false
102
- t.<%= cond('>= 5.1','bigint', 'integer') %> "products_id"
103
102
  t.<%= cond('>= 5.1','bigint', 'integer') %> "user_id"
104
- t.index "products_id"
105
103
  t.index "user_id"
106
104
  end
107
105
  ERB
@@ -115,7 +113,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
115
113
  t.string "last_name", limit: 16, null: false
116
114
  t.string "gender", limit: 1, null: false
117
115
  t.date "hire_date", null: false
118
- t.references :products, :user
116
+ t.references :user
119
117
  end
120
118
  RUBY
121
119
  end
@@ -138,11 +136,8 @@ describe 'Ridgepole::Client#diff -> migrate' do
138
136
  t.string "last_name", limit: 16, null: false
139
137
  t.string "gender", limit: 1, null: false
140
138
  t.date "hire_date", null: false
141
- t.<%= cond('>= 5.1','bigint', 'integer') %> "products_id"
142
- t.string "products_type"
143
139
  t.<%= cond('>= 5.1','bigint', 'integer') %> "user_id"
144
140
  t.string "user_type"
145
- t.index ["products_type", "products_id"]
146
141
  t.index ["user_type", "user_id"]
147
142
  end
148
143
  ERB
@@ -156,7 +151,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
156
151
  t.string "last_name", limit: 16, null: false
157
152
  t.string "gender", limit: 1, null: false
158
153
  t.date "hire_date", null: false
159
- t.references :products, :user, polymorphic: true
154
+ t.references :user, polymorphic: true
160
155
  end
161
156
  RUBY
162
157
  end
@@ -174,11 +169,8 @@ describe 'Ridgepole::Client#diff -> migrate' do
174
169
  let(:actual_dsl) do
175
170
  erbh(<<-ERB)
176
171
  create_table "employees", primary_key: "emp_no", force: :cascade do |t|
177
- t.<%= cond('>= 5.1','bigint', 'integer') %> "products_id", unsigned: true
178
- t.string "products_type"
179
172
  t.<%= cond('>= 5.1','bigint', 'integer') %> "user_id", unsigned: true
180
173
  t.string "user_type"
181
- t.index ["products_type", "products_id"]
182
174
  t.index ["user_type", "user_id"]
183
175
  end
184
176
  ERB
@@ -187,7 +179,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
187
179
  let(:expected_dsl) do
188
180
  <<-RUBY
189
181
  create_table "employees", primary_key: "emp_no", force: :cascade do |t|
190
- t.references :products, :user, unsigned: true, polymorphic: true
182
+ t.references :user, unsigned: true, polymorphic: true
191
183
  end
192
184
  RUBY
193
185
  end
@@ -222,7 +214,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
222
214
  t.string "last_name", limit: 16, null: false
223
215
  t.string "gender", limit: 1, null: false
224
216
  t.date "hire_date", null: false
225
- t.references :products, :user
217
+ t.references :user
226
218
  end
227
219
  RUBY
228
220
  end
@@ -235,9 +227,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
235
227
  t.string "last_name", limit: 16, null: false
236
228
  t.string "gender", limit: 1, null: false
237
229
  t.date "hire_date", null: false
238
- t.<%= cond('>= 5.1','bigint', 'integer') %> "products_id"
239
230
  t.<%= cond('>= 5.1','bigint', 'integer') %> "user_id"
240
- t.index ["products_id"], name: "index_employees_on_products_id", <%= i cond(5.0, using: :btree) %>
241
231
  t.index ["user_id"], name: "index_employees_on_user_id", <%= i cond(5.0, using: :btree) %>
242
232
  end
243
233
  ERB
@@ -276,7 +266,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
276
266
  t.string "last_name", limit: 16, null: false
277
267
  t.string "gender", limit: 1, null: false
278
268
  t.date "hire_date", null: false
279
- t.references :products, :user, polymorphic: true
269
+ t.references :user, polymorphic: true
280
270
  end
281
271
  RUBY
282
272
  end
@@ -289,11 +279,8 @@ describe 'Ridgepole::Client#diff -> migrate' do
289
279
  t.string "last_name", limit: 16, null: false
290
280
  t.string "gender", limit: 1, null: false
291
281
  t.date "hire_date", null: false
292
- t.<%= cond('>= 5.1','bigint', 'integer') %> "products_id"
293
- t.string "products_type"
294
282
  t.<%= cond('>= 5.1','bigint', 'integer') %> "user_id"
295
283
  t.string "user_type"
296
- t.index ["products_type", "products_id"], name: "index_employees_on_products_type_and_products_id", <%= i cond(5.0, using: :btree) %>
297
284
  t.index ["user_type", "user_id"], name: "index_employees_on_user_type_and_user_id", <%= i cond(5.0, using: :btree) %>
298
285
  end
299
286
  ERB
@@ -314,10 +301,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
314
301
  context 'when use references with fk (no change)' do
315
302
  let(:actual_dsl) do
316
303
  erbh(<<-ERB)
317
- create_table "products", force: :cascade do |t|
318
- end
319
-
320
- create_table "user", force: :cascade do |t|
304
+ create_table "users", force: :cascade do |t|
321
305
  end
322
306
 
323
307
  create_table "employees", primary_key: "emp_no", force: :cascade do |t|
@@ -326,23 +310,17 @@ describe 'Ridgepole::Client#diff -> migrate' do
326
310
  t.string "last_name", limit: 16, null: false
327
311
  t.string "gender", limit: 1, null: false
328
312
  t.date "hire_date", null: false
329
- t.<%= cond('>= 5.1','bigint', 'integer') %> "products_id"
330
313
  t.<%= cond('>= 5.1','bigint', 'integer') %> "user_id"
331
- t.index "products_id"
332
314
  t.index "user_id"
333
315
  end
334
316
 
335
- add_foreign_key("employees", "products", **{:column=>"products_id"})
336
- add_foreign_key("employees", "user")
317
+ add_foreign_key("employees", "users")
337
318
  ERB
338
319
  end
339
320
 
340
321
  let(:expected_dsl) do
341
322
  erbh(<<-ERB)
342
- create_table "products", force: :cascade do |t|
343
- end
344
-
345
- create_table "user", force: :cascade do |t|
323
+ create_table "users", force: :cascade do |t|
346
324
  end
347
325
 
348
326
  create_table "employees", primary_key: "emp_no", force: :cascade do |t|
@@ -351,7 +329,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
351
329
  t.string "last_name", limit: 16, null: false
352
330
  t.string "gender", limit: 1, null: false
353
331
  t.date "hire_date", null: false
354
- t.references :products, :user, foreign_key: true
332
+ t.references :user, foreign_key: true
355
333
  end
356
334
  ERB
357
335
  end
@@ -375,9 +353,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
375
353
  t.string "gender", limit: 1, null: false
376
354
  t.date "hire_date", null: false
377
355
  end
378
- create_table "products", force: :cascade do |t|
379
- end
380
- create_table "user", force: :cascade do |t|
356
+ create_table "users", force: :cascade do |t|
381
357
  end
382
358
  ERB
383
359
  end
@@ -390,11 +366,9 @@ describe 'Ridgepole::Client#diff -> migrate' do
390
366
  t.string "last_name", limit: 16, null: false
391
367
  t.string "gender", limit: 1, null: false
392
368
  t.date "hire_date", null: false
393
- t.references :products, :user, foreign_key: true
394
- end
395
- create_table "products", force: :cascade do |t|
369
+ t.references :user, foreign_key: true
396
370
  end
397
- create_table "user", force: :cascade do |t|
371
+ create_table "users", force: :cascade do |t|
398
372
  end
399
373
  ERB
400
374
  end
@@ -407,17 +381,12 @@ describe 'Ridgepole::Client#diff -> migrate' do
407
381
  t.string "last_name", limit: 16, null: false
408
382
  t.string "gender", limit: 1, null: false
409
383
  t.date "hire_date", null: false
410
- t.<%= cond('>= 5.1','bigint', 'integer') %> "products_id"
411
384
  t.<%= cond('>= 5.1','bigint', 'integer') %> "user_id"
412
- t.index ["products_id"], name: "index_employees_on_products_id", <%= i cond(5.0, using: :btree) %>
413
385
  t.index ["user_id"], name: "index_employees_on_user_id", <%= i cond(5.0, using: :btree) %>
414
386
  end
415
- create_table "products", force: :cascade do |t|
416
- end
417
- create_table "user", force: :cascade do |t|
387
+ create_table "users", force: :cascade do |t|
418
388
  end
419
- add_foreign_key("employees", "products", column: "products_id")
420
- add_foreign_key("employees", "user")
389
+ add_foreign_key("employees", "users")
421
390
  ERB
422
391
  end
423
392
 
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.11
4
+ version: 0.8.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Genki Sugawara
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-11-30 00:00:00.000000000 Z
11
+ date: 2020-12-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord