Rails 4: hack for creating mysql table without auto_increment

I came across an issue when I was trying to create a zipcodes table with `code` as primary key and I didn’t want AUTO_INCREMENT.

I wrote below migration-

class CreateZipcodesTable < ActiveRecord::Migration def change create_table :zipcodes, :id => false do |t|
t.integer :code, :null => false
t.integer :state_id, null: false
t.string :city, limit: 255
t.string :state_code, limit: 2, null: false
add_index :zipcodes, :code, :unique => true