torque-postgresql 3.2.0 → 3.2.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c677b1f2b2cdf150a4e8e9a817cd7a9a6e46680a353c3125aeb7ab65e1b85348
4
- data.tar.gz: 72a25a13491d9349a813484be40c43cacc767355060ba16375da7b7f41739249
3
+ metadata.gz: f08898e4218d41dbcc6394500243760cdd29425ad77135a623bea043cfa8d3ae
4
+ data.tar.gz: 93c5d71e1597364b7e434e6c88faf4cfd64dcbc930756398f7539dc525a21f05
5
5
  SHA512:
6
- metadata.gz: 1b6bdeeb8ca02a6027a79fc0d896716603792c1d4cee95131995ef944075f13b983a583a22eb4e3b6b590b8430b7b4eb4469522cf76b47daa30b8c2dd35a7318
7
- data.tar.gz: eca4f269833a0823442f247cb065f14fe412c85063e5df8e751a20a366fd296f02db3ad2720b02d7a4169c73b38c1bbfe29160f292671a8a5cf0a23b4ffa9261
6
+ metadata.gz: c7f93afd26ff711ba03f5a5b1381a139690acf8d3a5621ddec1d26a94ae345c2a59e06cdd9805a5101b4d81f51c151ea0fd19bba7a66d080d05387b073cfd55a
7
+ data.tar.gz: 5db371506b24fe1c5e28aee69054a83724af93642f44cd3646f6aa9ff9bd58b7a2d2632a186762dca570e2adb0ceea1c38cec5d0119b8f0e4e882b4089913895
@@ -194,23 +194,21 @@ module Torque
194
194
 
195
195
  # Get the list of columns, and their definition, but only from the
196
196
  # actual table, does not include columns that comes from inherited table
197
- def column_definitions(table_name) # :nodoc:
198
- # Only affects inheritance
199
- local_condition = 'AND a.attislocal IS TRUE' if @_dump_mode
197
+ def column_definitions(table_name)
198
+ local = 'AND a.attislocal' if @_dump_mode
200
199
 
201
200
  query(<<-SQL, 'SCHEMA')
202
- SELECT a.attname, format_type(a.atttypid, a.atttypmod),
203
- pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod,
204
- (SELECT c.collname FROM pg_collation c, pg_type t
205
- WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation),
206
- col_description(a.attrelid, a.attnum) AS comment
207
- FROM pg_attribute a
208
- LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum
209
- WHERE a.attrelid = '#{quote_table_name(table_name)}'::regclass
210
- AND a.attnum > 0
211
- AND a.attisdropped IS FALSE
212
- #{local_condition}
213
- ORDER BY a.attnum
201
+ SELECT a.attname, format_type(a.atttypid, a.atttypmod),
202
+ pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod,
203
+ c.collname, col_description(a.attrelid, a.attnum) AS comment,
204
+ #{supports_virtual_columns? ? 'attgenerated' : quote('')} as attgenerated
205
+ FROM pg_attribute a
206
+ LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum
207
+ LEFT JOIN pg_type t ON a.atttypid = t.oid
208
+ LEFT JOIN pg_collation c ON a.attcollation = c.oid AND a.attcollation <> t.typcollation
209
+ WHERE a.attrelid = #{quote(quote_table_name(table_name))}::regclass
210
+ AND a.attnum > 0 AND NOT a.attisdropped #{local}
211
+ ORDER BY a.attnum
214
212
  SQL
215
213
  end
216
214
 
@@ -112,6 +112,11 @@ module Torque
112
112
 
113
113
  private
114
114
 
115
+ # Remove the schema from the sequence name
116
+ def sequence_name_from_parts(table_name, column_name, suffix)
117
+ super(table_name.split('.').last, column_name, suffix)
118
+ end
119
+
115
120
  def quote_enum_values(name, values, options)
116
121
  prefix = options[:prefix]
117
122
  prefix = name if prefix === true
@@ -59,11 +59,11 @@ module Torque
59
59
  # arguments to format string or send on a proc
60
60
  cte.send_arguments_key = :args
61
61
 
62
- # Estipulate a class name (which may contain namespace) that expose the
62
+ # Estipulate a class name (which may contain namespace) that exposes the
63
63
  # auxiliary statement in order to perform detached CTEs
64
64
  cte.exposed_class = 'TorqueCTE'
65
65
 
66
- # Estipulate a class name (which may contain namespace) that expose the
66
+ # Estipulate a class name (which may contain namespace) that exposes the
67
67
  # recursive auxiliary statement in order to perform detached CTEs
68
68
  cte.exposed_recursive_class = 'TorqueRecursiveCTE'
69
69
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Torque
4
4
  module PostgreSQL
5
- VERSION = '3.2.0'
5
+ VERSION = '3.2.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: 3.2.0
4
+ version: 3.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carlos Silva
8
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