Sha256: f3907df69c3cd76c51d9549a9a45f411343ae1730c4ece0342848e714d574997
Contents?: true
Size: 1.84 KB
Versions: 8
Compression:
Stored size: 1.84 KB
Contents
= pg_audit_log * http://github.com/casecommons/pg_audit_log/ == DESCRIPTION PostgreSQL only database-level audit logging of all databases changes using a completely transparent stored procedure and triggers. Comes with specs for your project and a rake task to generate the reverse SQL to undo changes logged} All SQL INSERTs, UPDATEs, and DELETEs will be captured. Record columns that do not change do not generate an audit log entry. Compatible with Rails 3.0.x and 3.1.x == INSTALL === Enable custom variables in your postgresql instance To enable auditing you need to set a variable in your postgresql.conf file: For macports: /opt/local/var/db/postgresql84/defaultdb/postgresql.conf For homebrew: /usr/local/var/postgres/postgresql.conf For linux: it varies from distro to distro. At the bottom of the file add the following: custom_variable_classes = 'audit' Then restart your PostgreSQL server === Rails 3 $ rails generate pg_audit_log:install === Installing the PostgreSQL function and triggers for your project $ rake pg_audit_log:install == Using on your project The PgAuditLog::Entry ActiveRecord model represents a single entry in the audit log table. Each entry represents a single change to a single field of a record in a table. So if you change 3 columns of a record, that will generate 3 corresponding PgAuditLog::Entry records. === Migrations TODO === schema.rb and development_structure.sql Since schema.rb cannot represent TRIGGERs or FUNCTIONs you will need to set your environment to generate SQL instead of ruby for your database schema and structure. In your application environment put the following: config.active_record.schema_format = :sql And you can generate this sql using: $ rake db:structure:dump === Uninstalling $ rake pg_audit_log:uninstall == REQUIREMENTS * ActiveRecord == LICENSE MIT
Version data entries
8 entries across 8 versions & 1 rubygems