ridgepole 1.0.4 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/ridgepole/ext/postgresql_adapter/partitioning.rb +19 -13
- data/lib/ridgepole/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8fd50f2c89f1cffa71ee02cf208bfe4d9b41ffefba5c9a93b164975a08a71687
|
4
|
+
data.tar.gz: f9ff68ec24ad420cbe070d769671721ac71fd3acf13322b3b340db07d4141f57
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 286bff861331444fdef459dd5063d7dfbb4007dd1b15a96efd38af1f95e65bf30f520ed5e2d9c0e87295516ee586f2742df78923304345db245fdd595f9599a7
|
7
|
+
data.tar.gz: 6e42ba5e0a2de5cfc2ce8f72179ac4ec41ddbacc27000d8906010d199556accd1348fa0b9d75fd0e322d9cbc5e3c12f07fdc28c8ee12b0db3355127ee837c299
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,10 @@
|
|
2
2
|
|
3
3
|
## 1.0
|
4
4
|
|
5
|
+
### 1.0.5 (2022/06/05)
|
6
|
+
|
7
|
+
* Support DEFAULT partition for PostgreSQL [pull#386](https://github.com/ridgepole/ridgepole/pull/386)
|
8
|
+
|
5
9
|
### 1.0.4 (2022/03/28)
|
6
10
|
|
7
11
|
* Add warning for generated column [pull#382](https://github.com/ridgepole/ridgepole/pull/382)
|
@@ -51,20 +51,24 @@ module Ridgepole
|
|
51
51
|
ORDER BY p.relname
|
52
52
|
SQL
|
53
53
|
|
54
|
-
partition_definitions = partition_info.map do |
|
55
|
-
values =
|
56
|
-
|
57
|
-
values = row[1].match(/FOR VALUES IN \((?<csv>.+)\)$/)[:csv].split(',').map(&:strip).map { |value| cast_value(value) }
|
58
|
-
{ in: Array.wrap(values) }
|
59
|
-
when :range
|
60
|
-
match = row[1].match(/FOR VALUES FROM \((?<from>.+)\) TO \((?<to>.+)\)/)
|
61
|
-
from = match[:from].split(',').map(&:strip).map { |value| cast_value(value) }
|
62
|
-
to = match[:to].split(',').map(&:strip).map { |value| cast_value(value) }
|
63
|
-
{ from: from, to: to }
|
54
|
+
partition_definitions = partition_info.map do |name, val_str|
|
55
|
+
values = if val_str == 'DEFAULT'
|
56
|
+
{ default: true }
|
64
57
|
else
|
65
|
-
|
58
|
+
case options[:type]
|
59
|
+
when :list
|
60
|
+
values = val_str.match(/FOR VALUES IN \((?<csv>.+)\)$/)[:csv].split(',').map(&:strip).map { |value| cast_value(value) }
|
61
|
+
{ in: Array.wrap(values) }
|
62
|
+
when :range
|
63
|
+
match = val_str.match(/FOR VALUES FROM \((?<from>.+)\) TO \((?<to>.+)\)/)
|
64
|
+
from = match[:from].split(',').map(&:strip).map { |value| cast_value(value) }
|
65
|
+
to = match[:to].split(',').map(&:strip).map { |value| cast_value(value) }
|
66
|
+
{ from: from, to: to }
|
67
|
+
else
|
68
|
+
raise NotImplementedError
|
69
|
+
end
|
66
70
|
end
|
67
|
-
{ name:
|
71
|
+
{ name: name, values: values }
|
68
72
|
end
|
69
73
|
|
70
74
|
ActiveRecord::ConnectionAdapters::PartitionOptions.new(table_name, options[:type], options[:columns], partition_definitions: partition_definitions)
|
@@ -97,7 +101,9 @@ module Ridgepole
|
|
97
101
|
|
98
102
|
# SchemaStatements
|
99
103
|
def add_partition(table_name, name:, values:)
|
100
|
-
condition = if values.key?(:
|
104
|
+
condition = if values.key?(:default)
|
105
|
+
'DEFAULT'
|
106
|
+
elsif values.key?(:in)
|
101
107
|
"FOR VALUES IN (#{values[:in].map { |v| quote_value(v) }.join(',')})"
|
102
108
|
elsif values.key?(:to)
|
103
109
|
from = values[:from].map { |v| quote_value(v) }.join(',')
|
data/lib/ridgepole/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ridgepole
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Genki Sugawara
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-06-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -342,7 +342,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
342
342
|
- !ruby/object:Gem::Version
|
343
343
|
version: '0'
|
344
344
|
requirements: []
|
345
|
-
rubygems_version: 3.
|
345
|
+
rubygems_version: 3.3.7
|
346
346
|
signing_key:
|
347
347
|
specification_version: 4
|
348
348
|
summary: Ridgepole is a tool to manage DB schema.
|