ridgepole 1.0.5 → 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -1
- data/CHANGELOG.md +4 -0
- data/lib/ridgepole/delta.rb +4 -1
- data/lib/ridgepole/diff.rb +3 -1
- data/lib/ridgepole/dsl_parser.rb +3 -1
- data/lib/ridgepole/ext/abstract_mysql_adapter/partitioning.rb +2 -1
- data/lib/ridgepole/ext/postgresql_adapter/partitioning.rb +7 -1
- data/lib/ridgepole/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e42446dbd4e240dcb801dbd26b995e91d9afea59c52131d97e44d4242dd5cb7
|
4
|
+
data.tar.gz: a986057d2aefe29e1ac34f9e8e224eaea86efbf3d900ab095e9b55c1281fc34c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 899809c201c1fe7bed640dac621bb3e98edd4c2606f7107ce3faf4420de2e5ca5087f6499be4b1d66d55e58becd55d6746057033a7dc6b4ea58c3112deadf9c6
|
7
|
+
data.tar.gz: edf7a56bad1187f2e749205afb4c35bbf84b79476b6f00641d452714099374ca69c504425db29dc45b470e769b3cb8381aaa510cc8ca7d0b9cf233e39da7c3a6
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,10 @@
|
|
2
2
|
|
3
3
|
## 1.0
|
4
4
|
|
5
|
+
### 1.0.6 (2022/06/06)
|
6
|
+
|
7
|
+
* Support Hash partition for PostgreSQL [pull#387](https://github.com/ridgepole/ridgepole/pull/387)
|
8
|
+
|
5
9
|
### 1.0.5 (2022/06/05)
|
6
10
|
|
7
11
|
* Support DEFAULT partition for PostgreSQL [pull#386](https://github.com/ridgepole/ridgepole/pull/386)
|
data/lib/ridgepole/delta.rb
CHANGED
@@ -349,7 +349,10 @@ execute "ALTER TABLE #{ActiveRecord::Base.connection.quote_table_name(table_name
|
|
349
349
|
|
350
350
|
append_change_foreign_keys(table_name, foreign_keys, pre_buf_for_fk, post_buf_for_fk, @options) unless foreign_keys.empty?
|
351
351
|
|
352
|
-
|
352
|
+
if table_options || table_charset || table_collation
|
353
|
+
append_change_table_raw_options(table_name, table_options, table_charset, table_collation,
|
354
|
+
buf)
|
355
|
+
end
|
353
356
|
|
354
357
|
append_change_table_comment(table_name, table_comment, buf) if table_comment
|
355
358
|
|
data/lib/ridgepole/diff.rb
CHANGED
@@ -640,7 +640,9 @@ MSG
|
|
640
640
|
return
|
641
641
|
end
|
642
642
|
|
643
|
-
|
643
|
+
if from[:partition_definitions].present? && (to[:partition_definitions] & from[:partition_definitions]).empty?
|
644
|
+
raise "All partition is different. please check partition settings.to: #{to}, from: #{from}"
|
645
|
+
end
|
644
646
|
|
645
647
|
scan_partition_definition_chanage(from, to, table_delta)
|
646
648
|
end
|
data/lib/ridgepole/dsl_parser.rb
CHANGED
@@ -40,7 +40,9 @@ module Ridgepole
|
|
40
40
|
# NOTE: For composite primary keys, the first column of the primary key is used as the foreign key index
|
41
41
|
next if Array(attrs[:options][:primary_key]).first == fk_index
|
42
42
|
|
43
|
-
raise
|
43
|
+
raise("The column `#{fk_index}` of the table `#{table_name}` has a foreign key but no index." \
|
44
|
+
' Although InnoDB creates an index automatically,' \
|
45
|
+
' please add one explicitly in order for ridgepole to manage it.')
|
44
46
|
end
|
45
47
|
end
|
46
48
|
end
|
@@ -46,7 +46,8 @@ module Ridgepole
|
|
46
46
|
|
47
47
|
# SchemaStatements
|
48
48
|
def create_partition(table_name, type:, columns:, partition_definitions:)
|
49
|
-
execute schema_creation.accept(ActiveRecord::ConnectionAdapters::PartitionOptions.new(table_name, type, columns,
|
49
|
+
execute schema_creation.accept(ActiveRecord::ConnectionAdapters::PartitionOptions.new(table_name, type, columns,
|
50
|
+
partition_definitions: partition_definitions))
|
50
51
|
end
|
51
52
|
|
52
53
|
def add_partition(table_name, name:, values:)
|
@@ -64,6 +64,9 @@ module Ridgepole
|
|
64
64
|
from = match[:from].split(',').map(&:strip).map { |value| cast_value(value) }
|
65
65
|
to = match[:to].split(',').map(&:strip).map { |value| cast_value(value) }
|
66
66
|
{ from: from, to: to }
|
67
|
+
when :hash
|
68
|
+
match = val_str.match(/FOR VALUES WITH \(modulus (?<modulus>\d+), remainder (?<remainder>\d+)\)/)
|
69
|
+
{ modulus: match[:modulus].to_i, remainder: match[:remainder].to_i }
|
67
70
|
else
|
68
71
|
raise NotImplementedError
|
69
72
|
end
|
@@ -71,7 +74,8 @@ module Ridgepole
|
|
71
74
|
{ name: name, values: values }
|
72
75
|
end
|
73
76
|
|
74
|
-
ActiveRecord::ConnectionAdapters::PartitionOptions.new(table_name, options[:type], options[:columns],
|
77
|
+
ActiveRecord::ConnectionAdapters::PartitionOptions.new(table_name, options[:type], options[:columns],
|
78
|
+
partition_definitions: partition_definitions)
|
75
79
|
end
|
76
80
|
|
77
81
|
def cast_value(value)
|
@@ -109,6 +113,8 @@ module Ridgepole
|
|
109
113
|
from = values[:from].map { |v| quote_value(v) }.join(',')
|
110
114
|
to = values[:to].map { |v| quote_value(v) }.join(',')
|
111
115
|
"FOR VALUES FROM (#{from}) TO (#{to})"
|
116
|
+
elsif values.key?(:modulus)
|
117
|
+
"FOR VALUES WITH (modulus #{values[:modulus]}, remainder #{values[:remainder]})"
|
112
118
|
else
|
113
119
|
raise NotImplementedError
|
114
120
|
end
|
data/lib/ridgepole/version.rb
CHANGED