Module: Debci::DB
- Defined in:
- lib/debci/db.rb
Constant Summary collapse
- LEGACY_MIGRATION =
if version_isnewer ActiveRecord::Migration else ActiveRecord::Migration[4.2] end
Class Method Summary collapse
Class Method Details
.config ⇒ Object
6 7 8 |
# File 'lib/debci/db.rb', line 6 def self.config @config ||= ENV['DATABASE_URL'] || Debci.config.database_url end |
.establish_connection ⇒ Object
10 11 12 |
# File 'lib/debci/db.rb', line 10 def self.establish_connection ActiveRecord::Base.establish_connection(config) end |
.migrate ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/debci/db.rb', line 14 def self.migrate migrations_path = File.join(File.dirname(__FILE__), 'db', 'migrations') ActiveRecord::Migration.verbose = !Debci.config.quiet if ActiveRecord.version.release < Gem::Version.new('5.2.0') ActiveRecord::Migrator.migrate(migrations_path, nil) else ActiveRecord::MigrationContext.new(migrations_path).migrate end end |