1 2 3 4 5 6 7 8 9 10 11 12 13 14
require 'dbshell/client/database' task :dbshell do env = ENV.fetch('RAILS_ENV', 'development') DBShell::Client::Database.runshell( Rails.application.config.database_configuration[env] ) end # Alias 'dbshell' to 'db:shell' namespace :db do task shell: :dbshell end