Sha256: c9148a767a7b9c488f30a14806e9d49774fefb4bf076b5398d89a087c84a61e9
Contents?: true
Size: 1.01 KB
Versions: 9
Compression:
Stored size: 1.01 KB
Contents
# frozen_string_literal: true require 'rails-pg-extras' namespace :pg_extras do task :establish_connection do if ENV['DATABASE_URL'].present? ActiveRecord::Base.establish_connection(ENV['DATABASE_URL']) else db_config_file = File.read('config/database.yml') db_config = YAML::load(ERB.new(db_config_file).result, aliases: true) ActiveRecord::Base.establish_connection(db_config[Rails.env]) end end RailsPgExtras::QUERIES.each do |query_name| desc RubyPgExtras.description_for(query_name: query_name) task query_name.to_sym => :establish_connection do RailsPgExtras.public_send(query_name) end end desc "Generate a PostgreSQL healthcheck report" task diagnose: :establish_connection do RailsPgExtras.diagnose end desc "Display tables metadata metrics" task table_info: :establish_connection do RailsPgExtras.table_info end desc "Display indexes metadata metrics" task index_info: :establish_connection do RailsPgExtras.index_info end end
Version data entries
9 entries across 9 versions & 1 rubygems