From c19ef05c8266a4ec6c2eb4161d4e0cb736e6de5e Mon Sep 17 00:00:00 2001 From: Baipyrus Date: Mon, 29 Jan 2024 00:31:40 +0100 Subject: [PATCH] added message to database --- database.js | 4 +++- models/message.js | 15 +++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 models/message.js diff --git a/database.js b/database.js index 4efe98f..eb1be67 100644 --- a/database.js +++ b/database.js @@ -1,3 +1,4 @@ +import defineMessage from './models/message.js'; import { Sequelize } from 'sequelize'; import { config } from 'dotenv'; config(); @@ -9,7 +10,8 @@ const sequelize = new Sequelize(DB_NAME, DB_USER, DB_PWD, { logging: false, host: DB_HOST, }); +const Message = defineMessage(sequelize); sequelize.sync(); -export { sequelize }; +export { sequelize, Message }; diff --git a/models/message.js b/models/message.js new file mode 100644 index 0000000..928d5e1 --- /dev/null +++ b/models/message.js @@ -0,0 +1,15 @@ +import { DataTypes } from "sequelize"; + +export default function(sequelize) { + return sequelize.define('Message', { + id: { + type: DataTypes.STRING, + primaryKey: true, + }, + roleEmojiPair: { + deferrable: Deferrable.INITIALLY_IMMEDIATE, + model: 'RoleEmojiPair', + key: 'id', + }, + }); +}