rename model code to fit convention

This commit is contained in:
Baipyrus 2024-01-29 14:59:36 +01:00
parent 7468dca986
commit ae8562c536
3 changed files with 14 additions and 11 deletions

View File

@ -1,6 +1,6 @@
import defineRoleEmojiPair from './models/roleEmojiPair.js';
import defineVoiceChannel from './models/voiceChannel.js';
import defineMessage from './models/message.js';
import defineRoleEmojiPair from './models/roleEmojiPairs.js';
import defineVoiceChannel from './models/voiceChannels.js';
import defineMessage from './models/messages.js';
import { Sequelize } from 'sequelize';
import { config } from 'dotenv';
config();

View File

@ -1,15 +1,10 @@
import { DataTypes } from "sequelize";
export default function(sequelize) {
return sequelize.define('Message', {
return sequelize.define('Messages', {
id: {
type: DataTypes.STRING,
primaryKey: true,
},
roleEmojiPair: {
deferrable: Deferrable.INITIALLY_IMMEDIATE,
model: 'RoleEmojiPair',
key: 'id',
},
});
}

View File

@ -1,12 +1,20 @@
import { DataTypes } from "sequelize";
import { DataTypes, Deferrable } from "sequelize";
export default function(sequelize) {
return sequelize.define('RoleEmojiPair', {
return sequelize.define('RoleEmojiPairs', {
id: {
defaultValue: DataTypes.UUIDV4,
type: DataTypes.UUID,
primaryKey: true,
},
message: {
type: DataTypes.STRING,
references: {
deferrable: Deferrable.INITIALLY_IMMEDIATE,
model: 'Messages',
key: 'id',
},
},
role: {
type: DataTypes.STRING,
},