sliding_partition 0.2.0 → 0.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/lib/sliding_partition/identity.rb +1 -1
- data/lib/sliding_partition/partition_ddl_changer.rb +17 -14
- 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: 60a930fe3a691eb3e9ddd4dd74d6719a264232d5
|
4
|
+
data.tar.gz: 576af132477c22d38afc7948df0d170a0c95a36a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7f98cde8a0c07ba0e749e6449f11cd460a752e9ff0ea77f5fdfe39f8446ad601eadabf3408388111b0cc3db153a968cad9224071cac5e2766df6575c9dfb3f53
|
7
|
+
data.tar.gz: 03e0310746fcdcd74807f6fbaad099d9f8f66c50dfafde2d92f1f5fa84a499cb218b749556bea666f395b4fff65e91c7233e59ffdda17bd521c2af8777c49ddb
|
@@ -14,22 +14,29 @@ module SlidingPartition
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def setup!
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
connection.transaction do
|
18
|
+
create_tables!
|
19
|
+
update_trigger_function!
|
20
|
+
create_trigger!
|
21
|
+
end
|
20
22
|
end
|
21
23
|
|
22
24
|
def rotate!
|
23
|
-
|
24
|
-
|
25
|
-
|
25
|
+
connection.transaction do
|
26
|
+
create_tables!
|
27
|
+
expire_tables!
|
28
|
+
update_trigger_function!
|
29
|
+
end
|
26
30
|
end
|
27
31
|
|
28
32
|
def migrate!
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
+
connection.transaction do
|
34
|
+
clone_new_table!
|
35
|
+
update_trigger_function!
|
36
|
+
swap_tables!
|
37
|
+
setup!
|
38
|
+
migrate_data!(from: retired_table, to: parent_table)
|
39
|
+
end
|
33
40
|
end
|
34
41
|
|
35
42
|
def create_tables!
|
@@ -54,10 +61,8 @@ module SlidingPartition
|
|
54
61
|
|
55
62
|
def swap_tables!
|
56
63
|
connection.execute <<-SQL
|
57
|
-
BEGIN;
|
58
64
|
ALTER TABLE #{parent_table} RENAME TO #{retired_table};
|
59
65
|
ALTER TABLE #{new_table} RENAME TO #{parent_table};
|
60
|
-
COMMIT;
|
61
66
|
SQL
|
62
67
|
create_trigger!
|
63
68
|
end
|
@@ -94,12 +99,10 @@ module SlidingPartition
|
|
94
99
|
|
95
100
|
def create_trigger!
|
96
101
|
connection.execute(<<-SQL)
|
97
|
-
BEGIN;
|
98
102
|
DROP TRIGGER IF EXISTS #{inherited_table_name}_trigger ON #{inherited_table_name};
|
99
103
|
CREATE TRIGGER #{inherited_table_name}_trigger
|
100
104
|
BEFORE INSERT ON #{inherited_table_name}
|
101
105
|
FOR EACH ROW EXECUTE PROCEDURE #{inherited_table_name}_insert_trigger();
|
102
|
-
COMMIT;
|
103
106
|
SQL
|
104
107
|
|
105
108
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sliding_partition
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paul Sadauskas
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-03-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -280,7 +280,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
280
280
|
version: '0'
|
281
281
|
requirements: []
|
282
282
|
rubyforge_project:
|
283
|
-
rubygems_version: 2.6.
|
283
|
+
rubygems_version: 2.6.11
|
284
284
|
signing_key:
|
285
285
|
specification_version: 4
|
286
286
|
summary: ''
|