added role-emoji-pair to database

This commit is contained in:
Baipyrus 2024-01-29 00:32:13 +01:00
parent c19ef05c82
commit 56a2c697dc
2 changed files with 20 additions and 1 deletions

View File

@ -1,3 +1,4 @@
import defineRoleEmojiPair from './models/roleEmojiPair.js';
import defineMessage from './models/message.js';
import { Sequelize } from 'sequelize';
import { config } from 'dotenv';
@ -10,8 +11,9 @@ const sequelize = new Sequelize(DB_NAME, DB_USER, DB_PWD, {
logging: false,
host: DB_HOST,
});
const RoleEmojiPair = defineRoleEmojiPair(sequelize);
const Message = defineMessage(sequelize);
sequelize.sync();
export { sequelize, Message };
export { sequelize, RoleEmojiPair, Message };

17
models/roleEmojiPair.js Normal file
View File

@ -0,0 +1,17 @@
import { DataTypes } from "sequelize";
export default function(sequelize) {
return sequelize.define('RoleEmojiPair', {
id: {
defaultValue: DataTypes.UUIDV4,
type: DataTypes.UUID,
primaryKey: true,
},
role: {
type: DataTypes.STRING,
},
emoji: {
type: DataTypes.STRING,
}
});
}