sequel-pgt_outbox 0.2.7 → 0.2.8
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/.release-please-manifest.json +1 -1
- data/.rubocop.yml +1 -1
- data/.version.txt +1 -1
- data/CHANGELOG.md +7 -0
- data/Readme.adoc +1 -1
- data/exe/outboxify +6 -1
- data/lib/sequel/pgt_outbox/function.rb +1 -0
- data/lib/sequel/pgt_outbox/table.rb +39 -0
- data/lib/sequel/pgt_outbox/trigger.rb +6 -2
- data/lib/sequel/pgt_outbox/version.rb +1 -1
- data/oci/Gemfile +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: 16704894edc6df1dfe645d4d088c7991135330b9af15d06fdf09829a06e4416a
|
|
4
|
+
data.tar.gz: 27b1d7009932651641f3c46a1bd09ad3654cb9dbb6530bffd2db34542f329d93
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c2b6a850c02ceab000179e7baa048b2440e0766f0a433af9992746b6eb4d5e07be0fa9b2874c698c3d7d9ebd7210fc7f8c2c6850564c0bf85d797615490a3142
|
|
7
|
+
data.tar.gz: a538a1057026ead9d373521ba3ace89d88993d87722927778b4c9ef15b78d3fc732c5a2097ea58dbd1461aca5a01190fd81cce86dc7189615494e100126a2be5
|
data/.rubocop.yml
CHANGED
data/.version.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.2.
|
|
1
|
+
0.2.8
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
## [Unreleased]
|
|
2
2
|
|
|
3
|
+
## [0.2.8](https://github.com/rubyists/sequel-pgt_outbox/compare/v0.2.7...v0.2.8) (2025-04-02)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* **trigger:** Adds REPLACE option to trigger creation, defaults to true ([#26](https://github.com/rubyists/sequel-pgt_outbox/issues/26)) ([abedbb2](https://github.com/rubyists/sequel-pgt_outbox/commit/abedbb2b8a2e7431903f678e583a17145dbff7bc))
|
|
9
|
+
|
|
3
10
|
## [0.2.7](https://github.com/rubyists/sequel-pgt_outbox/compare/v0.2.6...v0.2.7) (2025-02-16)
|
|
4
11
|
|
|
5
12
|
|
data/Readme.adoc
CHANGED
|
@@ -58,7 +58,7 @@ gem install sequel-pgt_outbox
|
|
|
58
58
|
|
|
59
59
|
=== Container
|
|
60
60
|
|
|
61
|
-
If you do not want to install the gem, you can use the provided
|
|
61
|
+
If you do not want to install the gem, you can use the provided OCI Container image,
|
|
62
62
|
available at the Rubyists Github {container-registry}.
|
|
63
63
|
|
|
64
64
|
## Usage
|
data/exe/outboxify
CHANGED
|
@@ -4,9 +4,13 @@
|
|
|
4
4
|
require 'sequel/pgt_outbox'
|
|
5
5
|
require 'optparse'
|
|
6
6
|
|
|
7
|
+
autovacuum = true
|
|
8
|
+
|
|
7
9
|
opts = OptionParser.new do |o|
|
|
8
10
|
o.banner = 'Usage: outboxify [options] <db uri> <table>'
|
|
11
|
+
o.on('--no-autovacuum') { autovacuum = false }
|
|
9
12
|
end
|
|
13
|
+
opts.parse!
|
|
10
14
|
|
|
11
15
|
db_uri = ARGV.shift
|
|
12
16
|
if db_uri.nil?
|
|
@@ -25,5 +29,6 @@ if table.nil?
|
|
|
25
29
|
exit 2
|
|
26
30
|
end
|
|
27
31
|
|
|
28
|
-
|
|
32
|
+
options = { autovacuum: }
|
|
33
|
+
function = DB.pgt_outbox_setup(table, **options)
|
|
29
34
|
DB.pgt_outbox_events(table, function)
|
|
@@ -28,6 +28,7 @@ module Rubyists
|
|
|
28
28
|
string_columns!
|
|
29
29
|
jsonb_columns!
|
|
30
30
|
indexes!
|
|
31
|
+
autovacuum_settings!
|
|
31
32
|
self
|
|
32
33
|
end
|
|
33
34
|
|
|
@@ -99,6 +100,30 @@ module Rubyists
|
|
|
99
100
|
@uuid_function ||= opts.fetch(:uuid_function, :uuid_generate_v4)
|
|
100
101
|
end
|
|
101
102
|
|
|
103
|
+
def autovacuum?
|
|
104
|
+
@autovacuum ||= opts.fetch(:autovacuum, true)
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
def autovacuum_vacuum_scale_factor
|
|
108
|
+
opts.fetch(:autovacuum_vacuum_scale_factor, 0)
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
def autovacuum_vacuum_threshold
|
|
112
|
+
opts.fetch(:autovacuum_vacuum_threshold, 50)
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
def autovacuum_analyze_scale_factor
|
|
116
|
+
opts.fetch(:autovacuum_analyze_scale_factor, 0)
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
def autovacuum_analyze_threshold
|
|
120
|
+
opts.fetch(:autovacuum_analyze_threshold, 50)
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
def autovacuum_vacuum_cost_delay
|
|
124
|
+
opts.fetch(:autovacuum_vacuum_cost_delay, 0)
|
|
125
|
+
end
|
|
126
|
+
|
|
102
127
|
def function
|
|
103
128
|
@function ||= Function.create!(self, opts:)
|
|
104
129
|
end
|
|
@@ -156,6 +181,20 @@ module Rubyists
|
|
|
156
181
|
db.add_index name, Sequel.desc(attempted_column)
|
|
157
182
|
self
|
|
158
183
|
end
|
|
184
|
+
|
|
185
|
+
def autovacuum_settings!
|
|
186
|
+
return unless autovacuum?
|
|
187
|
+
|
|
188
|
+
settings = {
|
|
189
|
+
autovacuum_vacuum_scale_factor: autovacuum_vacuum_scale_factor,
|
|
190
|
+
autovacuum_vacuum_threshold: autovacuum_vacuum_threshold,
|
|
191
|
+
autovacuum_analyze_scale_factor: autovacuum_analyze_scale_factor,
|
|
192
|
+
autovacuum_analyze_threshold: autovacuum_analyze_threshold,
|
|
193
|
+
autovacuum_vacuum_cost_delay: autovacuum_vacuum_cost_delay
|
|
194
|
+
}
|
|
195
|
+
db.run "ALTER TABLE #{quoted_name} SET (#{settings.map { |k, v| "#{k} = #{v}" }.join(", ")})"
|
|
196
|
+
self
|
|
197
|
+
end
|
|
159
198
|
end
|
|
160
199
|
end
|
|
161
200
|
end
|
|
@@ -6,7 +6,7 @@ module Rubyists
|
|
|
6
6
|
module PgtOutbox
|
|
7
7
|
# The Outbox Trigger
|
|
8
8
|
class Trigger
|
|
9
|
-
DEFAULT_OPTS = { after: true, each_row: true }.freeze
|
|
9
|
+
DEFAULT_OPTS = { after: true, each_row: true, replace: true }.freeze
|
|
10
10
|
|
|
11
11
|
attr_reader(*%i[db table function events opts])
|
|
12
12
|
|
|
@@ -27,7 +27,7 @@ module Rubyists
|
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
def create!
|
|
30
|
-
db.create_trigger(table, name, function,
|
|
30
|
+
db.create_trigger(table, name, function, after:, each_row:, events:, replace:, when: where)
|
|
31
31
|
self
|
|
32
32
|
end
|
|
33
33
|
|
|
@@ -43,6 +43,10 @@ module Rubyists
|
|
|
43
43
|
trigger_opts.fetch(:each_row)
|
|
44
44
|
end
|
|
45
45
|
|
|
46
|
+
def replace
|
|
47
|
+
trigger_opts.fetch(:replace)
|
|
48
|
+
end
|
|
49
|
+
|
|
46
50
|
def trigger_opts
|
|
47
51
|
@trigger_opts ||= DEFAULT_OPTS.merge(opts.fetch(:trigger_opts, {}))
|
|
48
52
|
end
|
data/oci/Gemfile
CHANGED
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: sequel-pgt_outbox
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.8
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- bougyman
|
|
8
8
|
bindir: exe
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date:
|
|
10
|
+
date: 2026-09-06 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: sequel_postgresql_triggers
|