![]() |
|
![]() |
|
![]() |
|
![]() |
|
![]() |
|
![]() |
|
![]() |
|
![]() |
|
![]() |
|
![]() |
|
![]() |
|
![]() |
|
![]() |
|
![]() |
|
![]() |
|
"use strict";
const { Model } = require("sequelize");
module.exports = (sequelize, DataTypes) => {
class UserRoles extends Model {
static associate(models) {
// Define association
UserRoles.belongsToMany(models.Role, {
through: "UserRole",
foreignKey: "user_roles_id",
otherKey: "role_id",
});
UserRoles.hasMany(models.UserRole, {
foreignKey: "user_roles_id",
onDelete: "CASCADE",
hooks: true,
});
}
}
UserRoles.init(
{
id: {
allowNull: false,
primaryKey: true,
autoIncrement: true,
type: DataTypes.INTEGER,
},
user_id: {
type: DataTypes.INTEGER,
allowNull: false,
},
is_active: {
type: DataTypes.BOOLEAN,
defaultValue: true,
},
},
{
sequelize,
modelName: "UserRoles",
tableName: "user_roles",
}
);
return UserRoles;
};
免責事項:info@kdj.com
提供される情報は取引に関するアドバイスではありません。 kdj.com は、この記事で提供される情報に基づいて行われた投資に対して一切の責任を負いません。暗号通貨は変動性が高いため、十分な調査を行った上で慎重に投資することを強くお勧めします。
このウェブサイトで使用されているコンテンツが著作権を侵害していると思われる場合は、直ちに当社 (info@kdj.com) までご連絡ください。速やかに削除させていただきます。