pg_partitioner 0.4.0 → 0.4.2
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/pg_partitioner/separation_type/month.rb +5 -1
- data/lib/pg_partitioner/version.rb +1 -1
- data/lib/pg_partitioner.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 689dd926b67b28f269e37e4f48636f39ef8c530128c54db49b0fb6285da82cf6
|
4
|
+
data.tar.gz: 8f83d7aea279895b92d3749185705cb1abe39479d9e5e6c6db2a2892aefa4186
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 85cab0c5003fabf3f3cdbe781720b81401a8d627c4e3189968f87e54eed821cf1507d03f1affec5a06c89fa07beed156669ddbc1c95eac4592fe25fc4fddc4d5
|
7
|
+
data.tar.gz: 0f44078f7d2d7e42af1f8a19262f85ec029ff62c7c39b1251a0e063cd1a8ea954e5582b1254799a868c4b5ea29ad4dbba21e30823a0e1b17e485ae3da241c41f
|
@@ -17,6 +17,8 @@ module PgPartitioner
|
|
17
17
|
date_start = date.at_beginning_of_month
|
18
18
|
date_end = date.at_beginning_of_month.next_month
|
19
19
|
partition_table_name = name_of_partition_table(date)
|
20
|
+
return 'Already exists' if connection.table_exists? partition_table_name
|
21
|
+
|
20
22
|
sql = "CREATE TABLE IF NOT EXISTS #{partition_table_name} (
|
21
23
|
CHECK ( #{parting_column} >= DATE('#{date_start}') AND #{parting_column} < DATE('#{date_end}') )
|
22
24
|
) INHERITS (#{table_name});"
|
@@ -78,10 +80,12 @@ module PgPartitioner
|
|
78
80
|
end
|
79
81
|
|
80
82
|
def drop_partitioning_by_month_trigger_sql
|
81
|
-
"DROP TRIGGER #{table_name}_insert ON #{table_name};
|
83
|
+
sql = "DROP TRIGGER #{table_name}_insert ON #{table_name};
|
82
84
|
DROP FUNCTION #{table_name}_insert_trigger();
|
83
85
|
DROP TRIGGER #{table_name}_after_insert ON #{table_name};
|
84
86
|
DROP FUNCTION #{table_name}_delete_trigger();"
|
87
|
+
|
88
|
+
execute_sql(sql)
|
85
89
|
end
|
86
90
|
|
87
91
|
def create_partition_indexes(partition_table_name)
|
data/lib/pg_partitioner.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pg_partitioner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ovsapyan Mishel
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-03-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|