-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
コメント用のテーブルを作る #77
コメント用のテーブルを作る #77
Conversation
class CreateComments < ActiveRecord::Migration[5.0] | ||
def change | ||
create_table :comments do |t| | ||
t.integer :commented_by_id, null: false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
外部キーには外部キー制約とインデックスつけていいと思います
|
||
rename_column :comments, :user_id, :commented_by_id | ||
|
||
add_foreign_key :comments, :users, column: 'commented_by_id' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
やったこと
Post に対する Comment を格納するためのテーブルを作るマイグレーションを作成しました。
実際にコメントを作成・表示するところは #64 でやるので、こちらを先にマージする必要があります。
対応する issue
connects to #35