pg_party 0.7.2 → 0.7.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +18 -9
- data/lib/pg_party/adapter_decorator.rb +12 -0
- 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: 4b3cbb99316596bf151d53ef3d550d449e7f7853
|
4
|
+
data.tar.gz: 2f0185c8e5ae5b8928ae0c196eafe0b72dbca215
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a6a84178f454a81549f02ddd3e2871de48269a8ac86e6f1e68a6df8f8bd40cc8b85945e8914879a8a5543fc71257792d44cf0de0d20dda0c7b67fe0afcceac6
|
7
|
+
data.tar.gz: 1cb16eaf85e97774734eff7e316a404c3d6980e1d95932d6f145cef74f17db83f79e48cc264812c32ff696a135dc82c4f815f0f4624a4d176d416e85a5338e4c
|
data/README.md
CHANGED
@@ -2,15 +2,15 @@
|
|
2
2
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/pg_party.svg)][rubygems]
|
4
4
|
[![Build Status](https://circleci.com/gh/rkrage/pg_party.svg?&style=shield)][circle]
|
5
|
-
[![Code Climate](https://codeclimate.com/github/rkrage/pg_party/badges/gpa.svg)][climate]
|
6
|
-
[![Code Coverage](https://codeclimate.com/github/rkrage/pg_party/badges/coverage.svg)][coverage]
|
7
5
|
[![Dependency Status](https://gemnasium.com/badges/github.com/rkrage/pg_party.svg)][gemnasium]
|
6
|
+
[![Maintainability](https://api.codeclimate.com/v1/badges/c409453d2283dd440227/maintainability)][cc_maintainability]
|
7
|
+
[![Test Coverage](https://api.codeclimate.com/v1/badges/c409453d2283dd440227/test_coverage)][cc_coverage]
|
8
8
|
|
9
|
-
[rubygems]:
|
10
|
-
[circle]:
|
11
|
-
[
|
12
|
-
[
|
13
|
-
[
|
9
|
+
[rubygems]: https://rubygems.org/gems/pg_party
|
10
|
+
[circle]: https://circleci.com/gh/rkrage/pg_party/tree/master
|
11
|
+
[gemnasium]: https://gemnasium.com/github.com/rkrage/pg_party
|
12
|
+
[cc_maintainability]: https://codeclimate.com/github/rkrage/pg_party/maintainability
|
13
|
+
[cc_coverage]: https://codeclimate.com/github/rkrage/pg_party/test_coverage
|
14
14
|
|
15
15
|
[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)!
|
16
16
|
|
@@ -104,7 +104,13 @@ Attach an existing table to a range partition:
|
|
104
104
|
```ruby
|
105
105
|
class AttachRangePartition < ActiveRecord::Migration[5.1]
|
106
106
|
def up
|
107
|
-
|
107
|
+
current_date = Date.current
|
108
|
+
|
109
|
+
attach_range_partition \
|
110
|
+
:some_range_records,
|
111
|
+
:some_existing_table,
|
112
|
+
start_range: current_date,
|
113
|
+
end_range: current_date + 1.day
|
108
114
|
end
|
109
115
|
end
|
110
116
|
```
|
@@ -114,7 +120,10 @@ Attach an existing table to a list partition:
|
|
114
120
|
```ruby
|
115
121
|
class AttachListPartition < ActiveRecord::Migration[5.1]
|
116
122
|
def up
|
117
|
-
attach_list_partition
|
123
|
+
attach_list_partition \
|
124
|
+
:some_list_records,
|
125
|
+
:some_existing_table,
|
126
|
+
values: (200..300).to_a
|
118
127
|
end
|
119
128
|
end
|
120
129
|
```
|
@@ -133,6 +133,18 @@ module PgParty
|
|
133
133
|
child_table_name
|
134
134
|
end
|
135
135
|
|
136
|
+
# Rails 5.2 now returns boolean literals
|
137
|
+
# This causes partition creation to fail when the constraint clause includes a boolean
|
138
|
+
# Might be a PostgreSQL bug, but for now let's revert to the old quoting behavior
|
139
|
+
def quote(value)
|
140
|
+
case value
|
141
|
+
when true then "'t'"
|
142
|
+
when false then "'f'"
|
143
|
+
else
|
144
|
+
__getobj__.quote(value)
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
136
148
|
def quote_partition_key(key)
|
137
149
|
key.to_s.split("::").map(&method(:quote_column_name)).join("::")
|
138
150
|
end
|
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.7.
|
4
|
+
version: 0.7.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Krage
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-02-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -240,7 +240,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
240
240
|
version: 1.8.11
|
241
241
|
requirements: []
|
242
242
|
rubyforge_project:
|
243
|
-
rubygems_version: 2.
|
243
|
+
rubygems_version: 2.6.11
|
244
244
|
signing_key:
|
245
245
|
specification_version: 4
|
246
246
|
summary: ActiveRecord PostgreSQL Partitioning
|