Commit 6f6b9ce0 authored by Antonio Terceiro's avatar Antonio Terceiro

Merge branch 'master' into 'master'

Makes ActiveRecord::Migration version explicit on ActiveRecord 5.1

See merge request ci-team/debci!27
parents 645b0591 5836c787
......@@ -4,8 +4,6 @@ require 'active_record'
module Debci
module DB
LEGACY = ActiveRecord.version.release() < Gem::Version.new('5.2.0')
def self.config
@config ||= ENV['DATABASE_URL'] || Debci.config.database_url
end
......@@ -18,14 +16,14 @@ module Debci
migrations_path = File.join(File.dirname(__FILE__), 'db', 'migrations')
ActiveRecord::Migration.verbose = !Debci.config.quiet
version = nil
if LEGACY
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
if LEGACY
if ActiveRecord.version.release() < Gem::Version.new('5.1.0')
LegacyMigration = ActiveRecord::Migration
else
LegacyMigration = ActiveRecord::Migration[4.2]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment