mirror of
https://github.com/DatabaseCleaner/database_cleaner
synced 2023-03-27 23:22:03 -04:00
Refactor migration_table_name out of code, in order to be backwards
compatible.
This commit is contained in:
parent
4e2b0d2d7d
commit
d95d522fa4
1 changed files with 10 additions and 2 deletions
|
@ -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?
|
||||
|
|
Loading…
Reference in a new issue