Skip to content

Instantly share code, notes, and snippets.

@kazshu
Created July 30, 2014 00:49
Show Gist options
  • Save kazshu/e58a27af3d80f94d3762 to your computer and use it in GitHub Desktop.
Save kazshu/e58a27af3d80f94d3762 to your computer and use it in GitHub Desktop.
Rails migration create table with bigint id
class CreateBooks < ActiveRecord::Migration
def up
create_table :books do |t|
t.string :name
t.integer :price
t.timestamps
end
execute 'ALTER TABLE books MODIFY id bigint(20) DEFAULT NULL auto_increment NOT NULL'
end
def down
drop_table :books
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment