postqueue 0.6.0 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ad1cc078033356ab3276d5360da442f64c42fc6b
4
- data.tar.gz: a79c30543676b7c62679a99d1f9c4380979b9b7a
3
+ metadata.gz: 0ab5c97e45f6171bf141d58d1cd8ce8c5524f5b2
4
+ data.tar.gz: 0a1b8ef785008bec26a6907024617a4ef4a82a3e
5
5
  SHA512:
6
- metadata.gz: 09b7f4b6c07b3eaf17acef7863ee6f940f0f67906d8f4cb112ffad19a46dd1fba7ea9c678f6c5dc418d1170bfa5be67a0600bff1b77454113788ac913ae23b88
7
- data.tar.gz: 02b7c4d09582a202a56d12e7fd810da1f1f5334cbd726eb4db2d15cd8fc06b19aeb992c144ae61f050cc50dd46928c901526d9ee40ed5f1e8f804b2925e8bcdf
6
+ metadata.gz: 31fad4af31402d2084e07c0b60baa14bce82a53efba6714056956f52da1360cfd5b92a6a0f6599789f687290ec743f867604346c4bc7a16c930aa52a69071585
7
+ data.tar.gz: a7c2117c1abdee7840cfa66714e99ad15bd8a02456454d4f4d44ce9a00e019df5224e722c7e4f415116331bb3c3e2a08bb14b77d0204dd9c51a0941dcaaa305a
data/README.md CHANGED
@@ -57,6 +57,8 @@ class AddPostqueue < ActiveRecord::Migration
57
57
  end
58
58
  ```
59
59
 
60
+ Note: it should be safe to migrate! multiple times.
61
+
60
62
  ### Configuring Postqueue
61
63
 
62
64
  The postqueue configuration descrives all possible operations and their features:
@@ -22,10 +22,28 @@ module Postqueue
22
22
  SQL
23
23
  end
24
24
 
25
+ def self.upgrade_table!(table_name)
26
+ # upgrade id column to use BIGINT if necessary
27
+ id_max = Item.column_types['id'].send(:range).end
28
+ if id_max <= 2147483648
29
+ STDERR.puts "Changing type of #{table_name}.id column to BIGINT"
30
+ Item.connection.execute "ALTER TABLE #{table_name} ALTER COLUMN id TYPE BIGINT"
31
+ Item.connection.execute "ALTER SEQUENCE #{table_name}_id_seq RESTART WITH 2147483649"
32
+ Item.reset_column_information
33
+ end
34
+ end
35
+
25
36
  def self.migrate!(table_name = "postqueue")
26
- Item.connection.execute <<-SQL
37
+ connection = Item.connection
38
+
39
+ if connection.tables.include?(table_name)
40
+ upgrade_table!(table_name)
41
+ return
42
+ end
43
+
44
+ connection.execute <<-SQL
27
45
  CREATE TABLE #{table_name} (
28
- id SERIAL PRIMARY KEY,
46
+ id BIGSERIAL PRIMARY KEY,
29
47
  op VARCHAR,
30
48
  entity_id INTEGER NOT NULL DEFAULT 0,
31
49
  created_at timestamp without time zone NOT NULL DEFAULT (now() at time zone 'utc'),
@@ -1,3 +1,3 @@
1
1
  module Postqueue
2
- VERSION = "0.6.0"
2
+ VERSION = "0.6.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: postqueue
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - radiospiel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-18 00:00:00.000000000 Z
11
+ date: 2017-05-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec