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
|
FROM pg_tables
|
||||||
WHERE
|
WHERE
|
||||||
tablename !~ '_prt_' AND
|
tablename !~ '_prt_' AND
|
||||||
tablename <> '#{::ActiveRecord::SchemaMigration.table_name}' AND
|
tablename <> '#{migration_table_name}' AND
|
||||||
schemaname = ANY (current_schemas(false))
|
schemaname = ANY (current_schemas(false))
|
||||||
_SQL
|
_SQL
|
||||||
rows.collect { |result| result.first }
|
rows.collect { |result| result.first }
|
||||||
|
@ -257,7 +257,15 @@ module DatabaseCleaner::ActiveRecord
|
||||||
|
|
||||||
# overwritten
|
# overwritten
|
||||||
def migration_storage_names
|
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
|
end
|
||||||
|
|
||||||
def cache_tables?
|
def cache_tables?
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue