active_partition 0.1.0 → 0.2.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/bin/console +1 -0
- data/lib/active_partition/version.rb +1 -1
- data/lib/active_partition.rb +5 -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: 2f9a675008e38b58080b6c3e350a2141be7275e5ca153500340a1f0f759e1442
|
4
|
+
data.tar.gz: 58a64de3dd865b634baf1fd3999203c75f4007d046e68818ab92c382b6c54b98
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 180a0215bb89ef08a3fb3ab38490ad89335419ec9fd1b4026026ef008e1fefcd02dc4ccfcb8e9c0e16c231aa7193119d32520b1fe87cd70e0448a613fb1871f1
|
7
|
+
data.tar.gz: 2e014eabe0b6b129f062ac5c7341b4819fc87e9e5206479b6b3630945b8b220bfd2a0c30591ab44b7f23b982829dd0dcb5714215ac962384311efc490c57a862
|
data/bin/console
CHANGED
data/lib/active_partition.rb
CHANGED
@@ -14,7 +14,11 @@ module ActivePartition
|
|
14
14
|
extend ActiveSupport::Concern
|
15
15
|
|
16
16
|
included do
|
17
|
-
|
17
|
+
# when partitioned column change, create partition if needed
|
18
|
+
before_save :create_partition_if_needed, if: -> {
|
19
|
+
self.class.partitioned_by &&
|
20
|
+
attribute_changed?(self.class.partitioned_by.to_s)
|
21
|
+
}
|
18
22
|
|
19
23
|
def create_partition_if_needed
|
20
24
|
# get partitioned attribute value
|