pg_audit_log 0.6.1 → 0.6.2
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 +4 -4
- data/lib/pg_audit_log/extensions/postgresql_adapter.rb +6 -4
- data/lib/pg_audit_log/version.rb +1 -1
- data/spec/pg_audit_log_spec.rb +15 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 924d22fb7b34cf8d77d2b73f2c18195731d0da64
|
4
|
+
data.tar.gz: 19640f9a6f1ddbc464b705c0a994bf051eddb2d3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: affe074c0f10332d56ac57f831d4a6b0e38379d6fb674bab44a1c11bda617606e94c99f72e31e5ff025308b0afa7b8a2dda64f33d6e24927e9d3c7abfc7715c4
|
7
|
+
data.tar.gz: 3e9adb9a60b4e09f3c666f5129e077dbc56671ce7ca998d1d2295134dd27c3b3f1a6f2cf06d07742f1deae472c4e2f262b9f89c89173af714bc1acf69af958cb
|
@@ -13,9 +13,9 @@ class ActiveRecord::ConnectionAdapters::PostgreSQLAdapter
|
|
13
13
|
def create_table_with_auditing(table_name, options = {}, &block)
|
14
14
|
create_table_without_auditing(table_name, options, &block)
|
15
15
|
unless options[:temporary] ||
|
16
|
-
|
17
|
-
|
18
|
-
|
16
|
+
PgAuditLog::IGNORED_TABLES.include?(table_name) ||
|
17
|
+
PgAuditLog::IGNORED_TABLES.any? { |table| table =~ table_name if table.is_a? Regexp } ||
|
18
|
+
PgAuditLog::Triggers.tables_with_triggers.include?(table_name)
|
19
19
|
PgAuditLog::Triggers.create_for_table(table_name)
|
20
20
|
end
|
21
21
|
end
|
@@ -26,7 +26,9 @@ class ActiveRecord::ConnectionAdapters::PostgreSQLAdapter
|
|
26
26
|
PgAuditLog::Triggers.drop_for_table(table_name)
|
27
27
|
end
|
28
28
|
rename_table_without_auditing(table_name, new_name)
|
29
|
-
unless PgAuditLog::IGNORED_TABLES.include?(table_name) ||
|
29
|
+
unless PgAuditLog::IGNORED_TABLES.include?(table_name) ||
|
30
|
+
PgAuditLog::IGNORED_TABLES.any? { |table| table =~ table_name if table.is_a? Regexp } ||
|
31
|
+
PgAuditLog::Triggers.tables_with_triggers.include?(new_name)
|
30
32
|
PgAuditLog::Triggers.create_for_table(new_name)
|
31
33
|
end
|
32
34
|
end
|
data/lib/pg_audit_log/version.rb
CHANGED
data/spec/pg_audit_log_spec.rb
CHANGED
@@ -279,6 +279,21 @@ describe PgAuditLog do
|
|
279
279
|
|
280
280
|
connection.drop_table(new_table_name) rescue nil
|
281
281
|
end
|
282
|
+
|
283
|
+
context "and the new table name is ignored on the ignore list" do
|
284
|
+
it "should not create a new trigger" do
|
285
|
+
PgAuditLog::IGNORED_TABLES << /ignored_table/
|
286
|
+
new_table_name = "ignored_table_#{Time.current.to_i}"
|
287
|
+
connection.create_table('ignored_table')
|
288
|
+
connection.rename_table('ignored_table', new_table_name)
|
289
|
+
|
290
|
+
trigger_names.should_not include('audit_ignored_table')
|
291
|
+
trigger_names.should_not include("audit_#{new_table_name}")
|
292
|
+
PgAuditLog::Triggers.tables_with_triggers.should_not include(new_table_name)
|
293
|
+
|
294
|
+
connection.drop_table(new_table_name) rescue nil
|
295
|
+
end
|
296
|
+
end
|
282
297
|
end
|
283
298
|
end
|
284
299
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pg_audit_log
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Case Commons, LLC
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-10-
|
11
|
+
date: 2014-10-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|