Class: TestData::DeterminesDatabasesAssociatedDumpTime

Inherits:
Object
  • Object
show all
Defined in:
lib/test_data/determines_databases_associated_dump_time.rb

Instance Method Summary collapse

Instance Method Details

#callObject



3
4
5
6
7
8
9
10
11
# File 'lib/test_data/determines_databases_associated_dump_time.rb', line 3

def call
  if (last_dumped_at = ActiveRecord::InternalMetadata.find_by(key: "test_data:last_dumped_at")&.value)
    Time.parse(last_dumped_at)
  end
rescue ActiveRecord::StatementInvalid
  # This will be raised if the DB exists but hasn't been migrated/schema-loaded
rescue ActiveRecord::NoDatabaseError
  # This will be raised if the DB doesn't exist yet, which we don't need to warn about
end