added a check for the version added

This commit is contained in:
jcrew99
2021-07-18 13:05:15 +10:00
parent 702dfbd878
commit d959956271
7 changed files with 36 additions and 5 deletions

View File

@@ -47,6 +47,11 @@ CONFIG['key'] = ENV['BROWSERSTACK_ACCESS_KEY'] || ''
ActiveRecord::Base.logger = nil
OTR::ActiveRecord.migrations_paths = [File.join('core', 'main', 'ar-migrations')]
OTR::ActiveRecord.configure_from_hash!(adapter:'sqlite3', database:':memory:')
# otr-activerecord require you to manually establish the connection with the following line
#Also a check to confirm that the correct Gem version is installed to require it, likely easier for old systems.
if Gem.loaded_specs['otr-activerecord'].version > Gem::Version.create('2.0')
OTR::ActiveRecord.establish_connection!
end
ActiveRecord::Schema.verbose = false
context = ActiveRecord::Migration.new.migration_context
if context.needs_migration?