waldit 0.0.8 → 0.0.10

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: 8dd9fb06d63894b50126cf5b577ef2c0ab62f58ffc095632ad26ee18f8f9d86e
4
- data.tar.gz: 4d99542390d1a30ba64055515bcf9e30d5c83351fd402fe0e933f96a9a37425e
3
+ metadata.gz: 36a418e6018778b191932f3ae0a024f249dadf81650680cc638e09582ae2cbf1
4
+ data.tar.gz: be6287122656902fd53defba9430506bed0c0039464c4a212457f552b9a94f27
5
5
  SHA512:
6
- metadata.gz: 28290886fa42d5ef259186281f73dd3f6539f561adef547c458215127fd40253d374ffc67a3e48db9ec32e47317676cc173cea9a52bd1d569e715c7831d3b84d
7
- data.tar.gz: ce9ef4fc3d0df78721537c55226f57049f28dedaa7b7d1f072b74c139a0fdb7c2ab2918c500a6666645517d2be0f9a27c9f4a86331b4900ad0a3509fd0050344
6
+ metadata.gz: 5fbf80049a20bbb4f2bce49f2eadbc725f9ccca4555f7977581d33509ac3c50910e49766a6b10da0733c71d7b3dabd889a8276ce71f55a6519b3ce908cf37f49
7
+ data.tar.gz: 73a975b25ca05a32a34448bc96fa06eb57825f10eac3dea592b3a0e179b07126d501261c8d078f65c60d03aa59b724223a6d1c14b61583cb2962cf8f65a42042
@@ -2,16 +2,16 @@
2
2
 
3
3
  module Waldit
4
4
  module Migration
5
- def create_waldit_table(name = "waldit", &block)
5
+ def create_waldit_table(name = "waldit")
6
6
  reversible do |dir|
7
7
  dir.up { execute "CREATE TYPE waldit_action AS ENUM ('insert', 'update', 'delete')" }
8
8
  dir.down { execute "DROP TYPE waldit_action" }
9
9
  end
10
10
 
11
- create_table :waldit do |t|
11
+ create_table name do |t|
12
12
  t.column :action, :waldit_action, null: false
13
13
  t.string :table_name, null: false
14
- t.string :primary_key
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
17
  t.timestamptz :commited_at
@@ -19,19 +19,19 @@ module Waldit
19
19
  t.jsonb :old, null: true
20
20
  t.jsonb :new, null: true
21
21
  t.jsonb :diff, null: true
22
- block.call(t)
22
+ yield t if block_given?
23
23
  end
24
24
 
25
- add_index :waldit, [:table_name, :primary_key, :transaction_id], unique: true
26
- add_index :waldit, [:transaction_id, :lsn]
27
- add_index :waldit, :commited_at
28
- add_index :waldit, :context, using: :gin, opclass: :jsonb_path_ops
25
+ add_index name, [:table_name, :primary_key, :transaction_id], unique: true
26
+ add_index name, [:transaction_id, :lsn]
27
+ add_index name, :commited_at
28
+ add_index name, :context, using: :gin, opclass: :jsonb_path_ops
29
29
  end
30
30
 
31
31
  def create_waldit_publication
32
32
  reversible do |dir|
33
- dir.up { execute "CREATE PUBLICATION waldit" }
34
- dir.down { execute "DROP PUBLICATION waldit" }
33
+ dir.up { execute "CREATE PUBLICATION waldit_publication" }
34
+ dir.down { execute "DROP PUBLICATION waldit_publication" }
35
35
  end
36
36
  end
37
37
 
@@ -39,10 +39,10 @@ module Waldit
39
39
  reversible do |dir|
40
40
  dir.up do
41
41
  execute "ALTER TABLE #{table} REPLICA IDENTITY FULL"
42
- execute "ALTER PUBLICATION waldit ADD TABLE #{table}"
42
+ execute "ALTER PUBLICATION waldit_publication ADD TABLE #{table}"
43
43
  end
44
44
  dir.down do
45
- execute "ALTER PUBLICATION waldit DROP TABLE #{table}"
45
+ execute "ALTER PUBLICATION waldit_publication DROP TABLE #{table}"
46
46
  execute "ALTER TABLE #{table} REPLICA IDENTITY DEFAULT"
47
47
  end
48
48
  end
@@ -51,12 +51,12 @@ module Waldit
51
51
  def remove_table_from_waldit(table)
52
52
  reversible do |dir|
53
53
  dir.up do
54
- execute "ALTER PUBLICATION waldit DROP TABLE #{table}"
54
+ execute "ALTER PUBLICATION waldit_publication DROP TABLE #{table}"
55
55
  execute "ALTER TABLE #{table} REPLICA IDENTITY DEFAULT"
56
56
  end
57
57
  dir.down do
58
58
  execute "ALTER TABLE #{table} REPLICA IDENTITY FULL"
59
- execute "ALTER PUBLICATION waldit ADD TABLE #{table}"
59
+ execute "ALTER PUBLICATION waldit_publication ADD TABLE #{table}"
60
60
  end
61
61
  end
62
62
  end
@@ -15,6 +15,7 @@ module Waldit
15
15
 
16
16
  require_relative "migration"
17
17
  ActiveRecord::Migration.include Waldit::Migration
18
+ ActiveRecord::Schema.include Waldit::Migration
18
19
  end
19
20
  end
20
21
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Waldit
4
- VERSION = "0.0.8"
4
+ VERSION = "0.0.10"
5
5
  end
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.8
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rodrigo Navarro
@@ -15,14 +15,14 @@ dependencies:
15
15
  requirements:
16
16
  - - ">="
17
17
  - !ruby/object:Gem::Version
18
- version: 0.0.3
18
+ version: 0.0.8
19
19
  type: :runtime
20
20
  prerelease: false
21
21
  version_requirements: !ruby/object:Gem::Requirement
22
22
  requirements:
23
23
  - - ">="
24
24
  - !ruby/object:Gem::Version
25
- version: 0.0.3
25
+ version: 0.0.8
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: activerecord
28
28
  requirement: !ruby/object:Gem::Requirement