pg_party 0.5.1 → 0.6.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 +4 -4
- data/README.md +1 -1
- data/lib/pg_party/adapter_decorator.rb +2 -2
- data/lib/pg_party/model_decorator.rb +22 -21
- data/lib/pg_party/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f6b56b604caac2da35b9df72f1a43f1ac5464972
|
4
|
+
data.tar.gz: 468454403e514a160bdc8d4eaeb1f3c5cfdd324b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c5e035dbee595f7a77fc8312618164f8abc4b4958263c37d827b9b43667f67f212361cd1b26318d8701c3dde333f3024fd826a53f3b451a9cb51e27e233dea2
|
7
|
+
data.tar.gz: 196494724549d32744fdd76ff393a3afbf28d33b6db73219b275804b289fbe4dd847cb32bbb43e4be0a4c5b4e4973bd3c4db3d21b1570102b1e61b573e15d628
|
data/README.md
CHANGED
@@ -189,7 +189,7 @@ SomeRangeRecord.partitions
|
|
189
189
|
SomeListRecord.partitions
|
190
190
|
```
|
191
191
|
|
192
|
-
|
192
|
+
Retrieve ActiveRecord model class scoped to a child partition:
|
193
193
|
|
194
194
|
```ruby
|
195
195
|
SomeRangeRecord.in_partition(:some_range_records_partition_name)
|
@@ -140,8 +140,8 @@ module PgParty
|
|
140
140
|
__getobj__.send(:postgresql_version) >= 100000
|
141
141
|
end
|
142
142
|
|
143
|
-
def index_name(table_name,
|
144
|
-
"index_#{table_name}_on_#{
|
143
|
+
def index_name(table_name, key)
|
144
|
+
"index_#{table_name}_on_#{key.to_s.split("::").join("_")}"
|
145
145
|
end
|
146
146
|
end
|
147
147
|
end
|
@@ -3,8 +3,8 @@ module PgParty
|
|
3
3
|
def partition_primary_key
|
4
4
|
if self != base_class
|
5
5
|
base_class.primary_key
|
6
|
-
elsif
|
7
|
-
|
6
|
+
elsif partition_name = partitions.first
|
7
|
+
in_partition(partition_name).get_primary_key(base_class.name)
|
8
8
|
else
|
9
9
|
get_primary_key(base_class.name)
|
10
10
|
end
|
@@ -17,7 +17,26 @@ module PgParty
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def in_partition(table_name)
|
20
|
-
|
20
|
+
Class.new(__getobj__) do
|
21
|
+
self.table_name = table_name
|
22
|
+
|
23
|
+
# to avoid argument errors when calling model_name
|
24
|
+
def self.name
|
25
|
+
superclass.name
|
26
|
+
end
|
27
|
+
|
28
|
+
# when returning records from a query, Rails
|
29
|
+
# allocates objects first, then initializes
|
30
|
+
def self.allocate
|
31
|
+
superclass.allocate
|
32
|
+
end
|
33
|
+
|
34
|
+
# creating and persisting new records from a child partition
|
35
|
+
# will ultimately insert into the parent partition table
|
36
|
+
def self.new(*args, &blk)
|
37
|
+
superclass.new(*args, &blk)
|
38
|
+
end
|
39
|
+
end
|
21
40
|
end
|
22
41
|
|
23
42
|
def partition_key_eq(value)
|
@@ -73,24 +92,6 @@ module PgParty
|
|
73
92
|
end
|
74
93
|
end
|
75
94
|
|
76
|
-
def child_class(table_name)
|
77
|
-
Class.new(__getobj__) do
|
78
|
-
self.table_name = table_name
|
79
|
-
|
80
|
-
# when returning records from a query, Rails
|
81
|
-
# allocates objects first, then initializes
|
82
|
-
def self.allocate
|
83
|
-
superclass.allocate
|
84
|
-
end
|
85
|
-
|
86
|
-
# not sure if this will ever get called,
|
87
|
-
# but probably a good idea to have
|
88
|
-
def self.new(*args, &blk)
|
89
|
-
superclass.new(*args, &blk)
|
90
|
-
end
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
95
|
def partition_key_as_arel
|
95
96
|
arel_column = arel_table[partition_column]
|
96
97
|
|
data/lib/pg_party/version.rb
CHANGED
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: 0.
|
4
|
+
version: 0.6.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: 2017-10-
|
11
|
+
date: 2017-10-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -239,7 +239,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
239
239
|
version: 1.8.11
|
240
240
|
requirements: []
|
241
241
|
rubyforge_project:
|
242
|
-
rubygems_version: 2.
|
242
|
+
rubygems_version: 2.6.11
|
243
243
|
signing_key:
|
244
244
|
specification_version: 4
|
245
245
|
summary: ActiveRecord PostgreSQL Partitioning
|