Refactor migration_table_name out of code, in order to be backwards

compatible.
This commit is contained in:
Ernesto Tagwerker 2017-05-02 15:15:00 -04:00
parent 4e2b0d2d7d
commit d95d522fa4

View file

@ -192,7 +192,7 @@ module DatabaseCleaner
FROM pg_tables
WHERE
tablename !~ '_prt_' AND
tablename <> '#{::ActiveRecord::SchemaMigration.table_name}' AND
tablename <> '#{migration_table_name}' AND
schemaname = ANY (current_schemas(false))
_SQL
rows.collect { |result| result.first }
@ -257,7 +257,15 @@ module DatabaseCleaner::ActiveRecord
# overwritten
def migration_storage_names
[::ActiveRecord::SchemaMigration.table_name]
[migration_table_name]
end
def migration_table_name
if ActiveRecord::VERSION::MAJOR < 5
::ActiveRecord::Migrator.schema_migrations_table_name
else
::ActiveRecord::SchemaMigration.table_name
end
end
def cache_tables?