Skip to content

Database Task Support #380

@metaskills

Description

@metaskills

Here are some notes I made while working on 4.2.

def truncate(table_name, name = nil)
  raise NotImplementedError
end
  • Add a truncate method to the connection.
  • The db:schema:load and db:structure:load no longer purge the database before loading the schema. This is left for the user to do. db:test:prepare will still purge the database. Closes #17945.
  • Bring back db:test:prepare to synchronize the test database schema. Manual synchronization using bin/rake db:test:prepare is required when a migration is rolled-back, edited and reapplied. ActiveRecord::Base.maintain_test_schema now uses db:test:prepare to synchronize the schema. Plugins can use this task as a hook to provide custom behavior after the schema has been loaded. NOTE: test:prepare runs before the schema is synchronized.Fixes #17171, #15787.
  • Add bin/rake db:purge task to empty the current database.
  • No verbose backtrace by db:drop when database does not exist.
  • Schema loading rake tasks (like db:schema:load and db:setup) maintain the database connection to the current environment.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions