LoginSignup
0
0

More than 5 years have passed since last update.

Rails 4.2でMySQLのPrimary IDをBIGINTにする

Posted at

activerecord-mysql-awesomeをインストール。Gemfileに記述すると良いだろう。

gem 'activerecord-mysql-awesome'
  • create_tableでid: :bigintを指定
  • foreign_keyはlimit: 8を指定
create_table :users, id: :bigint do |t|
  t.integer :group_id, limit: 8, null: true

〜〜ほにゃらら〜〜

end
add_foreign_key :users, :groups, column: :group_id
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0