ssps-bot/utils/models/rickroll.js
Daniel Bulant 0f0e5debef test
2021-10-23 16:19:56 +02:00

42 lines
No EOL
1.1 KiB
JavaScript

const { Sequelize, Op, Model, DataTypes } = require("sequelize");
const sequelize = require("../sequelize");
const Student = require("./student");
const Rickroll = sequelize.define(
"rickrolls",
{
id: {
type: DataTypes.INTEGER,
autoIncrement: true,
primaryKey: true
},
source: {
type: DataTypes.STRING(45),
allowNull: false,
references: {
key: "id",
model: Student
}
},
target: {
type: DataTypes.STRING(45),
allowNull: false,
references: {
key: "id",
model: Student
}
},
date: {
type: DataTypes.DATE,
defaultValue: "CURRENT_TIMESTAMP()"
},
link: {
type: DataTypes.STRING(255),
defaultValue: "'https://www.youtube.com/watch?v=dQw4w9WgXcQ'"
}
}
);
EventGroup.belongsTo(Student, { as: "source" });
EventGroup.belongsTo(Student, { as: "target" });
module.exports = Rickroll;