waldit 0.0.11 → 0.0.13
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/README.md +2 -2
- data/lib/waldit/context.rb +1 -5
- data/lib/waldit/migration.rb +1 -0
- data/lib/waldit/railtie.rb +10 -7
- data/lib/waldit/version.rb +1 -1
- data/lib/waldit/watcher.rb +0 -4
- data/lib/waldit.rb +0 -3
- data/rbi/waldit.rbi +1 -7
- 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: 5a382bdb2d4427340b4b241bd8589f6483834a8151192e0b42ce950005bfbdbf
|
4
|
+
data.tar.gz: 706162360063cac7d991348d3668a44f2a43c43a8011c77114977298a0115ef1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b60f858e58b3f260910e952d8a593224e04278996d696474aa19d2eaf8941dd1b7bdb1854c681d04883579038268d580ab6359c9186ac1f0e81eb2657d2bb063
|
7
|
+
data.tar.gz: 5b2df1ec44d3360390e56f6086ad666fa8b32040894bd056378ebc20a1bfb07aa1491b73382c4e721cacd122b751ebf511e86f13f6ac399d4265628cfdab46c5
|
data/README.md
CHANGED
@@ -31,11 +31,11 @@ Or install it yourself as:
|
|
31
31
|
|
32
32
|
1. **Configure your database adapter:**
|
33
33
|
|
34
|
-
First step is to configure in your `config/database.yml` and change your adapter to `
|
34
|
+
First step is to configure in your `config/database.yml` and change your adapter to `waldit`, which is a special adapter that allows injecting `waldit` contextual information on your transactions:
|
35
35
|
|
36
36
|
```yaml
|
37
37
|
default: &default
|
38
|
-
adapter:
|
38
|
+
adapter: waldit
|
39
39
|
# ...
|
40
40
|
```
|
41
41
|
|
data/lib/waldit/context.rb
CHANGED
@@ -16,11 +16,7 @@ module Waldit
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def add_context(added_context)
|
19
|
-
|
20
|
-
context.merge!(added_context.as_json)
|
21
|
-
else
|
22
|
-
new_context(added_context)
|
23
|
-
end
|
19
|
+
context&.merge!(added_context.as_json)
|
24
20
|
end
|
25
21
|
|
26
22
|
def new_context(context = {})
|
data/lib/waldit/migration.rb
CHANGED
@@ -24,6 +24,7 @@ module Waldit
|
|
24
24
|
|
25
25
|
add_index name, [:table_name, :primary_key, :transaction_id], unique: true
|
26
26
|
add_index name, [:transaction_id, :lsn]
|
27
|
+
add_index name, [:action, :table_name, :commited_at]
|
27
28
|
add_index name, :commited_at
|
28
29
|
add_index name, :context, using: :gin, opclass: :jsonb_path_ops
|
29
30
|
end
|
data/lib/waldit/railtie.rb
CHANGED
@@ -5,13 +5,16 @@ require "rails/railtie"
|
|
5
5
|
module Waldit
|
6
6
|
class Railtie < Rails::Railtie
|
7
7
|
config.before_configuration do
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
8
|
+
ActiveRecord::ConnectionAdapters.register(
|
9
|
+
"waldit",
|
10
|
+
"Waldit::PostgreSQLAdapter",
|
11
|
+
"waldit/postgresql_adapter",
|
12
|
+
)
|
13
|
+
|
14
|
+
ActiveRecord::Tasks::DatabaseTasks.register_task(
|
15
|
+
"waldit",
|
16
|
+
"ActiveRecord::Tasks::PostgreSQLDatabaseTasks",
|
17
|
+
)
|
15
18
|
|
16
19
|
require_relative "migration"
|
17
20
|
ActiveRecord::Migration.include Waldit::Migration
|
data/lib/waldit/version.rb
CHANGED
data/lib/waldit/watcher.rb
CHANGED
data/lib/waldit.rb
CHANGED
@@ -37,7 +37,6 @@ module Waldit
|
|
37
37
|
end
|
38
38
|
|
39
39
|
attr_accessor :ignored_columns
|
40
|
-
attr_accessor :max_transaction_size
|
41
40
|
attr_accessor :model
|
42
41
|
attr_accessor :context_prefix
|
43
42
|
end
|
@@ -55,8 +54,6 @@ module Waldit
|
|
55
54
|
|
56
55
|
config.ignored_columns = -> table { %w[created_at updated_at] }
|
57
56
|
|
58
|
-
config.max_transaction_size = 10_000
|
59
|
-
|
60
57
|
config.model = Class.new(ActiveRecord::Base) do
|
61
58
|
include Waldit::Record
|
62
59
|
self.table_name = "waldit"
|
data/rbi/waldit.rbi
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
module Waldit
|
3
3
|
extend T::Sig
|
4
4
|
extend Waldit::Context
|
5
|
-
VERSION = "0.0.
|
5
|
+
VERSION = "0.0.13"
|
6
6
|
|
7
7
|
class << self
|
8
8
|
sig { returns(String) }
|
@@ -17,9 +17,6 @@ module Waldit
|
|
17
17
|
sig { returns(T.proc.params(table: String).returns(T::Array[String])) }
|
18
18
|
attr_accessor :ignored_columns
|
19
19
|
|
20
|
-
sig { returns(Integer) }
|
21
|
-
attr_accessor :max_transaction_size
|
22
|
-
|
23
20
|
sig { returns(T.class_of(ActiveRecord::Base)) }
|
24
21
|
attr_accessor :model
|
25
22
|
end
|
@@ -120,9 +117,6 @@ module Waldit
|
|
120
117
|
sig { params(table: String).returns(T::Array[String]) }
|
121
118
|
def ignored_columns(table); end
|
122
119
|
|
123
|
-
sig { returns(Integer) }
|
124
|
-
def max_transaction_size; end
|
125
|
-
|
126
120
|
sig { returns(T.class_of(ActiveRecord::Base)) }
|
127
121
|
def record; end
|
128
122
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: waldit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rodrigo Navarro
|
8
8
|
bindir: exe
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-08-
|
10
|
+
date: 2025-08-30 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: wal
|