mirror of
https://github.com/danbulant/ssps-bot
synced 2026-06-16 12:51:05 +00:00
36 lines
No EOL
893 B
JavaScript
36 lines
No EOL
893 B
JavaScript
const { Sequelize, Op, Model, DataTypes } = require("sequelize");
|
|
const sequelize = require("../sequelize");
|
|
const Group = require("./group");
|
|
const Student = require("./student");
|
|
|
|
const GroupStudent = sequelize.define(
|
|
"group_students",
|
|
{
|
|
group: {
|
|
type: DataTypes.STRING(16),
|
|
allowNull: false,
|
|
references: {
|
|
model: Group,
|
|
key: "id"
|
|
}
|
|
},
|
|
student: {
|
|
type: DataTypes.STRING(45),
|
|
allowNull: false,
|
|
references: {
|
|
model: Student,
|
|
key: "id"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
indexes: [{
|
|
fields: ["group", "student"],
|
|
type: "UNIQUE"
|
|
}]
|
|
}
|
|
);
|
|
EventStudent.belongsTo(Student, { as: "student" });
|
|
EventStudent.belongsTo(Group, { as: "group" });
|
|
|
|
module.exports = GroupStudent; |