torque-postgresql 2.4.0 → 2.4.1

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: 51c2e056f8b1a5bfa52339dbc7212a03fdd7f99f7fa05b11d066859ef1763f45
4
- data.tar.gz: 6b0cdc4ac793d578cc925363f331f167c80a73a1d708f68c98b2d8430b21331f
3
+ metadata.gz: 0e36ced2b0986c132e095bbc1799e4fab1f7bd6f320e83d74f8387c9ad23b798
4
+ data.tar.gz: 4807f5dc5146805a349a5495829e0b4aac83df495982b08a35c9c593d8323d42
5
5
  SHA512:
6
- metadata.gz: fd702676e2677393a1002c411380cb297f7f56b7f2bdad7317a446849accf3090b9dcd27d6b2e50b7e7c81d6299db97f3fbd190a6c21d6afca9782c575e900ba
7
- data.tar.gz: 74cbc3c504fad7ebd55249ed4339c7a2571320828faebe7a2f573b759e721febd07e05c5227759748dbde4c0e629521d167d149e65339cd3a0be855f60076b29
6
+ metadata.gz: 84cc6db0f08fcb8c6d0616784382f77ebca1440a396df0a06efa7c2b0e1e0ac6685d54c4b4f6ac5163a7ba42cbeb4b2f81fcb197e4836d894819e0f76d9545c4
7
+ data.tar.gz: 3624ca914923f61c0bf23a7eed17c8c7d71270b8d0853d3d1445b7a1e513a97d066d8a7041111e504a7b1e6aaaab391cc2502d8fb42e69052c46b97377f4dfb4
@@ -185,21 +185,20 @@ module Torque
185
185
 
186
186
  # Get the list of columns, and their definition, but only from the
187
187
  # actual table, does not include columns that comes from inherited table
188
- def column_definitions(table_name) # :nodoc:
189
- local_condition = 'AND a.attislocal IS TRUE' if @_dump_mode
188
+ def column_definitions(table_name)
189
+ local = 'AND a.attislocal' if @_dump_mode
190
+
190
191
  query(<<-SQL, 'SCHEMA')
191
- SELECT a.attname, format_type(a.atttypid, a.atttypmod),
192
- pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod,
193
- (SELECT c.collname FROM pg_collation c, pg_type t
194
- WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation),
195
- col_description(a.attrelid, a.attnum) AS comment
196
- FROM pg_attribute a
197
- LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum
198
- WHERE a.attrelid = '#{quote_table_name(table_name)}'::regclass
199
- AND a.attnum > 0
200
- AND a.attisdropped IS FALSE
201
- #{local_condition}
202
- ORDER BY a.attnum
192
+ SELECT a.attname, format_type(a.atttypid, a.atttypmod),
193
+ pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod,
194
+ c.collname, col_description(a.attrelid, a.attnum) AS comment
195
+ FROM pg_attribute a
196
+ LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum
197
+ LEFT JOIN pg_type t ON a.atttypid = t.oid
198
+ LEFT JOIN pg_collation c ON a.attcollation = c.oid AND a.attcollation <> t.typcollation
199
+ WHERE a.attrelid = #{quote(quote_table_name(table_name))}::regclass
200
+ AND a.attnum > 0 AND NOT a.attisdropped #{local}
201
+ ORDER BY a.attnum
203
202
  SQL
204
203
  end
205
204
 
@@ -127,6 +127,11 @@ module Torque
127
127
 
128
128
  private
129
129
 
130
+ # Remove the schema from the sequence name
131
+ def sequence_name_from_parts(table_name, column_name, suffix)
132
+ super(table_name.split('.').last, column_name, suffix)
133
+ end
134
+
130
135
  def quote_enum_values(name, values, options)
131
136
  prefix = options[:prefix]
132
137
  prefix = name if prefix === true
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Torque
4
4
  module PostgreSQL
5
- VERSION = '2.4.0'
5
+ VERSION = '2.4.1'
6
6
  end
7
7
  end
@@ -73,6 +73,15 @@ RSpec.describe 'Schema' do
73
73
  expect(dump_result).to match /create_table \"users\",.*schema: +"internal"/
74
74
  end
75
75
  end
