pg_partitioner 0.4.1 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e4719f544121f8676abcbe5306730004a0aaf656ee91900358b1fe4a2fd9f267
4
- data.tar.gz: 5189fe8eaf6e09eee78b49bf0b443af8f78f7ab2ccb3f61f4a1b844c5299d93b
3
+ metadata.gz: 689dd926b67b28f269e37e4f48636f39ef8c530128c54db49b0fb6285da82cf6
4
+ data.tar.gz: 8f83d7aea279895b92d3749185705cb1abe39479d9e5e6c6db2a2892aefa4186
5
5
  SHA512:
6
- metadata.gz: fb60a6c18291ee2010b5b3774dbdaeba8809a1330116d679415f254a15279a04068eb8d6957ae239f992049e9d83e5fc1184cb1bf5fc32b82591f948bc1c9b0d
7
- data.tar.gz: 49b5da00fccf38cc3616486e06f14c13c17d019c23477c3a84299f789fa2c61dccbc4111a55c240c0691dbce8efc35ea30721f6e8a8a7d89a85353463c069546
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});"
@@ -1,3 +1,3 @@
1
1
  module PartitionerPg
2
- VERSION = '0.4.1'
2
+ VERSION = '0.4.2'
3
3
  end
@@ -26,7 +26,7 @@ module PgPartitioner
26
26
  private
27
27
 
28
28
  def execute_sql(sql_string)
29
- ActiveRecord::Base.connection.execute(sql_string)
29
+ connection.execute(sql_string)
30
30
  end
31
31
 
32
32
  def create_custom_index(table_name, index_fields, is_unique = false)
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.1
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: 2022-10-19 00:00:00.000000000 Z
11
+ date: 2023-03-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler