Top "Rails-migrations" questions

Rails migrations are used to track and apply database alterations in a reversible manner.

How to drop columns using Rails migration

What's the syntax for dropping a database table column through a Rails migration?

ruby-on-rails ruby database activerecord rails-migrations
Add a reference column migration in Rails 4

A user has many uploads. I want to add a column to the uploads table that references the user. What …

ruby-on-rails ruby-on-rails-4 rails-activerecord rails-migrations
Why am I asked to run 'rake db:migrate RAILS_ENV=test'?

On Rails 4.0.0.rc1, Ruby 2.0.0, after I run a migration, I see the following error when I try to run a …

ruby-on-rails rails-migrations ruby-on-rails-4
Add timestamps to an existing table

I need to add timestamps (created_at & updated_at) to an existing table. I tried the following code but …

ruby-on-rails ruby rails-activerecord rails-migrations
Specifying column name in a "references" migration

I want to make a migration in Rails, referencing another table. Usually, I would do something like: add_column :post, :…

ruby-on-rails ruby-on-rails-3 activerecord rails-migrations
how to generate migration to make references polymorphic

I have a Products table and want to add a column: t.references :imageable, :polymorphic => true I was trying …

ruby-on-rails polymorphic-associations rails-migrations
Show pending migrations in rails

Is there a rake task that shows the pending migrations in a rails app?

ruby-on-rails rails-migrations
Check if a table exists in Rails

I have a rake task that won't work unless a table exists. I'm working with more than 20 engineers on a …

ruby-on-rails ruby rails-activerecord rails-migrations
has_many, belongs_to relation in active record migration rails 4

I have a User model and a Task model. I have not mentioned any relation between them while creating them. …

ruby-on-rails rails-activerecord ruby-on-rails-4 rails-migrations
Destroy/Remove database in Rails

Is it possible to completely remove the database and all migration records etc from an existing application so I can …

database ruby-on-rails-3 sqlite activerecord rails-migrations