Skip to content
golive edited this page Feb 10, 2011 · 1 revision

rake db:abort_if_pending_migrations: Raises an error if there are pending migrations

rake db:charset: Retrieves the charset for the current environment's database

rake db:collation: Retrieves the collation for the current environment's database

rake db:create: Create the database defined in config/database.yml for the current RAILS_ENV

rake db:create:all: Create all the local databases defined in config/database.yml

rake db:drop: Drops the database for the current RAILS_ENV

rake db:drop:all: Drops all the local databases defined in config/database.yml

rake db:fixtures:identify: Search for a fixture given a LABEL or ID. Specify an alternative path (eg. spec/fixtures) using FIXTURES_PATH=spec/fixtures.

rake db:fixtures:load: Load fixtures into the current environment's database. Load specific fixtures using FIXTURES=x,y. Load from subdirectory in test/fixtures using FIXTURES_DIR=z. Specify an alternative path (eg. spec/fixtures) using FIXTURES_PATH=spec/fixtures.

rake db:migrate: Migrate the database through scripts in db/migrate and update db/schema.rb by invoking db:schema:dump. Target specific version with VERSION=x. Turn off output with VERBOSE=false.

rake db:migrate:down: Runs the "down" for a given migration VERSION.

rake db:migrate:redo: Rollbacks the database one migration and re migrate up. If you want to rollback more than one step, define STEP=x. Target specific version with VERSION=x.

rake db:migrate:reset: Resets your database using your migrations for the current environment

rake db:migrate:up: Runs the "up" for a given migration VERSION.

rake db:reset: Drops and recreates the database from db/schema.rb for the current environment and loads the seeds.

rake db:rollback: Rolls the schema back to the previous version. Specify the number of steps with STEP=n

rake db:schema:dump: Create a db/schema.rb file that can be portably used against any DB supported by AR

rake db:schema:load: Load a schema.rb file into the database

rake db:seed: Load the seed data from db/seeds.rb

rake db:sessions:clear: Clear the sessions table

rake db:sessions:create: Creates a sessions migration for use with ActiveRecord::SessionStore

rake db:setup: Create the database, load the schema, and initialize with the seed data

rake db:structure:dump: Dump the database structure to a SQL file

rake db:test:clone: Recreate the test database from the current environment's database schema

rake db:test:clone_structure: Recreate the test databases from the development structure

rake db:test:load: Recreate the test database from the current schema.rb

rake db:test:prepare: Check for pending migrations and load the test schema

rake db:test:purge: Empty the test database

rake db:version: Retrieves the current schema version number

Clone this wiki locally