Sequelize permissions table associate

c07d99bc-e19d-302d-8dea-dc98309bf919.jpg

refer to the figure above, existing

//
permission:{
    id:DataTypes.INTEGER,
    type:DataTypes.STRING
}
///
Operate:{
    id:DataTypes.INTEGER,
    name:DataTypes.STRING
    url:DataTypes.STRING
}

how to write associate? for permission Can you dynamically associate different tables according to type?
and permission:Operate is one-to-one, but sometimes polymorphic. I think it would be better to build a correlation table. How do I build the table at 1:1?

Mar.02,2021

sequelizejs establish a relationship through BelongsTo, BelongsToMany, HasMany, HasOne , and the associated query include is fine.
http://docs.sequelizejs.com/c.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b35d2f-2b80f.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b35d2f-2b80f.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?