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', + }, + }); +}