Ruby

Most used rails commands with database

Posted by

·

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

 

Donate-Button

Help to do more!

The content you read is available for free. If you’ve liked any of the articles at this site, please take a second to help us write more and more articles based on real experiences and maintain them for you and others. Your support will make it possible for us.

$10.00

Let me know your thoughts

Mohamed Sami

About the author

Mohamed Sami is a Industry Advisor who has a solid engineering background, he has more than 18 years of professional experience and he was involved in more than 40 government national projects with holding different roles and responsibilities, from national projects execution and management to drafting of the conceptual architecture and solutions design. Furthermore, Mohamed contributed to various digital strategies in the government sector, which improved his business and technical skills over his career development.

Discover more from Mohamed Sami

Subscribe now to keep reading and get access to the full archive.

Continue reading

Discover more from Mohamed Sami

Subscribe now to keep reading and get access to the full archive.

Continue reading