76
+
77
+ it 'does not affect serial ids' do
78
+ connection.create_table(:primary_keys, id: :serial) do |t|
79
+ t.string :title
80
+ end
81
+
82
+ parts = '"primary_keys", id: :serial, force: :cascade'
83
+ expect(dump_result).to match(/create_table #{parts} do /)
84
+ end
76
85
  end
77
86
 
78
87
  context 'on relation' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: torque-postgresql
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.0
4
+ version: 2.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carlos Silva
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-12-30 00:00:00.000000000 Z
11
+ date: 2023-01-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -108,22 +108,22 @@ dependencies:
108
108
  name: rspec
109
109
  requirement: !ruby/object:Gem::Requirement
110
110
  requirements:
111
- - - ">="
112
- - !ruby/object:Gem::Version
113
- version: 3.5.0
114
111
  - - "~>"
115
112
  - !ruby/object:Gem::Version
116
113
  version: '3.5'
114
+ - - ">="
115
+ - !ruby/object:Gem::Version
116
+ version: 3.5.0
117
117
  type: :development
118
118
  prerelease: false
119
119
  version_requirements: !ruby/object:Gem::Requirement
120
120
  requirements:
121
- - - ">="
122
- - !ruby/object:Gem::Version
123
- version: 3.5.0
124
121
  - - "~>"
125
122
  - !ruby/object:Gem::Version
126
123
  version: '3.5'
124
+ - - ">="
125
+ - !ruby/object:Gem::Version
126
+ version: 3.5.0
127
127
  - !ruby/object:Gem::Dependency
128
128
  name: factory_bot
129
129
  requirement: !ruby/object:Gem::Requirement
@@ -299,7 +299,7 @@ licenses:
299
299
  metadata:
300
300
  source_code_uri: https://github.com/crashtech/torque-postgresql
301
301
  bug_tracker_uri: https://github.com/crashtech/torque-postgresql/issues
302
- post_install_message:
302
+ post_install_message:
303
303
  rdoc_options:
304
304
  - "--title"
305
305
  - Torque PostgreSQL
@@ -316,60 +316,60 @@ required_rubygems_version: !ruby/object:Gem::Requirement
316
316
  - !ruby/object:Gem::Version
317
317
  version: 1.8.11
318
318
  requirements: []
319
- rubygems_version: 3.0.8
320
- signing_key:
319
+ rubygems_version: 3.2.15
320
+ signing_key:
321
321
  specification_version: 4
322
322
  summary: ActiveRecord extension to access PostgreSQL advanced resources
323
323
  test_files:
324
324
  - spec/en.yml
325
325
  - spec/factories/authors.rb
326
326
  - spec/factories/comments.rb
327
+ - spec/factories/item.rb
327
328
  - spec/factories/posts.rb
328
329
  - spec/factories/tags.rb
329
330
  - spec/factories/texts.rb
330
331
  - spec/factories/users.rb
331
332
  - spec/factories/videos.rb
332
- - spec/factories/item.rb
333
333
  - spec/mocks/cache_query.rb
334
334
  - spec/mocks/create_table.rb
335
335
  - spec/models/activity.rb
336
336
  - spec/models/activity_book.rb
337
- - spec/models/activity_post.rb
338
337
  - spec/models/activity_post/sample.rb
338
+ - spec/models/activity_post.rb
339
339
  - spec/models/author.rb
340
340
  - spec/models/author_journalist.rb
341
+ - spec/models/category.rb
341
342
  - spec/models/comment.rb
342
343
  - spec/models/course.rb
343
344
  - spec/models/geometry.rb
344
345
  - spec/models/guest_comment.rb
346
+ - spec/models/internal/user.rb
347
+ - spec/models/item.rb
345
348
  - spec/models/post.rb
349
+ - spec/models/question.rb
350
+ - spec/models/question_select.rb
346
351
  - spec/models/tag.rb
347
352
  - spec/models/text.rb
348
353
  - spec/models/time_keeper.rb
349
354
  - spec/models/user.rb
350
355
  - spec/models/video.rb
351
- - spec/models/item.rb
352
- - spec/models/question.rb
353
- - spec/models/question_select.rb
354
- - spec/models/internal/user.rb
355
- - spec/models/category.rb
356
+ - spec/schema.rb
357
+ - spec/spec_helper.rb
358
+ - spec/tests/arel_spec.rb
359
+ - spec/tests/auxiliary_statement_spec.rb
360
+ - spec/tests/belongs_to_many_spec.rb
356
361
  - spec/tests/collector_spec.rb
357
362
  - spec/tests/distinct_on_spec.rb
363
+ - spec/tests/enum_set_spec.rb
364
+ - spec/tests/enum_spec.rb
358
365
  - spec/tests/geometric_builder_spec.rb
359
- - spec/tests/lazy_spec.rb
360
- - spec/tests/quoting_spec.rb
361
- - spec/tests/relation_spec.rb
362
- - spec/tests/belongs_to_many_spec.rb
363
- - spec/tests/range_spec.rb
366
+ - spec/tests/has_many_spec.rb
364
367
  - spec/tests/insert_all_spec.rb
365
- - spec/tests/enum_set_spec.rb
366
- - spec/tests/auxiliary_statement_spec.rb
367
368
  - spec/tests/interval_spec.rb
369
+ - spec/tests/lazy_spec.rb
368
370
  - spec/tests/period_spec.rb
371
+ - spec/tests/quoting_spec.rb
372
+ - spec/tests/range_spec.rb
373
+ - spec/tests/relation_spec.rb
369
374
  - spec/tests/schema_spec.rb
370
375
  - spec/tests/table_inheritance_spec.rb
371
- - spec/tests/arel_spec.rb
372
- - spec/tests/enum_spec.rb
373
- - spec/tests/has_many_spec.rb
374
- - spec/spec_helper.rb
375
- - spec/schema.rb