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