waldit 0.0.14 → 0.0.15

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: 124c88d83186fe3fc61c3e9f2a2905eb8df5ea8468134ba64a005e0baf8be025
4
- data.tar.gz: 19d6ba889487a8590d1fd9d2778d5ca041d6a538763cb99381946b8bef0bf349
3
+ metadata.gz: b0c671c6e356548b94a0848e8f17e79634e8239113c685995305258c355388ef
4
+ data.tar.gz: d3bcc95f82f3230c5a8b50ec7917a74466166685a9685a8715769246e39bda71
5
5
  SHA512:
6
- metadata.gz: 6ac53c030b4ee7cfa5525b087635a0334b05d33047a8fb09050bd150551b31ce0f2f941ebacb337dc08188bbb6045b9548364b353c31e33022476501ee27eb5f
7
- data.tar.gz: 37fc90bd861e4265b9b22e0dd5614e03764a7a4ef7679e2000d91524cd45ebd091359385d7a6455410c7952ba84c36c55a9ed82e696b2485a9f2697df4098db7
6
+ metadata.gz: 71a0b50f5ee3d46ddf7bdfe11242d7ac29e1fff2826c0ca63195401a377e39f1066d664c0b268d34a696c2568884b8adada0ed0a99c85cf039be1a018b1ce4a9
7
+ data.tar.gz: 87a8ce52ffe1f414d6c529f552bf9deecdbe303fe98be9639cd23944929f6b8770484b25560fcd4a9b76ea78eb31fd92f669478f2c00f9f57e4073251e315917
@@ -14,7 +14,7 @@ module Waldit
14
14
  t.string :primary_key, null: false
15
15
  t.bigint :transaction_id, null: false
16
16
  t.decimal :lsn, null: false, precision: 20, scale: 0
17
- t.timestamptz :commited_at
17
+ t.timestamptz :committed_at
18
18
  t.jsonb :context, null: false, default: {}
19
19
  t.jsonb :old, null: true
20
20
  t.jsonb :new, null: true
@@ -24,8 +24,8 @@ 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]
28
- add_index name, :commited_at
27
+ add_index name, [:action, :table_name, :committed_at]
28
+ add_index name, :committed_at
29
29
  add_index name, :context, using: :gin, opclass: :jsonb_path_ops
30
30
  end
31
31
 
data/lib/waldit/record.rb CHANGED
@@ -2,14 +2,14 @@
2
2
 
3
3
  module Waldit
4
4
  module Record
5
- extend ActiveSupport::Concern
6
-
7
- included do
8
- default_scope { order(:committed_at) }
9
- scope :from_table, -> table { where(table_name: table) }
10
- scope :from_model, -> model { from_table(model.table_name) }
11
- scope :for, -> record { from_model(record.class).where(primary_key: record.id) }
12
- scope :with_context, -> ctx { where("context @> ?", ctx.to_json) }
5
+ def self.included(base)
6
+ base.class_eval do
7
+ default_scope { order(:committed_at) }
8
+ scope :from_table, -> table { where(table_name: table) }
9
+ scope :from_model, -> model { from_table(model.table_name) }
10
+ scope :for, -> record { from_model(record.class).where(primary_key: record.id) }
11
+ scope :with_context, -> ctx { where("context @> ?", ctx.to_json) }
12
+ end
13
13
  end
14
14
 
15
15
  def new
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Waldit
4
- VERSION = "0.0.14"
4
+ VERSION = "0.0.15"
5
5
  end
@@ -46,7 +46,7 @@ module Waldit
46
46
  events.each do |event|
47
47
  case event
48
48
  when CommitTransactionEvent
49
- record.where(transaction_id: event.transaction_id).update_all(commited_at: event.timestamp)
49
+ record.where(transaction_id: event.transaction_id).update_all(committed_at: event.timestamp)
50
50
 
51
51
  changes = [:old, :new, :diff]
52
52
  .map { |diff| [diff, tables.filter { |table| Waldit.store_changes.call(table).include? diff }] }
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.14"
5
+ VERSION = "0.0.15"
6
6
 
7
7
  class << self
8
8
  sig { returns(String) }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: waldit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.14
4
+ version: 0.0.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rodrigo Navarro