pg_audit_log 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -14,14 +14,17 @@ module PgAuditLog
14
14
  connection.tables - (PgAuditLog::IGNORED_TABLES + [PgAuditLog::Entry.table_name])
15
15
  end
16
16
 
17
- def tables_without_triggers
18
- tables_with_triggers = connection.select_values <<-SQL
17
+ def tables_with_triggers
18
+ connection.select_values <<-SQL
19
19
  SELECT tables.relname as table_name
20
20
  FROM pg_trigger triggers, pg_class tables
21
21
  WHERE triggers.tgrelid = tables.oid
22
22
  AND tables.relname !~ '^pg_'
23
23
  AND triggers.tgname LIKE '#{trigger_prefix}%'
24
24
  SQL
25
+ end
26
+
27
+ def tables_without_triggers
25
28
  tables - tables_with_triggers
26
29
  end
27
30
 
@@ -32,19 +35,19 @@ module PgAuditLog
32
35
  end
33
36
 
34
37
  def uninstall
35
- tables.each do |table|
38
+ tables_with_triggers.each do |table|
36
39
  drop_for_table(table)
37
40
  end
38
41
  end
39
42
 
40
43
  def enable
41
- tables.each do |table|
44
+ tables_with_triggers.each do |table|
42
45
  enable_for_table(table)
43
46
  end
44
47
  end
45
48
 
46
49
  def disable
47
- tables.each do |table|
50
+ tables_with_triggers.each do |table|
48
51
  disable_for_table(table)
49
52
  end
50
53
  end
@@ -1,3 +1,3 @@
1
1
  module PgAuditLog
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
@@ -13,6 +13,17 @@ describe PgAuditLog::Triggers do
13
13
  table {}
14
14
  end
15
15
 
16
+ describe ".tables_with_triggers" do
17
+ before do
18
+ PgAuditLog::Triggers.create_for_table(TableWithTriggers.table_name)
19
+ end
20
+
21
+ it "should return an array of all tables that do have an audit trigger installed" do
22
+ PgAuditLog::Triggers.tables_with_triggers.should include(TableWithTriggers.table_name)
23
+ PgAuditLog::Triggers.tables_with_triggers.should_not include(TableWithoutTriggers.table_name)
24
+ end
25
+ end
26
+
16
27
  describe ".tables_without_triggers" do
17
28
  before do
18
29
  PgAuditLog::Triggers.create_for_table(TableWithTriggers.table_name)
@@ -22,7 +33,6 @@ describe PgAuditLog::Triggers do
22
33
  PgAuditLog::Triggers.tables_without_triggers.should_not include(TableWithTriggers.table_name)
23
34
  PgAuditLog::Triggers.tables_without_triggers.should include(TableWithoutTriggers.table_name)
24
35
  end
25
-
26
36
  end
27
37
 
28
38
  describe ".install" do
@@ -35,7 +45,7 @@ describe PgAuditLog::Triggers do
35
45
 
36
46
  context "when triggers are installed" do
37
47
  before do
38
- PgAuditLog::Triggers.install
48
+ PgAuditLog::Triggers.create_for_table(TableWithTriggers.table_name)
39
49
  end
40
50
 
41
51
  describe ".uninstall" do
metadata CHANGED
@@ -1,72 +1,70 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: pg_audit_log
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.4
4
5
  prerelease:
5
- version: 0.1.3
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Case Commons, LLC
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2011-04-19 00:00:00 -04:00
12
+ date: 2011-07-19 00:00:00.000000000 -04:00
14
13
  default_executable:
15
- dependencies:
16
- - !ruby/object:Gem::Dependency
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
17
16
  name: rails
18
- prerelease: false
19
- requirement: &id001 !ruby/object:Gem::Requirement
17
+ requirement: &2165611780 !ruby/object:Gem::Requirement
20
18
  none: false
21
- requirements:
22
- - - ">="
23
- - !ruby/object:Gem::Version
19
+ requirements:
20
+ - - ! '>='
21
+ - !ruby/object:Gem::Version
24
22
  version: 3.0.0
25
23
  type: :runtime
26
- version_requirements: *id001
27
- - !ruby/object:Gem::Dependency
28
- name: pg
29
24
  prerelease: false
