LoginSignup
1
2

More than 5 years have passed since last update.

[sequelize] hasManyのforeignKey, targetKey, sourceKeyについて

Last updated at Posted at 2018-09-21

foreignKey

belongsToを定義しているテーブルのカラム名を両テーブルのforeignKeyに定義する

targetKey

hasManyを定義しているテーブルのカラム名をbolongsToのtargetKeyに定義する
※hasManyを定義しているテーブルのカラム名を変更している場合(例: field: ****)は変更後の名前を定義する

sourceKey

hasManyを定義しているテーブルのカラム名をhasManyのsorceKeyに定義する
※hasManyを定義しているテーブルのカラム名を変更している場合(例: field: ****)は変更前の名前を定義する

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