rails-pg_trigger 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -1
- data/lib/pg_trigger/noop.rb +15 -0
- data/lib/pg_trigger/plan.rb +5 -5
- data/lib/pg_trigger/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 44aab12612f46126b08d12e199cb56b8011848c3f6d6fd1297d3dc82079640d0
|
4
|
+
data.tar.gz: 7cc00af7a6f44b0d3c773a70526a907656c7eeecbcd8e73857330011946a206b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b8c0b565a02f88efbf883c1bf76fcd9e9e18c49ddcdb90b40399521635f193a2bcded0421b297e3f553a8fea863a87d142cda075469d025bbb50d19253bb45af
|
7
|
+
data.tar.gz: 53fc370375dd2cac4ccc0699a260e35829fdf5d353097001ab1675be0267d18826a0fb9c2745fe97a9edc228eccd7ca3905b473471f7172f11798a28b6881e90
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,11 @@
|
|
1
|
-
## [
|
1
|
+
## [Unreleased]
|
2
|
+
|
3
|
+
## [0.1.3] - 2024-02-11
|
4
|
+
|
5
|
+
- Correclty rollback updated triggers
|
6
|
+
- Fix noop in non dev/test environments
|
7
|
+
|
8
|
+
## [0.1.2] - 2024-01-22
|
2
9
|
|
3
10
|
- `where_clause` is now also used to compare triggers
|
4
11
|
- Add trigger's columns in generated SQL and name
|
data/lib/pg_trigger/noop.rb
CHANGED
@@ -3,8 +3,23 @@ module PgTrigger::Noop
|
|
3
3
|
other.extend ClassMethods
|
4
4
|
end
|
5
5
|
|
6
|
+
class Proxy
|
7
|
+
def self.chain(*methods)
|
8
|
+
methods.each do |m|
|
9
|
+
class_eval <<-RUBY, __FILE__, __LINE__ + 1
|
10
|
+
def #{m}(*)
|
11
|
+
self
|
12
|
+
end
|
13
|
+
RUBY
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
chain :on, :of, :after, :before, :named, :where, :nowrap
|
18
|
+
end
|
19
|
+
|
6
20
|
module ClassMethods
|
7
21
|
def trigger
|
22
|
+
Proxy.new
|
8
23
|
end
|
9
24
|
end
|
10
25
|
end
|
data/lib/pg_trigger/plan.rb
CHANGED
@@ -20,7 +20,7 @@ module PgTrigger
|
|
20
20
|
@expected.each do |t|
|
21
21
|
e = @existing.find { |_t| _t.name == t.name }
|
22
22
|
if e
|
23
|
-
plan.update_trigger(t) unless t.same?(e)
|
23
|
+
plan.update_trigger(e, t) unless t.same?(e)
|
24
24
|
else
|
25
25
|
plan.add_trigger(t)
|
26
26
|
end
|
@@ -81,12 +81,12 @@ module PgTrigger
|
|
81
81
|
@actions[:to_remove] << t
|
82
82
|
end
|
83
83
|
|
84
|
-
def update_trigger(
|
84
|
+
def update_trigger(old_t, new_t)
|
85
85
|
set_type :update
|
86
|
-
set_table
|
86
|
+
set_table new_t.table
|
87
87
|
|
88
|
-
@actions[:to_remove] <<
|
89
|
-
@actions[:to_add] <<
|
88
|
+
@actions[:to_remove] << old_t
|
89
|
+
@actions[:to_add] << new_t
|
90
90
|
end
|
91
91
|
|
92
92
|
private
|
data/lib/pg_trigger/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-pg_trigger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ccocchi
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-02-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -104,7 +104,7 @@ metadata:
|
|
104
104
|
homepage_uri: https://github.com/ccocchi/rails-pg_trigger
|
105
105
|
source_code_uri: https://github.com/ccocchi/rails-pg_trigger
|
106
106
|
changelog_uri: https://github.com/ccocchi/rails-pg_trigger/blob/main/CHANGELOG.md
|
107
|
-
post_install_message:
|
107
|
+
post_install_message:
|
108
108
|
rdoc_options: []
|
109
109
|
require_paths:
|
110
110
|
- lib
|
@@ -119,8 +119,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
119
119
|
- !ruby/object:Gem::Version
|
120
120
|
version: '0'
|
121
121
|
requirements: []
|
122
|
-
rubygems_version: 3.3.
|
123
|
-
signing_key:
|
122
|
+
rubygems_version: 3.0.3.1
|
123
|
+
signing_key:
|
124
124
|
specification_version: 4
|
125
125
|
summary: Postgres triggers for Rails
|
126
126
|
test_files: []
|