Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const { DataTypes } = require('sequelize');
- const ApplicationRecord = require('./application-record');
- const Foo = require('./foo');
- const Boo = ApplicationRecord.define('Boo', {
- fooId: DataTypes.INTEGER,
- booName: DataTypes.STRING
- }, {});
- // Boo.belongsTo(Foo); <= 這樣會噴掉, 因為跟 Foo 有循環引用, boo 就變成 defefined
- Boo.belongsTo(ApplicationRecord.define('foo'), { as: 'foo' });
- module.exports = Boo;
Add Comment
Please, Sign In to add comment