Are migrations in ruby on rails updates to a database?

Is is correct to assume that migrations in ruby on rails are simply updates to any database. And that the rake db:migrate script only serves to actualize these changes?

Answers


Yes.

Migrations are a convenient way for you to alter your database in a structured and organized manner. You could edit fragments of SQL by hand but you would then be responsible for telling other developers that they need to go and run them. You’d also have to keep track of which changes need to be run against the production machines next time you deploy.

Active Record tracks which migrations have already been run so all you have to do is update your source and run rake db:migrate. Active Record will work out which migrations should be run. It will also update your db/schema.rb file to match the structure of your database.

Migrations also allow you to describe these transformations using Ruby. The great thing about this is that (like most of Active Record’s functionality) it is database independent: you don’t need to worry about the precise syntax of CREATE TABLE any more than you worry about variations on SELECT * (you can drop down to raw SQL for database specific features). For example you could use SQLite3 in development, but MySQL in production.

Source: Ruby on Rails Guides: Migrations


Need Your Help

What does it mean by .net SDK?

.net sdk rfid

What is .net SDK means?i am interested in RFID scanner and i asked the seller that i wanted to make a custom application using their hardware, and they said that they could provide the .net SDK. I ...

how to hide header and footer on scroll in android

android scroll header hide footer

there is two LinearLayouts header and footer in main activity