pg_party 1.7.0 → 1.8.0

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: 47b9e6d4d46ab349625ffcb49760675371e99412bdeac53993a7965dd08224cf
4
- data.tar.gz: '08005f8354b7619a3e7745a67c157b2265851f0b7bc25568bfbd84d56e29a2b4'
3
+ metadata.gz: 2a925ebf451625606acfdf6a4d1dbdde4a2a21e0ac98ccbbeabb6eb91d5d998e
4
+ data.tar.gz: 5f157ce75a78a79ff14fe0aa7eead4f045339a823193baa58562d8fd9e897a84
5
5
  SHA512:
6
- metadata.gz: b6f5d302c2d4bdccc61ed263db7d04723551ab83bffdb1c89e229d8a602733329aa7568ff66ddcac7d4ffcf4a8c44ebd47536e3a50aa5f48a5876504224b8258
7
- data.tar.gz: 0b5d15d2f46417a2a1eb54d56be0ba2b0a7c4a665c2c1b6ae38600891cb91260bb667f5d88cdd28b97d1b50370b4ce098ca895de3d8cdb2f58970aab474d76fc
6
+ metadata.gz: 6b35cc8959cca3f09d504ebeb0d83a16633c803d858fb80398f6ebd3fd78c9599670fa3b3601ae96a510d5708a4b9cbcc201a2bd68100c794de103cd6817838d
7
+ data.tar.gz: e1b87b04b9a418326b2a06536d6477d29188332e5c01592241c740dd88deeb34c6d29570b5c47a25f628ed7facc5d41c02c9d626680db030a0460ae1892ae03a
data/README.md CHANGED
@@ -25,7 +25,7 @@
25
25
 
26
26
  This gem is tested against:
27
27
 
28
- - Rails: 6.1, 7.0, 7.1
28
+ - Rails: 6.1, 7.0, 7.1, 7.2
29
29
  - Ruby: 3.0, latest (currently 3.2 at the time of this commit)
30
30
  - PostgreSQL: 11, 12, 13, 14, 15, 16
31
31
 
