Most used rails commands with database


This is a new post for ruby on rails developers, it is about most used databases commands you will need during development and testing

  • rake db:migrate runs (pending) migrations that have not run yet.
  • rake db:create creates the database
  • rake db:drop deletes the database
  • rake db:seed loads the seed data from db/seeds.rb
  • rake db:schema:load creates tables and columns within the (existing) database following schema.rb
  • rake db:setup does db:create, db:schema:load, db:seed
  • rake db:reset drops and recreates the database from db/schema.rb for the current environment and loads the seeds
  • rake db:test:prepare prepares the testing database to match the development database, the data is empty
  • rake db:seed RAILS_ENV=test loads seed data from db/seed.rb into the testing environment

Here is the reference for other commands may be helpful databases.rake tasks

Advertisements

You can share your thoughts here

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.