pg_party 1.0.0 → 1.3.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 +54 -1
- data/lib/pg_party.rb +24 -3
- data/lib/pg_party/adapter/postgresql_methods.rb +9 -8
- data/lib/pg_party/adapter_decorator.rb +3 -4
- data/lib/pg_party/cache.rb +50 -16
- data/lib/pg_party/config.rb +16 -0
- data/lib/pg_party/hacks/postgresql_database_tasks.rb +25 -0
- data/lib/pg_party/model/list_methods.rb +3 -2
- data/lib/pg_party/model/methods.rb +4 -4
- data/lib/pg_party/model/range_methods.rb +3 -2
- data/lib/pg_party/model/shared_methods.rb +10 -2
- data/lib/pg_party/model_decorator.rb +33 -26
- data/lib/pg_party/model_injector.rb +11 -5
- data/lib/pg_party/version.rb +1 -1
- metadata +42 -35
- data/lib/pg_party/hacks/schema_cache.rb +0 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee226c4523ca2b7099761ad517be99938078f7977281d88920beff47396f0c51
|
4
|
+
data.tar.gz: 2843ee1eb9fbe92e9998d8da0a3a20dfa989fa6c6dfcf3a261b80bac0caa47da
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6cb4e5e42f08dcca3ec065c5d73656b6075e5a647d60722607cb4a9ff3cfeee24a94f4048544f3442284c816e7e37fe196579b9037e1ddacaaf1136e440efd4a
|
7
|
+
data.tar.gz: fdb593463dace1bdcfd844cac214cb6e6489dc7cd533226b90d11e506955ff48ad959fa80320423f3485637f89e3f6dbaeec5812ec0c1f640eb2d620e91de6dc
|
data/README.md
CHANGED
@@ -48,6 +48,32 @@ $ gem install pg_party
|
|
48
48
|
Note that the gemspec does not require `pg`, as some model methods _may_ work for other databases.
|
49
49
|
Migration methods will be unavailable unless `pg` is installed.
|
50
50
|
|
51
|
+
## Configuration
|
52
|
+
|
53
|
+
These values can be accessed and set via `PgParty.config` and `PgParty.configure`.
|
54
|
+
|
55
|
+
- `caching`
|
56
|
+
- Whether to cache currently attached partitions and anonymous model classes
|
57
|
+
- Default: `true`
|
58
|
+
- `caching_ttl`
|
59
|
+
- Length of time (in seconds) that cache entries are considered valid
|
60
|
+
- Default: `-1` (never expire cache entries)
|
61
|
+
- `schema_exclude_partitions`
|
62
|
+
- Whether to exclude child partitions in `rake db:structure:dump`
|
63
|
+
- Default: `true`
|
64
|
+
|
65
|
+
Note that caching is done in-memory for each process of an application. Attaching / detaching partitions _will_ clear the cache, but only for the process that initiated the request. For multi-process web servers, it is recommended to use a TTL or disable caching entirely.
|
66
|
+
|
67
|
+
### Example
|
68
|
+
|
69
|
+
```ruby
|
70
|
+
# in a Rails initializer
|
71
|
+
PgParty.configure do |c|
|
72
|
+
c.caching_ttl = 60
|
73
|
+
c.schema_exclude_partitions = false
|
74
|
+
end
|
75
|
+
```
|
76
|
+
|
51
77
|
## Usage
|
52
78
|
|
53
79
|
### Migrations
|
@@ -170,6 +196,7 @@ end
|
|
170
196
|
Attach an existing table to a _range_ partitioned table:
|
171
197
|
|
172
198
|
```ruby
|
199
|
+
class AttachRangePartition < ActiveRecord::Migration[5.1]
|
173
200
|
def up
|
174
201
|
attach_range_partition \
|
175
202
|
:some_range_records,
|
@@ -324,9 +351,35 @@ SomeRangeRecord.in_partition(:some_range_records_partition_name)
|
|
324
351
|
SomeListRecord.in_partition(:some_list_records_partition_name)
|
325
352
|
```
|
326
353
|
|
354
|
+
To create _range_ partitions by month for previous, current and next months it's possible to use this example. To automate creation of partitions, run `Log.maintenance` every day with cron:
|
355
|
+
|
356
|
+
```ruby
|
357
|
+
class Log < ApplicationRecord
|
358
|
+
range_partition_by { '(created_at::date)' }
|
359
|
+
|
360
|
+
def self.maintenance
|
361
|
+
partitions = [Date.today.prev_month, Date.today, Date.today.next_month]
|
362
|
+
|
363
|
+
partitions.each do |day|
|
364
|
+
name = Log.partition_name_for(day)
|
365
|
+
next if ActiveRecord::Base.connection.table_exists?(name)
|
366
|
+
Log.create_partition(
|
367
|
+
name: name,
|
368
|
+
start_range: day.beginning_of_month,
|
369
|
+
end_range: day.next_month.beginning_of_month
|
370
|
+
)
|
371
|
+
end
|
372
|
+
end
|
373
|
+
|
374
|
+
def self.partition_name_for(day)
|
375
|
+
"logs_y#{day.year}_m#{day.month}"
|
376
|
+
end
|
377
|
+
end
|
378
|
+
```
|
379
|
+
|
327
380
|
For more examples, take a look at the model integration specs:
|
328
381
|
|
329
|
-
- https://github.com/rkrage/pg_party/tree/
|
382
|
+
- https://github.com/rkrage/pg_party/tree/master/spec/integration/model
|
330
383
|
|
331
384
|
## Development
|
332
385
|
|
data/lib/pg_party.rb
CHANGED
@@ -1,8 +1,28 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "pg_party/version"
|
4
|
+
require "pg_party/config"
|
5
|
+
require "pg_party/cache"
|
4
6
|
require "active_support"
|
5
7
|
|
8
|
+
module PgParty
|
9
|
+
@config = Config.new
|
10
|
+
@cache = Cache.new
|
11
|
+
|
12
|
+
class << self
|
13
|
+
attr_reader :config, :cache
|
14
|
+
|
15
|
+
def configure(&blk)
|
16
|
+
blk.call(config)
|
17
|
+
end
|
18
|
+
|
19
|
+
def reset
|
20
|
+
@config = Config.new
|
21
|
+
@cache = Cache.new
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
6
26
|
ActiveSupport.on_load(:active_record) do
|
7
27
|
require "pg_party/model/methods"
|
8
28
|
|
@@ -14,10 +34,11 @@ ActiveSupport.on_load(:active_record) do
|
|
14
34
|
PgParty::Adapter::AbstractMethods
|
15
35
|
)
|
16
36
|
|
17
|
-
require "
|
37
|
+
require "active_record/tasks/postgresql_database_tasks"
|
38
|
+
require "pg_party/hacks/postgresql_database_tasks"
|
18
39
|
|
19
|
-
ActiveRecord::
|
20
|
-
PgParty::Hacks::
|
40
|
+
ActiveRecord::Tasks::PostgreSQLDatabaseTasks.prepend(
|
41
|
+
PgParty::Hacks::PostgreSQLDatabaseTasks
|
21
42
|
)
|
22
43
|
|
23
44
|
begin
|
@@ -1,39 +1,40 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "pg_party/adapter_decorator"
|
4
|
+
require "ruby2_keywords"
|
4
5
|
|
5
6
|
module PgParty
|
6
7
|
module Adapter
|
7
8
|
module PostgreSQLMethods
|
8
|
-
def create_range_partition(*args, &blk)
|
9
|
+
ruby2_keywords def create_range_partition(*args, &blk)
|
9
10
|
PgParty::AdapterDecorator.new(self).create_range_partition(*args, &blk)
|
10
11
|
end
|
11
12
|
|
12
|
-
def create_list_partition(*args, &blk)
|
13
|
+
ruby2_keywords def create_list_partition(*args, &blk)
|
13
14
|
PgParty::AdapterDecorator.new(self).create_list_partition(*args, &blk)
|
14
15
|
end
|
15
16
|
|
16
|
-
def create_range_partition_of(*args)
|
17
|
+
ruby2_keywords def create_range_partition_of(*args)
|
17
18
|
PgParty::AdapterDecorator.new(self).create_range_partition_of(*args)
|
18
19
|
end
|
19
20
|
|
20
|
-
def create_list_partition_of(*args)
|
21
|
+
ruby2_keywords def create_list_partition_of(*args)
|
21
22
|
PgParty::AdapterDecorator.new(self).create_list_partition_of(*args)
|
22
23
|
end
|
23
24
|
|
24
|
-
def create_table_like(*args)
|
25
|
+
ruby2_keywords def create_table_like(*args)
|
25
26
|
PgParty::AdapterDecorator.new(self).create_table_like(*args)
|
26
27
|
end
|
27
28
|
|
28
|
-
def attach_range_partition(*args)
|
29
|
+
ruby2_keywords def attach_range_partition(*args)
|
29
30
|
PgParty::AdapterDecorator.new(self).attach_range_partition(*args)
|
30
31
|
end
|
31
32
|
|
32
|
-
def attach_list_partition(*args)
|
33
|
+
ruby2_keywords def attach_list_partition(*args)
|
33
34
|
PgParty::AdapterDecorator.new(self).attach_list_partition(*args)
|
34
35
|
end
|
35
36
|
|
36
|
-
def detach_partition(*args)
|
37
|
+
ruby2_keywords def detach_partition(*args)
|
37
38
|
PgParty::AdapterDecorator.new(self).detach_partition(*args)
|
38
39
|
end
|
39
40
|
end
|
@@ -1,7 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "digest"
|
4
|
-
require "pg_party/cache"
|
5
4
|
|
6
5
|
module PgParty
|
7
6
|
class AdapterDecorator < SimpleDelegator
|
@@ -61,7 +60,7 @@ module PgParty
|
|
61
60
|
DETACH PARTITION #{quote_table_name(child_table_name)}
|
62
61
|
SQL
|
63
62
|
|
64
|
-
PgParty
|
63
|
+
PgParty.cache.clear!
|
65
64
|
end
|
66
65
|
|
67
66
|
private
|
@@ -118,7 +117,7 @@ module PgParty
|
|
118
117
|
FOR VALUES #{constraint_clause}
|
119
118
|
SQL
|
120
119
|
|
121
|
-
PgParty
|
120
|
+
PgParty.cache.clear!
|
122
121
|
end
|
123
122
|
|
124
123
|
# Rails 5.2 now returns boolean literals
|
@@ -149,7 +148,7 @@ module PgParty
|
|
149
148
|
if key.is_a?(Proc)
|
150
149
|
key.call.to_s # very difficult to determine how to sanitize a complex expression
|
151
150
|
else
|
152
|
-
|
151
|
+
Array.wrap(key).map(&method(:quote_column_name)).join(",")
|
153
152
|
end
|
154
153
|
end
|
155
154
|
|
data/lib/pg_party/cache.rb
CHANGED
@@ -6,32 +6,66 @@ module PgParty
|
|
6
6
|
class Cache
|
7
7
|
LOCK = Mutex.new
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
def initialize
|
10
|
+
# automatically initialize a new hash when
|
11
|
+
# accessing an object id that doesn't exist
|
12
|
+
@store = Hash.new { |h, k| h[k] = { models: {}, partitions: nil } }
|
13
|
+
end
|
14
|
+
|
15
|
+
def clear!
|
16
|
+
LOCK.synchronize { @store.clear }
|
17
|
+
|
18
|
+
nil
|
19
|
+
end
|
20
|
+
|
21
|
+
def fetch_model(key, child_table, &block)
|
22
|
+
return block.call unless caching_enabled?
|
23
|
+
|
24
|
+
LOCK.synchronize { fetch_value(@store[key][:models], child_table.to_sym, block) }
|
25
|
+
end
|
26
|
+
|
27
|
+
def fetch_partitions(key, &block)
|
28
|
+
return block.call unless caching_enabled?
|
29
|
+
|
30
|
+
LOCK.synchronize { fetch_value(@store[key], :partitions, block) }
|
31
|
+
end
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
def caching_enabled?
|
36
|
+
PgParty.config.caching
|
37
|
+
end
|
38
|
+
|
39
|
+
def fetch_value(subhash, key, block)
|
40
|
+
entry = subhash[key]
|
12
41
|
|
13
|
-
|
42
|
+
if entry.nil? || entry.expired?
|
43
|
+
entry = Entry.new(block.call)
|
44
|
+
subhash[key] = entry
|
14
45
|
end
|
15
46
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
47
|
+
entry.value
|
48
|
+
end
|
49
|
+
|
50
|
+
class Entry
|
51
|
+
attr_reader :value
|
52
|
+
|
53
|
+
def initialize(value)
|
54
|
+
@value = value
|
55
|
+
@timestamp = Time.now
|
20
56
|
end
|
21
57
|
|
22
|
-
def
|
23
|
-
|
24
|
-
store[key][:partitions] ||= block.call
|
25
|
-
end
|
58
|
+
def expired?
|
59
|
+
ttl.positive? && Time.now - @timestamp > ttl
|
26
60
|
end
|
27
61
|
|
28
62
|
private
|
29
63
|
|
30
|
-
def
|
31
|
-
|
32
|
-
# accessing an object id that doesn't exist
|
33
|
-
@store ||= Hash.new { |h, k| h[k] = { models: {}, partitions: nil } }
|
64
|
+
def ttl
|
65
|
+
PgParty.config.caching_ttl
|
34
66
|
end
|
35
67
|
end
|
68
|
+
|
69
|
+
private_constant :Entry
|
36
70
|
end
|
37
71
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module PgParty
|
4
|
+
class Config
|
5
|
+
attr_accessor \
|
6
|
+
:caching,
|
7
|
+
:caching_ttl,
|
8
|
+
:schema_exclude_partitions
|
9
|
+
|
10
|
+
def initialize
|
11
|
+
@caching = true
|
12
|
+
@caching_ttl = -1
|
13
|
+
@schema_exclude_partitions = true
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module PgParty
|
4
|
+
module Hacks
|
5
|
+
module PostgreSQLDatabaseTasks
|
6
|
+
def run_cmd(cmd, args, action)
|
7
|
+
if action != "dumping" || !PgParty.config.schema_exclude_partitions
|
8
|
+
return super
|
9
|
+
end
|
10
|
+
|
11
|
+
partitions = begin
|
12
|
+
ActiveRecord::Base.connection.select_values(
|
13
|
+
"SELECT DISTINCT inhrelid::regclass::text FROM pg_inherits"
|
14
|
+
)
|
15
|
+
rescue
|
16
|
+
[]
|
17
|
+
end
|
18
|
+
|
19
|
+
excluded_tables = partitions.flat_map { |table| ["-T", "*.#{table}"] }
|
20
|
+
|
21
|
+
super(cmd, args + excluded_tables, action)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -1,15 +1,16 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "pg_party/model_decorator"
|
4
|
+
require "ruby2_keywords"
|
4
5
|
|
5
6
|
module PgParty
|
6
7
|
module Model
|
7
8
|
module ListMethods
|
8
|
-
def create_partition(*args)
|
9
|
+
ruby2_keywords def create_partition(*args)
|
9
10
|
PgParty::ModelDecorator.new(self).create_list_partition(*args)
|
10
11
|
end
|
11
12
|
|
12
|
-
def partition_key_in(*args)
|
13
|
+
ruby2_keywords def partition_key_in(*args)
|
13
14
|
PgParty::ModelDecorator.new(self).list_partition_key_in(*args)
|
14
15
|
end
|
15
16
|
end
|
@@ -5,12 +5,12 @@ require "pg_party/model_injector"
|
|
5
5
|
module PgParty
|
6
6
|
module Model
|
7
7
|
module Methods
|
8
|
-
def range_partition_by(key
|
9
|
-
PgParty::ModelInjector.new(self, key
|
8
|
+
def range_partition_by(*key, &blk)
|
9
|
+
PgParty::ModelInjector.new(self, *key, &blk).inject_range_methods
|
10
10
|
end
|
11
11
|
|
12
|
-
def list_partition_by(key
|
13
|
-
PgParty::ModelInjector.new(self, key
|
12
|
+
def list_partition_by(*key, &blk)
|
13
|
+
PgParty::ModelInjector.new(self, *key, &blk).inject_list_methods
|
14
14
|
end
|
15
15
|
|
16
16
|
def partitioned?
|
@@ -1,15 +1,16 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "pg_party/model_decorator"
|
4
|
+
require "ruby2_keywords"
|
4
5
|
|
5
6
|
module PgParty
|
6
7
|
module Model
|
7
8
|
module RangeMethods
|
8
|
-
def create_partition(*args)
|
9
|
+
ruby2_keywords def create_partition(*args)
|
9
10
|
PgParty::ModelDecorator.new(self).create_range_partition(*args)
|
10
11
|
end
|
11
12
|
|
12
|
-
def partition_key_in(*args)
|
13
|
+
ruby2_keywords def partition_key_in(*args)
|
13
14
|
PgParty::ModelDecorator.new(self).range_partition_key_in(*args)
|
14
15
|
end
|
15
16
|
end
|
@@ -6,11 +6,19 @@ module PgParty
|
|
6
6
|
module Model
|
7
7
|
module SharedMethods
|
8
8
|
def reset_primary_key
|
9
|
-
|
9
|
+
if self != base_class
|
10
|
+
base_class.primary_key
|
11
|
+
elsif partition_name = partitions.first
|
12
|
+
in_partition(partition_name).get_primary_key(base_class.name)
|
13
|
+
else
|
14
|
+
get_primary_key(base_class.name)
|
15
|
+
end
|
10
16
|
end
|
11
17
|
|
12
18
|
def table_exists?
|
13
|
-
|
19
|
+
target_table = partitions.first || table_name
|
20
|
+
|
21
|
+
connection.schema_cache.data_source_exists?(target_table)
|
14
22
|
end
|
15
23
|
|
16
24
|
def partitions
|
@@ -1,27 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "pg_party/cache"
|
4
|
-
|
5
3
|
module PgParty
|
6
4
|
class ModelDecorator < SimpleDelegator
|
7
|
-
def partition_primary_key
|
8
|
-
if self != base_class
|
9
|
-
base_class.primary_key
|
10
|
-
elsif partition_name = partitions.first
|
11
|
-
in_partition(partition_name).get_primary_key(base_class.name)
|
12
|
-
else
|
13
|
-
get_primary_key(base_class.name)
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
def partition_table_exists?
|
18
|
-
target_table = partitions.first || table_name
|
19
|
-
|
20
|
-
connection.schema_cache.data_source_exists?(target_table)
|
21
|
-
end
|
22
|
-
|
23
5
|
def in_partition(child_table_name)
|
24
|
-
PgParty
|
6
|
+
PgParty.cache.fetch_model(cache_key, child_table_name) do
|
25
7
|
Class.new(__getobj__) do
|
26
8
|
self.table_name = child_table_name
|
27
9
|
|
@@ -41,6 +23,11 @@ module PgParty
|
|
41
23
|
def self.new(*args, &blk)
|
42
24
|
superclass.new(*args, &blk)
|
43
25
|
end
|
26
|
+
|
27
|
+
# to avoid unnecessary db lookups
|
28
|
+
def self.partitions
|
29
|
+
[]
|
30
|
+
end
|
44
31
|
end
|
45
32
|
end
|
46
33
|
end
|
@@ -49,7 +36,7 @@ module PgParty
|
|
49
36
|
if complex_partition_key
|
50
37
|
complex_partition_key_query("(#{partition_key}) = (?)", value)
|
51
38
|
else
|
52
|
-
|
39
|
+
where_partition_key(:eq, value)
|
53
40
|
end
|
54
41
|
end
|
55
42
|
|
@@ -61,9 +48,9 @@ module PgParty
|
|
61
48
|
end_range
|
62
49
|
)
|
63
50
|
else
|
64
|
-
|
65
|
-
|
66
|
-
|
51
|
+
where_partition_key(:gteq, start_range).merge(
|
52
|
+
where_partition_key(:lt, end_range)
|
53
|
+
)
|
67
54
|
end
|
68
55
|
end
|
69
56
|
|
@@ -76,7 +63,7 @@ module PgParty
|
|
76
63
|
end
|
77
64
|
|
78
65
|
def partitions
|
79
|
-
PgParty
|
66
|
+
PgParty.cache.fetch_partitions(cache_key) do
|
80
67
|
connection.select_values(<<-SQL)
|
81
68
|
SELECT pg_inherits.inhrelid::regclass::text
|
82
69
|
FROM pg_tables
|
@@ -139,12 +126,32 @@ module PgParty
|
|
139
126
|
end
|
140
127
|
|
141
128
|
def complex_partition_key_query(clause, *interpolated_values)
|
142
|
-
subquery =
|
143
|
-
.unscoped
|
129
|
+
subquery = unscoped
|
144
130
|
.select("*")
|
145
131
|
.where(clause, *interpolated_values)
|
146
132
|
|
147
133
|
from(subquery, current_alias)
|
148
134
|
end
|
135
|
+
|
136
|
+
def where_partition_key(meth, values)
|
137
|
+
partition_key_array = Array.wrap(partition_key)
|
138
|
+
values = Array.wrap(values)
|
139
|
+
|
140
|
+
if partition_key_array.size != values.size
|
141
|
+
raise "number of provided values does not match the number of partition key columns"
|
142
|
+
end
|
143
|
+
|
144
|
+
arel_query = partition_key_array.zip(values).inject(nil) do |obj, (column, value)|
|
145
|
+
node = current_arel_table[column].send(meth, value)
|
146
|
+
|
147
|
+
if obj.nil?
|
148
|
+
node
|
149
|
+
else
|
150
|
+
obj.and(node)
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
where(arel_query)
|
155
|
+
end
|
149
156
|
end
|
150
157
|
end
|
@@ -2,9 +2,10 @@
|
|
2
2
|
|
3
3
|
module PgParty
|
4
4
|
class ModelInjector
|
5
|
-
def initialize(model, key)
|
5
|
+
def initialize(model, *key, &blk)
|
6
6
|
@model = model
|
7
|
-
@key = key
|
7
|
+
@key = key.flatten.compact
|
8
|
+
@key_blk = blk
|
8
9
|
end
|
9
10
|
|
10
11
|
def inject_range_methods
|
@@ -38,11 +39,16 @@ module PgParty
|
|
38
39
|
instance_predicate: false
|
39
40
|
)
|
40
41
|
|
41
|
-
if @
|
42
|
-
@model.partition_key = @
|
42
|
+
if @key_blk
|
43
|
+
@model.partition_key = @key_blk.call
|
43
44
|
@model.complex_partition_key = true
|
44
45
|
else
|
45
|
-
@
|
46
|
+
if @key.size == 1
|
47
|
+
@model.partition_key = @key.first
|
48
|
+
else
|
49
|
+
@model.partition_key = @key
|
50
|
+
end
|
51
|
+
|
46
52
|
@model.complex_partition_key = false
|
47
53
|
end
|
48
54
|
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: 1.
|
4
|
+
version: 1.3.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:
|
11
|
+
date: 2020-06-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -16,7 +16,7 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '5.0'
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
22
|
version: '6.1'
|
@@ -26,52 +26,52 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: '
|
29
|
+
version: '5.0'
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: '6.1'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
|
-
name:
|
34
|
+
name: ruby2_keywords
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
37
|
- - "~>"
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version:
|
40
|
-
type: :
|
39
|
+
version: 0.0.2
|
40
|
+
type: :runtime
|
41
41
|
prerelease: false
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
44
|
- - "~>"
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version:
|
46
|
+
version: 0.0.2
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
|
-
name:
|
48
|
+
name: appraisal
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
51
|
- - "~>"
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: '
|
53
|
+
version: '2.2'
|
54
54
|
type: :development
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
58
|
- - "~>"
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version: '
|
60
|
+
version: '2.2'
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
62
|
name: byebug
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
64
64
|
requirements:
|
65
65
|
- - "~>"
|
66
66
|
- !ruby/object:Gem::Version
|
67
|
-
version: '
|
67
|
+
version: '11.0'
|
68
68
|
type: :development
|
69
69
|
prerelease: false
|
70
70
|
version_requirements: !ruby/object:Gem::Requirement
|
71
71
|
requirements:
|
72
72
|
- - "~>"
|
73
73
|
- !ruby/object:Gem::Version
|
74
|
-
version: '
|
74
|
+
version: '11.0'
|
75
75
|
- !ruby/object:Gem::Dependency
|
76
76
|
name: combustion
|
77
77
|
requirement: !ruby/object:Gem::Requirement
|
@@ -92,112 +92,118 @@ dependencies:
|
|
92
92
|
requirements:
|
93
93
|
- - "~>"
|
94
94
|
- !ruby/object:Gem::Version
|
95
|
-
version: '1.
|
95
|
+
version: '1.7'
|
96
96
|
type: :development
|
97
97
|
prerelease: false
|
98
98
|
version_requirements: !ruby/object:Gem::Requirement
|
99
99
|
requirements:
|
100
100
|
- - "~>"
|
101
101
|
- !ruby/object:Gem::Version
|
102
|
-
version: '1.
|
102
|
+
version: '1.7'
|
103
103
|
- !ruby/object:Gem::Dependency
|
104
104
|
name: nokogiri
|
105
105
|
requirement: !ruby/object:Gem::Requirement
|
106
106
|
requirements:
|
107
|
-
- - "
|
107
|
+
- - ">="
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: 1.10.4
|
110
|
+
- - "<"
|
108
111
|
- !ruby/object:Gem::Version
|
109
|
-
version:
|
112
|
+
version: '2.0'
|
110
113
|
type: :development
|
111
114
|
prerelease: false
|
112
115
|
version_requirements: !ruby/object:Gem::Requirement
|
113
116
|
requirements:
|
114
|
-
- - "
|
117
|
+
- - ">="
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: 1.10.4
|
120
|
+
- - "<"
|
115
121
|
- !ruby/object:Gem::Version
|
116
|
-
version:
|
122
|
+
version: '2.0'
|
117
123
|
- !ruby/object:Gem::Dependency
|
118
124
|
name: pry-byebug
|
119
125
|
requirement: !ruby/object:Gem::Requirement
|
120
126
|
requirements:
|
121
127
|
- - "~>"
|
122
128
|
- !ruby/object:Gem::Version
|
123
|
-
version: '3.
|
129
|
+
version: '3.7'
|
124
130
|
type: :development
|
125
131
|
prerelease: false
|
126
132
|
version_requirements: !ruby/object:Gem::Requirement
|
127
133
|
requirements:
|
128
134
|
- - "~>"
|
129
135
|
- !ruby/object:Gem::Version
|
130
|
-
version: '3.
|
136
|
+
version: '3.7'
|
131
137
|
- !ruby/object:Gem::Dependency
|
132
138
|
name: rake
|
133
139
|
requirement: !ruby/object:Gem::Requirement
|
134
140
|
requirements:
|
135
141
|
- - "~>"
|
136
142
|
- !ruby/object:Gem::Version
|
137
|
-
version: '12.
|
143
|
+
version: '12.3'
|
138
144
|
type: :development
|
139
145
|
prerelease: false
|
140
146
|
version_requirements: !ruby/object:Gem::Requirement
|
141
147
|
requirements:
|
142
148
|
- - "~>"
|
143
149
|
- !ruby/object:Gem::Version
|
144
|
-
version: '12.
|
150
|
+
version: '12.3'
|
145
151
|
- !ruby/object:Gem::Dependency
|
146
152
|
name: rspec-its
|
147
153
|
requirement: !ruby/object:Gem::Requirement
|
148
154
|
requirements:
|
149
155
|
- - "~>"
|
150
156
|
- !ruby/object:Gem::Version
|
151
|
-
version: '1.
|
157
|
+
version: '1.3'
|
152
158
|
type: :development
|
153
159
|
prerelease: false
|
154
160
|
version_requirements: !ruby/object:Gem::Requirement
|
155
161
|
requirements:
|
156
162
|
- - "~>"
|
157
163
|
- !ruby/object:Gem::Version
|
158
|
-
version: '1.
|
164
|
+
version: '1.3'
|
159
165
|
- !ruby/object:Gem::Dependency
|
160
166
|
name: rspec-rails
|
161
167
|
requirement: !ruby/object:Gem::Requirement
|
162
168
|
requirements:
|
163
169
|
- - "~>"
|
164
170
|
- !ruby/object:Gem::Version
|
165
|
-
version: '3.
|
171
|
+
version: '3.8'
|
166
172
|
type: :development
|
167
173
|
prerelease: false
|
168
174
|
version_requirements: !ruby/object:Gem::Requirement
|
169
175
|
requirements:
|
170
176
|
- - "~>"
|
171
177
|
- !ruby/object:Gem::Version
|
172
|
-
version: '3.
|
178
|
+
version: '3.8'
|
173
179
|
- !ruby/object:Gem::Dependency
|
174
180
|
name: rspec_junit_formatter
|
175
181
|
requirement: !ruby/object:Gem::Requirement
|
176
182
|
requirements:
|
177
183
|
- - "~>"
|
178
184
|
- !ruby/object:Gem::Version
|
179
|
-
version: '0.
|
185
|
+
version: '0.4'
|
180
186
|
type: :development
|
181
187
|
prerelease: false
|
182
188
|
version_requirements: !ruby/object:Gem::Requirement
|
183
189
|
requirements:
|
184
190
|
- - "~>"
|
185
191
|
- !ruby/object:Gem::Version
|
186
|
-
version: '0.
|
192
|
+
version: '0.4'
|
187
193
|
- !ruby/object:Gem::Dependency
|
188
194
|
name: simplecov
|
189
195
|
requirement: !ruby/object:Gem::Requirement
|
190
196
|
requirements:
|
191
197
|
- - "~>"
|
192
198
|
- !ruby/object:Gem::Version
|
193
|
-
version:
|
199
|
+
version: 0.17.0
|
194
200
|
type: :development
|
195
201
|
prerelease: false
|
196
202
|
version_requirements: !ruby/object:Gem::Requirement
|
197
203
|
requirements:
|
198
204
|
- - "~>"
|
199
205
|
- !ruby/object:Gem::Version
|
200
|
-
version:
|
206
|
+
version: 0.17.0
|
201
207
|
- !ruby/object:Gem::Dependency
|
202
208
|
name: timecop
|
203
209
|
requirement: !ruby/object:Gem::Requirement
|
@@ -227,7 +233,8 @@ files:
|
|
227
233
|
- lib/pg_party/adapter/postgresql_methods.rb
|
228
234
|
- lib/pg_party/adapter_decorator.rb
|
229
235
|
- lib/pg_party/cache.rb
|
230
|
-
- lib/pg_party/
|
236
|
+
- lib/pg_party/config.rb
|
237
|
+
- lib/pg_party/hacks/postgresql_database_tasks.rb
|
231
238
|
- lib/pg_party/model/list_methods.rb
|
232
239
|
- lib/pg_party/model/methods.rb
|
233
240
|
- lib/pg_party/model/range_methods.rb
|
@@ -247,14 +254,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
247
254
|
requirements:
|
248
255
|
- - ">="
|
249
256
|
- !ruby/object:Gem::Version
|
250
|
-
version: 2.
|
257
|
+
version: 2.5.0
|
251
258
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
252
259
|
requirements:
|
253
260
|
- - ">="
|
254
261
|
- !ruby/object:Gem::Version
|
255
|
-
version:
|
262
|
+
version: '0'
|
256
263
|
requirements: []
|
257
|
-
rubygems_version: 3.
|
264
|
+
rubygems_version: 3.1.4
|
258
265
|
signing_key:
|
259
266
|
specification_version: 4
|
260
267
|
summary: ActiveRecord PostgreSQL Partitioning
|
@@ -1,13 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module PgParty
|
4
|
-
module Hacks
|
5
|
-
module SchemaCache
|
6
|
-
def self.included(base)
|
7
|
-
return if base.method_defined?(:data_source_exists?)
|
8
|
-
|
9
|
-
base.send(:alias_method, :data_source_exists?, :table_exists?)
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|