@@ -177,7 +177,7 @@ These methods are available in migrations as well as `ActiveRecord::Base#connect
177
177
  may be reasonable for tables with many large partitions and hosts with 4+ CPUs/cores.
178
178
  - Use `disable_ddl_transaction!` in your migration to disable transactions when using this command with `in_threads:`
179
179
  or `algorithm: :concurrently`.
180
-
180
+
181
181
  #### Examples
182
182
 
183
183
  Create _range_ partitioned table on `created_at::date` with two partitions:
@@ -228,7 +228,7 @@ class CreateSomeListRecord < ActiveRecord::Migration[5.1]
228
228
  create_list_partition_of \
229
229
  :some_list_records,
230
230
  values: 101..200
231
-
231
+
232
232
  # default partition support is available in Postgres 11 or higher
233
233
  create_default_partition_of \
234
234
  :some_list_records
@@ -296,7 +296,7 @@ class CreateSomeListSubpartitionedRecord < ActiveRecord::Migration[5.1]
296
296
  name: :some_list_subpartitioned_records_default_2019,
297
297
  start_range: '2019-01-01',
298
298
  end_range: '2019-12-31T23:59:59'
299
-
299
+
300
300
  create_default_partition_of \
301
301
  :some_list_subpartitioned_records_default
302
302
 
@@ -306,7 +306,7 @@ class CreateSomeListSubpartitionedRecord < ActiveRecord::Migration[5.1]
306
306
  values: 1..100,
307
307
  partition_type: :range,
308
308
  partition_key: :created_at
309
-
309
+
310
310
  create_range_partition_of \
311
311
  :some_list_subpartitioned_records_1,
312
312
  name: :some_list_subpartitioned_records_1_2019,
@@ -502,7 +502,7 @@ Class methods available to _list_ partitioned models:
502
502
  - `partition_key_in`
503
503
  - Query for records where partition key in _list_ of values
504
504
  - Required arg: list of `values`
505
-
505
+
506
506
 
507
507
  Class methods available to _hash_ partitioned models:
508
508
 
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "pg_party/adapter_decorator"
4
- require "ruby2_keywords"
5
4
 
6
5
  module PgParty
7
6
  module Adapter
@@ -115,7 +115,7 @@ module PgParty
115
115
  FROM pg_tables
116
116
  INNER JOIN pg_inherits
117
117
  ON pg_tables.tablename::regclass = pg_inherits.inhparent::regclass
118
- WHERE pg_tables.schemaname = current_schema() AND
118
+ WHERE pg_tables.schemaname = ANY(current_schemas(false)) AND
119
119
  pg_tables.tablename = #{quote(table_name)}
120
120
  ], "SCHEMA").each_with_object(_accumulator) do |partition, acc|
121
121
  acc << partition
@@ -131,7 +131,7 @@ module PgParty
131
131
  FROM pg_tables
132
132
  INNER JOIN pg_inherits
133
133
  ON pg_tables.tablename::regclass = pg_inherits.inhrelid::regclass
134
- WHERE pg_tables.schemaname = current_schema() AND
134
+ WHERE pg_tables.schemaname = ANY(current_schemas(false)) AND
135
135
  pg_tables.tablename = #{quote(table_name)}
136
136
  ], "SCHEMA").first
137
137
  return parent if parent.nil? || !traverse
@@ -173,7 +173,7 @@ module PgParty
173
173
  select_values(%[
174
174
  SELECT relkind FROM pg_catalog.pg_class AS c
175
175
  JOIN pg_catalog.pg_namespace AS ns ON c.relnamespace = ns.oid
176
- WHERE relname = #{quote(table_name)} AND nspname = current_schema()
176
+ WHERE relname = #{quote(table_name)} AND nspname = ANY(current_schemas(false))
177
177
  ], "SCHEMA").first == 'p'
178
178
  end
179
179
 
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "pg_party/model_decorator"
4
- require "ruby2_keywords"
5
4
 
6
5
  module PgParty
7
6
  module Model
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "pg_party/model_decorator"
4
- require "ruby2_keywords"
5
4
 
6
5
  module PgParty
7
6
  module Model
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "pg_party/model_decorator"
4
- require "ruby2_keywords"
5
4
 
6
5
  module PgParty
7
6
  module Model
@@ -6,15 +6,15 @@ module PgParty
6
6
  module Model
7
7
  module SharedMethods
8
8
  def reset_primary_key
9
- return base_class.primary_key if self != base_class
9
+ return (@primary_key = base_class.primary_key) if self != base_class
10
10
 
11
11
  partitions = partitions(include_subpartitions: PgParty.config.include_subpartitions_in_partition_list)
12
- return get_primary_key(base_class.name) if partitions.empty?
12
+ return (@primary_key = get_primary_key(base_class.name)) if partitions.empty?
13
13
 
14
14
  first_partition = partitions.detect { |p| !connection.table_partitioned?(p) }
15
15
  raise 'No leaf partitions exist for this model. Create a partition to contain your data' unless first_partition
16
16
 
17
- in_partition(first_partition).get_primary_key(base_class.name)
17
+ (@primary_key = in_partition(first_partition).get_primary_key(base_class.name))
18
18
  end
19
19
 
20
20
  def table_exists?
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PgParty
4
- VERSION = "1.7.0"
4
+ VERSION = "1.8.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pg_party
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.0
4
+ version: 1.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Krage
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-10-10 00:00:00.000000000 Z
11
+ date: 2024-08-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: '6.1'
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '7.2'
22
+ version: '8.0'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,21 +29,7 @@ dependencies:
29
29
  version: '6.1'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '7.2'
33
- - !ruby/object:Gem::Dependency
34
- name: ruby2_keywords
35
- requirement: !ruby/object:Gem::Requirement
36
- requirements:
37
- - - "~>"
38
- - !ruby/object:Gem::Version
39
- version: 0.0.2
40
- type: :runtime
41
- prerelease: false
42
- version_requirements: !ruby/object:Gem::Requirement
43
- requirements:
44
- - - "~>"
45
- - !ruby/object:Gem::Version
46
- version: 0.0.2
32
+ version: '8.0'
47
33
  - !ruby/object:Gem::Dependency
48
34
  name: parallel
49
35
  requirement: !ruby/object:Gem::Requirement