adspace


What are the functions performed by rails migration?

Answer Posted / Amrendra Bahadur Singh

Rails migrations are a powerful feature that allows developers to manage the database schema evolution for their Rails applications. They can be used to create, modify, and destroy database tables, add columns, and perform other database operations. Migrations are written in Ruby and are stored in the 'db/migrate' directory.nnEach migration represents a change in the database schema. When executed with the 'rails db:migrate' command, Rails applies all pending migrations to bring the database up-to-date.nnFor example, creating a new table called 'users' with an 'email' column could be achieved by writing a migration like this:n```rubynclass CreateUsers < ActiveRecord::Migration[5.2]n def change
create_table :users do |t|
t.string :email
end
end
end```

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the current version of ruby on rails?

948