Sha256: 53bf277f8da584a3712ca5f5b6a9fcddfda776cb203515a92bfd8b937624aeed
Contents?: true
Size: 779 Bytes
Versions: 2
Compression:
Stored size: 779 Bytes
Contents
namespace :db do desc 'Prints out the database statement timeout' task statement_timeout: :environment do result = ActiveRecord::Base.connection.execute('SHOW statement_timeout').first puts result['statement_timeout'] end namespace :migrate do task extend_statement_timeout: :environment do if ActiveRecord::VERSION::MAJOR >= 4 config = ActiveRecord::Base.configurations[Rails.env] config['variables'] ||= {} config['variables']['statement_timeout'] = ENV.fetch('MIGRATION_STATEMENT_TIMEOUT', 10_000) ActiveRecord::Base.establish_connection end end end end %i[ db:create db:migrate db:migrate:down db:rollback ].each do |task| Rake::Task[task].enhance(%i[db:migrate:extend_statement_timeout]) end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
roo_on_rails-1.3.1 | lib/roo_on_rails/tasks/db.rake |
roo_on_rails-1.3.0 | lib/roo_on_rails/tasks/db.rake |