ruby-on-rails-3

No autoincrement primary key ID in Rails Migration


In Rails Migration File is possible to create a column ID primary_key no auto_increment?


Solution

  • I succeeded dropping auto_increment by running following change_column method.

    class DropAutoIncrement < ActiveRecord::Migration
      def change
        change_column :my_table, :id, :integer
      end
    end
    

    I used activerecord 4.0.2.