generated from Baipyrus/DiscordJS-Template
added message to database
This commit is contained in:
parent
8a619b53e4
commit
c19ef05c82
@ -1,3 +1,4 @@
|
|||||||
|
import defineMessage from './models/message.js';
|
||||||
import { Sequelize } from 'sequelize';
|
import { Sequelize } from 'sequelize';
|
||||||
import { config } from 'dotenv';
|
import { config } from 'dotenv';
|
||||||
config();
|
config();
|
||||||
@ -9,7 +10,8 @@ const sequelize = new Sequelize(DB_NAME, DB_USER, DB_PWD, {
|
|||||||
logging: false,
|
logging: false,
|
||||||
host: DB_HOST,
|
host: DB_HOST,
|
||||||
});
|
});
|
||||||
|
const Message = defineMessage(sequelize);
|
||||||
|
|
||||||
sequelize.sync();
|
sequelize.sync();
|
||||||
|
|
||||||
export { sequelize };
|
export { sequelize, Message };
|
||||||
|
15
models/message.js
Normal file
15
models/message.js
Normal file
@ -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',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user