Top "Rails-migrations" questions

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

Migration with a decimal number with 2 trailing digits

Rails 3.2 MySQL gem I have the following in my migration: t.decimal :pre_tax_total, default: nil, scale: 2 t.decimal :…

ruby-on-rails activerecord rails-migrations
Rails: PG::UndefinedTable: ERROR: relation "..." does not exist

On migration I get the following error message: PG::UndefinedTable: ERROR: relation "actioncodes" does not exist : ALTER TABLE "organizations" ADD …

ruby-on-rails postgresql ruby-on-rails-4 rails-migrations
rails 3.2 migration cannot add index to create_table in change method

here is my migration in rails 3.2.2: class CreateStatistics < ActiveRecord::Migration def change create_table :statistics do |t| t.string :…

ruby-on-rails rails-migrations
How can I remove a unique constraint from a database column in Rails?

I created a table using the following migration: class CreateProfilePictures < ActiveRecord::Migration def change create_table :profile_pictures do |…

sql ruby-on-rails rails-migrations
Add auto increment back to primary key column in Rails

By mistake I removed the autoincrement option from id field of my table. Can anyone tell me how I can …

ruby-on-rails activerecord auto-increment rails-migrations
How to reset auto increment field in a ActiveRecord migration?

In my migration I have: def up MyModel.destroy_all MyModel.create!({:id=>1,:name=>'foo'}) MyModel.create!({:id=&…

ruby-on-rails-3 activerecord rails-migrations
How do I add migration with multiple references to the same model in one table? Ruby/Rails

How do I create a migration with two fields that reference the same table? I have tables A, and image. …

ruby-on-rails ruby rails-activerecord rails-migrations
Will removing a column with a Rails migration remove indexes associated with the column

In Rails 2, will removing a column with a Rails migration also change/remove indexes associated with the column? If not, …

ruby-on-rails rails-migrations
How to change primary key in rails migration file?

I need to migrate an old mysql table like this: Products name (string, primary_key) to this schema: Products id (…

ruby-on-rails database-migration rails-migrations
How do I check the Database type in a Rails Migration?

I have the following migration and I want to be able to check if the current database related to the …

ruby-on-rails ruby migration rails-migrations