Sha256: 7fc28d4c2941de099d8e765af92456333991b26885f63ff8de2033aa4378e06f

Contents?: true

Size: 1.17 KB

Versions: 26

Compression:

Stored size: 1.17 KB

Contents

namespace :pg_audit_log do
  desc "Install audit_log triggers on all tables"
  task :install => :environment do
    unless PgAuditLog::Entry.installed?
      puts "Creating #{PgAuditLog::Entry.table_name} table..."
      PgAuditLog::Entry.install
    end

    puts "Installing audit_changes() function..."
    PgAuditLog::Function.install

    puts "Installing all audit log triggers... "
    PgAuditLog::Triggers.install

    export_development_structure
  end

  desc "Uninstall audit log triggers on all tables"
  task :uninstall => :environment do
    puts "Dropping all audit_log triggers... "
    PgAuditLog::Triggers.uninstall

    puts "Uninstalling audit_changes() function..."
    PgAuditLog::Function.uninstall

    export_development_structure
  end

  desc "Check all tables that are missing triggers (fails if any are)"
  task :check => :environment do
    tables = PgAuditLog::Triggers.tables_without_triggers
    raise(PgAuditLog::Triggers::MissingTriggers, tables) if tables.any?
  end

  private

  def export_development_structure
    puts "Exporting development_structure.sql..."
    Rake::Task["db:structure:dump"].reenable
    Rake::Task["db:structure:dump"].invoke
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
pg_audit_log-0.6.7 lib/generators/pg_audit_log/templates/lib/tasks/pg_audit_log.rake
pg_audit_log-0.6.6 lib/generators/pg_audit_log/templates/lib/tasks/pg_audit_log.rake
pg_audit_log-0.6.5 lib/generators/pg_audit_log/templates/lib/tasks/pg_audit_log.rake
pg_audit_log-0.6.3 lib/generators/pg_audit_log/templates/lib/tasks/pg_audit_log.rake
pg_audit_log-0.6.2 lib/generators/pg_audit_log/templates/lib/tasks/pg_audit_log.rake
pg_audit_log-0.6.1 lib/generators/pg_audit_log/templates/lib/tasks/pg_audit_log.rake
pg_audit_log-0.6.0 lib/generators/pg_audit_log/templates/lib/tasks/pg_audit_log.rake
pg_audit_log-0.5.6 lib/generators/pg_audit_log/templates/lib/tasks/pg_audit_log.rake
pg_audit_log-0.5.5 lib/generators/pg_audit_log/templates/lib/tasks/pg_audit_log.rake
pg_audit_log-0.5.4 lib/generators/pg_audit_log/templates/lib/tasks/pg_audit_log.rake
pg_audit_log-0.5.2 lib/generators/pg_audit_log/templates/lib/tasks/pg_audit_log.rake
pg_audit_log-0.5.1 lib/generators/pg_audit_log/templates/lib/tasks/pg_audit_log.rake
pg_audit_log-0.5.0 lib/generators/pg_audit_log/templates/lib/tasks/pg_audit_log.rake
pg_audit_log-0.4.5 lib/generators/pg_audit_log/templates/lib/tasks/pg_audit_log.rake
pg_audit_log-0.4.4 lib/generators/pg_audit_log/templates/lib/tasks/pg_audit_log.rake
pg_audit_log-0.4.0 lib/generators/pg_audit_log/templates/lib/tasks/pg_audit_log.rake
pg_audit_log-0.3.6 lib/generators/pg_audit_log/templates/lib/tasks/pg_audit_log.rake
pg_audit_log-0.3.5 lib/generators/pg_audit_log/templates/lib/tasks/pg_audit_log.rake
pg_audit_log-0.3.4 lib/generators/pg_audit_log/templates/lib/tasks/pg_audit_log.rake
pg_audit_log-0.3.3 lib/generators/pg_audit_log/templates/lib/tasks/pg_audit_log.rake