0
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 5 years have passed since last update.

gem ERDにおける、カラム情報の表記方法

Last updated at Posted at 2019-11-10

migrationファイルを元にER図を作成できるgem「rails-erd」で、生成されたER図のカラム右側に薄文字で表記されている情報について。
これらはカラムの型情報に加えて、非標準の制限、または必須の場合などに追加されます。

Rails ERD

例えば

型+オプション(migrationファイル) 表示(rails-erd) 備考
:integer integer
:string, limit: 255 string
:string, limit: 128 string (128) 非標準の制限
:decimal, precision: 5, scale: 2 decimal (5,2)
:boolean, null: false boolean *

記号の説明

記号 説明
NOT NULL制約(必須)
U 一意性制約(重複不可)
PK 主キー制約(Primary Key)
FK 外部キー制約(Foreign Key)

【SQLに慣れる】MySQLでよく使用する制約

参考

0
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
0
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?