YZ
Size: a a a
YZ
A
Kw
YZ
Kw
Kw
•
class AModel extends Model { }
class BModel extends Model { }
AModel.hasMany(BModel, { foreignKey: 'testFieldFromB' });
BModel.belongsTo(AModel);
const a = await AModel.findByPk(1);
const b = await a.hasB(123); // returns a boolean value
...
SELECT * FROM B where (B.testFieldFromB = 1 AND B.id = 123)
•
ar
foreignKey and targetKey
https://sequelize.org/master/manual/assocs.html•
Kw
YZ
YZ
Kw
R
R
YZ
YZ
R
PK