pg_party 0.4.1 → 0.4.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 +4 -4
- data/README.md +7 -5
- data/lib/pg_party/model_decorator.rb +12 -0
- data/lib/pg_party/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 85fa2f5792258d5519df5df148eab1fce17d2f3a
|
|
4
|
+
data.tar.gz: f1881d32c2ba397dc1fc4ae99304480ee2234eed
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9f15450a444d4611195a21463b26e2fdcf840598e4893593df832f53ada93d9641e5935c8591c45f536dfb41a682e944a254b3a6e4b5e08f600ba46fdfff85b5
|
|
7
|
+
data.tar.gz: bf3c288225c95debf9c1e10060ed1c9b41eb96ec55f2d1d86931fadb0290acda0c758a8815c9b6927f0f7d144483595710f62e30736ad37bcf5354bf22d4b02d
|
data/README.md
CHANGED
|
@@ -11,9 +11,13 @@
|
|
|
11
11
|
[ActiveRecord](http://guides.rubyonrails.org/active_record_basics.html) migrations and model helpers for creating and managing [PostgreSQL 10 partitions](https://www.postgresql.org/docs/10/static/ddl-partitioning.html)!
|
|
12
12
|
|
|
13
13
|
Features:
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
14
|
+
- Migration methods for partition specific database operations
|
|
15
|
+
- Model methods for querying partitioned data
|
|
16
|
+
- Model methods for creating adhoc partitions
|
|
17
|
+
|
|
18
|
+
Limitations:
|
|
19
|
+
- Partition tables are not represented correctly in `db/schema.rb` — please use the `:sql` schema format
|
|
20
|
+
- Only single column partition keys supported (e.g., `column`, `column::cast`)
|
|
17
21
|
|
|
18
22
|
## Installation
|
|
19
23
|
|
|
@@ -184,10 +188,8 @@ SomeListRecord.partitions
|
|
|
184
188
|
Query for records by partition name:
|
|
185
189
|
|
|
186
190
|
```ruby
|
|
187
|
-
# returns a collection of anonymous ActiveRecord::Base subclassed instances
|
|
188
191
|
SomeRangeRecord.in_partition(:some_range_records_partition_name)
|
|
189
192
|
|
|
190
|
-
# returns a collection of anonymous ActiveRecord::Base subclassed instances
|
|
191
193
|
SomeListRecord.in_partition(:some_list_records_partition_name)
|
|
192
194
|
```
|
|
193
195
|
|
|
@@ -54,6 +54,18 @@ module PgParty
|
|
|
54
54
|
def child_class(table_name)
|
|
55
55
|
Class.new(__getobj__) do
|
|
56
56
|
self.table_name = table_name
|
|
57
|
+
|
|
58
|
+
# when returning records from a query, Rails
|
|
59
|
+
# allocates objects first, then initializes
|
|
60
|
+
def self.allocate
|
|
61
|
+
superclass.allocate
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
# not sure if this will ever get called,
|
|
65
|
+
# but probably a good idea to have
|
|
66
|
+
def self.new(*args, &blk)
|
|
67
|
+
superclass.new(*args, &blk)
|
|
68
|
+
end
|
|
57
69
|
end
|
|
58
70
|
end
|
|
59
71
|
|
data/lib/pg_party/version.rb
CHANGED