pg_partitioner 0.7.0 → 0.7.2

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: 5cfb29fd8934e56c5ede73e05b301f5fe56f638addfe8c8173475bc07fb54dcd
4
- data.tar.gz: b0a9bb4f7183283fb979026ffb0f56478f2b17574efb4050fe502ca2d78ef59c
3
+ metadata.gz: 9241b700143255bfd6e7c7884282ec694e63770808dc281112100862ab31fc9e
4
+ data.tar.gz: 870cb897406e2c56cafeeb8605957d7d233bc2af50313b2ac6cef6ee806dde28
5
5
  SHA512:
6
- metadata.gz: 2c541e52f227979b2dfc958f200d6dccb3bafec5fec4d96d6e0e48ccc75b31af385fea2897302d1a116a84025a093fb3f8c8a481df8334f3a1ba2eea65114122
7
- data.tar.gz: 15086b751b086d43bff24cd7f4a01c7e5b1dfcb3f81370cdc81cd6d84dd2930e3e27e31ccae73d468c17b95abca58934394efe7293e6f321c451c1b27217cbf6
6
+ metadata.gz: '0738eaeb102ee399f008dd232fecb1d233f9a028651f40b38d5762bfc56fa8a8d3d4be8fad543b221b5cfffe0a576b8f85048aec1393d624221ca96eb5895cd4'
7
+ data.tar.gz: 431cdf7f65c91d58f06a552d4f708a9953fad178264297f63828a633a084587cedf1e1a31f03a0fa6c26d2943ae7cea5e6dd7b87c2e97edfb97865d8014301c0
data/README.md CHANGED
@@ -115,3 +115,9 @@ or
115
115
  ```ruby
116
116
  YourModel.create_next_quater_table
117
117
  ```
118
+
119
+ 4) You can get all partition table names for your model:
120
+
121
+ ```ruby
122
+ YourModel.partition_table_names
123
+ ```
@@ -21,6 +21,8 @@ module PgPartitioner
21
21
 
22
22
  custom_indexes.each do |custom_index|
23
23
  if custom_index.is_a?(Hash)
24
+ name = custom_index[:name]
25
+ custom_index[:name] = "index_#{partition_table_name}_#{name}" if name
24
26
  create_custom_index(partition_table_name, custom_index[:fields], **custom_index.except(:fields))
25
27
  else
26
28
  create_custom_index(partition_table_name, custom_index)
@@ -71,6 +73,17 @@ module PgPartitioner
71
73
  end
72
74
  end
73
75
  end
76
+
77
+ def partition_table_names
78
+ sql = "SELECT child.relname
79
+ FROM pg_inherits
80
+ JOIN pg_class parent ON pg_inherits.inhparent = parent.oid
81
+ JOIN pg_class child ON pg_inherits.inhrelid = child.oid
82
+ WHERE parent.relname = '#{table_name}'
83
+ ORDER BY child.relname;"
84
+
85
+ execute_sql(sql).map { |row| row['relname'] }
86
+ end
74
87
  end
75
88
  end
76
89
  end
@@ -1,3 +1,3 @@
1
1
  module PartitionerPg
2
- VERSION = '0.7.0'
2
+ VERSION = '0.7.2'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pg_partitioner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ovsapyan Mishel
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-04-02 00:00:00.000000000 Z
11
+ date: 2026-07-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler