7
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Rails テーブルにcommentを追加するマイグレーションファイル

Posted at

マイグレーションファイル

class AddCommmentsToStaffEmail < ActiveRecord::Migration[6.0]
  def change
    change_column_comment(:staff_emails, :employee_id, '業者ID') 
  end
end

change_column_comment

change_column_commentにテーブル名、カラム名、コメント内容 を記載する

change_column_comment(:table_name, :column_name, 'contents') 

環境

  • activerecord (6.0)

実行手順

マイグレーションファイル作成

コマンド

cmd.
$bundel exec rails g migration AddCommentsToTable

マイグレーションの実行

コマンド

cmd.
$bundel exec rake db:migrate

備考

  • 参考リンク

7
1
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
7
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?