pg_audit_log 0.3.3 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -60,7 +60,9 @@ class ActiveRecord::ConnectionAdapters::PostgreSQLAdapter
60
60
 
61
61
  def create_table_with_auditing(table_name, options = {}, &block)
62
62
  create_table_without_auditing(table_name, options, &block)
63
- unless options[:temporary] || PgAuditLog::Triggers.tables_with_triggers.include?(table_name)
63
+ unless options[:temporary] ||
64
+ PgAuditLog::IGNORED_TABLES.include?(table_name) ||
65
+ PgAuditLog::Triggers.tables_with_triggers.include?(table_name)
64
66
  PgAuditLog::Triggers.create_for_table(table_name)
65
67
  end
66
68
  end
@@ -71,7 +73,8 @@ class ActiveRecord::ConnectionAdapters::PostgreSQLAdapter
71
73
  if PgAuditLog::Triggers.tables_with_triggers.include?(table_name)
72
74
  PgAuditLog::Triggers.drop_for_table(table_name)
73
75
  end
74
- unless PgAuditLog::Triggers.tables_with_triggers.include?(new_name)
76
+ unless PgAuditLog::IGNORED_TABLES.include?(table_name) ||
77
+ PgAuditLog::Triggers.tables_with_triggers.include?(new_name)
75
78
  PgAuditLog::Triggers.create_for_table(new_name)
76
79
  end
77
80
  end
@@ -69,7 +69,9 @@ class ActiveRecord::ConnectionAdapters::PostgreSQLAdapter
69
69
 
70
70
  def create_table_with_auditing(table_name, options = {}, &block)
71
71
  create_table_without_auditing(table_name, options, &block)
72
- unless options[:temporary] || PgAuditLog::Triggers.tables_with_triggers.include?(table_name)
72
+ unless options[:temporary] ||
73
+ PgAuditLog::IGNORED_TABLES.include?(table_name) ||
74
+ PgAuditLog::Triggers.tables_with_triggers.include?(table_name)
73
75
  PgAuditLog::Triggers.create_for_table(table_name)
74
76
  end
75
77
  end
@@ -80,7 +82,8 @@ class ActiveRecord::ConnectionAdapters::PostgreSQLAdapter
80
82
  if PgAuditLog::Triggers.tables_with_triggers.include?(table_name)
81
83
  PgAuditLog::Triggers.drop_for_table(table_name)
82
84
  end
83
- unless PgAuditLog::Triggers.tables_with_triggers.include?(new_name)
85
+ unless PgAuditLog::IGNORED_TABLES.include?(table_name) ||
86
+ PgAuditLog::Triggers.tables_with_triggers.include?(new_name)
84
87
  PgAuditLog::Triggers.create_for_table(new_name)
85
88
  end
86
89
  end
@@ -1,3 +1,3 @@
1
1
  module PgAuditLog
2
- VERSION = "0.3.3"
2
+ VERSION = "0.3.4"
3
3
  end
@@ -309,4 +309,15 @@ describe PgAuditLog do
309
309
  end
310
310
  end
311
311
 
312
+ describe "ignored tables" do
313
+ context "when creating one of those tables" do
314
+ it "should not automatically create a trigger for it" do
315
+ PgAuditLog::IGNORED_TABLES << "ignored_table"
316
+ connection.create_table("ignored_table")
317
+ PgAuditLog::Triggers.tables_with_triggers.should_not include("ignored_table")
318
+ connection.drop_table("ignored_table")
319
+ end
320
+ end
321
+ end
322
+
312
323
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pg_audit_log
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-10-02 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
- requirement: &2168542000 !ruby/object:Gem::Requirement
16
+ requirement: &2164346140 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 3.0.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2168542000
24
+ version_requirements: *2164346140
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: pg
27
- requirement: &2168541140 !ruby/object:Gem::Requirement
27
+ requirement: &2164345300 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 0.9.0
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *2168541140
35
+ version_requirements: *2164345300
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rspec-rails
38
- requirement: &2168540520 !ruby/object:Gem::Requirement
38
+ requirement: &2164344340 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *2168540520
46
+ version_requirements: *2164344340
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: with_model
49
- requirement: &2168539520 !ruby/object:Gem::Requirement
49
+ requirement: &2164343240 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 0.1.3
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *2168539520
57
+ version_requirements: *2164343240
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: autotest
60
- requirement: &2168538600 !ruby/object:Gem::Requirement
60
+ requirement: &2164342280 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,7 +65,7 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *2168538600
68
+ version_requirements: *2164342280
69
69
  description: A completely transparent audit logging component for your application
70
70
  using a stored procedure and triggers. Comes with specs for your project and a rake
71
71
  task to generate the reverse SQL to undo changes logged
@@ -119,7 +119,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
119
119
  version: '0'
120
120
  segments:
121
121
  - 0
122
- hash: -4484805073833127824
122
+ hash: -2193124728836431655
123
123
  required_rubygems_version: !ruby/object:Gem::Requirement
124
124
  none: false
125
125
  requirements:
@@ -128,7 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
128
128
  version: '0'
129
129
  segments:
130
130
  - 0
131
- hash: -4484805073833127824
131
+ hash: -2193124728836431655
132
132
  requirements: []
133
133
  rubyforge_project:
134
134
  rubygems_version: 1.8.10