class LolDba::RailsCompatibility
Public Class Methods
migrator()
click to toggle source
# File lib/lol_dba/rails_compatibility.rb, line 4 def migrator if ::ActiveRecord::VERSION::MAJOR >= 6 ActiveRecord::Migrator.new(:up, migrations_path, ActiveRecord::SchemaMigration) else ActiveRecord::Migrator.new(:up, migrations_path) end end
tables()
click to toggle source
# File lib/lol_dba/rails_compatibility.rb, line 12 def tables if ::ActiveRecord::VERSION::MAJOR >= 5 ActiveRecord::Base.connection.data_sources else ActiveRecord::Base.connection.tables end end
Private Class Methods
ar_4_migrations_path()
click to toggle source
# File lib/lol_dba/rails_compatibility.rb, line 43 def ar_4_migrations_path ActiveRecord::Migrator.migrations(path) end
ar_5_2_migrations_path()
click to toggle source
# File lib/lol_dba/rails_compatibility.rb, line 39 def ar_5_2_migrations_path ActiveRecord::MigrationContext.new(path).migrations end
ar_6_migrations_path()
click to toggle source
# File lib/lol_dba/rails_compatibility.rb, line 35 def ar_6_migrations_path ActiveRecord::MigrationContext.new(path, 6).migrations end
migrations_path()
click to toggle source
# File lib/lol_dba/rails_compatibility.rb, line 22 def migrations_path ar_version = Gem::Version.new(ActiveRecord::VERSION::STRING) if ar_version >= Gem::Version.new('6') ar_6_migrations_path elsif ar_version >= Gem::Version.new('5.2') ar_5_2_migrations_path elsif ar_version >= Gem::Version.new('4') ar_4_migrations_path else path end end
path()
click to toggle source
# File lib/lol_dba/rails_compatibility.rb, line 47 def path if ::ActiveRecord::VERSION::MAJOR >= 4 ActiveRecord::Migrator.migrations_paths else ActiveRecord::Migrator.migrations_path end end