30
- requirement: &id002 !ruby/object:Gem::Requirement
25
+ version_requirements: *2165611780
26
+ - !ruby/object:Gem::Dependency
27
+ name: pg
28
+ requirement: &2165611280 !ruby/object:Gem::Requirement
31
29
  none: false
32
- requirements:
33
- - - ">="
34
- - !ruby/object:Gem::Version
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
35
33
  version: 0.9.0
36
34
  type: :runtime
37
- version_requirements: *id002
38
- - !ruby/object:Gem::Dependency
39
- name: rspec-rails
40
35
  prerelease: false
41
- requirement: &id003 !ruby/object:Gem::Requirement
36
+ version_requirements: *2165611280
37
+ - !ruby/object:Gem::Dependency
38
+ name: rspec-rails
39
+ requirement: &2165610900 !ruby/object:Gem::Requirement
42
40
  none: false
43
- requirements:
44
- - - ">="
45
- - !ruby/object:Gem::Version
46
- version: "0"
41
+ requirements:
42
+ - - ! '>='
43
+ - !ruby/object:Gem::Version
44
+ version: '0'
47
45
  type: :development
48
- version_requirements: *id003
49
- - !ruby/object:Gem::Dependency
50
- name: with_model
51
46
  prerelease: false
52
- requirement: &id004 !ruby/object:Gem::Requirement
47
+ version_requirements: *2165610900
48
+ - !ruby/object:Gem::Dependency
49
+ name: with_model
50
+ requirement: &2165610360 !ruby/object:Gem::Requirement
53
51
  none: false
54
- requirements:
55
- - - ">="
56
- - !ruby/object:Gem::Version
52
+ requirements:
53
+ - - ! '>='
54
+ - !ruby/object:Gem::Version
57
55
  version: 0.1.3
58
56
  type: :development
59
- version_requirements: *id004
60
- description: A completely transparent audit logging component for your application using a stored procedure and triggers. Comes with specs for your project and a rake task to generate the reverse SQL to undo changes logged
61
- email:
57
+ prerelease: false
58
+ version_requirements: *2165610360
59
+ description: A completely transparent audit logging component for your application
60
+ using a stored procedure and triggers. Comes with specs for your project and a rake
61
+ task to generate the reverse SQL to undo changes logged
62
+ email:
62
63
  - casecommons-dev@googlegroups.com
63
64
  executables: []
64
-
65
65
  extensions: []
66
-
67
66
  extra_rdoc_files: []
68
-
69
- files:
67
+ files:
70
68
  - .gitignore
71
69
  - .rvmrc
72
70
  - Gemfile
@@ -97,32 +95,29 @@ files:
97
95
  has_rdoc: true
98
96
  homepage: https://github.com/Casecommons/pg_audit_log
99
97
  licenses: []
100
-
101
98
  post_install_message:
102
99
  rdoc_options: []
103
-
104
- require_paths:
100
+ require_paths:
105
101
  - lib
106
- required_ruby_version: !ruby/object:Gem::Requirement
102
+ required_ruby_version: !ruby/object:Gem::Requirement
107
103
  none: false
108
- requirements:
109
- - - ">="
110
- - !ruby/object:Gem::Version
111
- version: "0"
112
- required_rubygems_version: !ruby/object:Gem::Requirement
104
+ requirements:
105
+ - - ! '>='
106
+ - !ruby/object:Gem::Version
107
+ version: '0'
108
+ required_rubygems_version: !ruby/object:Gem::Requirement
113
109
  none: false
114
- requirements:
115
- - - ">="
116
- - !ruby/object:Gem::Version
117
- version: "0"
110
+ requirements:
111
+ - - ! '>='
112
+ - !ruby/object:Gem::Version
113
+ version: '0'
118
114
  requirements: []
119
-
120
115
  rubyforge_project:
121
- rubygems_version: 1.6.1
116
+ rubygems_version: 1.6.2
122
117
  signing_key:
123
118
  specification_version: 3
124
119
  summary: postgresql only database-level audit logging of all databases changes
125
- test_files:
120
+ test_files:
126
121
  - spec/configuration_spec.rb
127
122
  - spec/connection_adapter_spec.rb
128
123
  - spec/model_spec.rb