Created
July 30, 2014 00:49
-
-
Save kazshu/e58a27af3d80f94d3762 to your computer and use it in GitHub Desktop.
Rails migration create table with bigint id
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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