DiscordJS-Example/database.js

22 lines
711 B
JavaScript
Raw Normal View History

2024-01-29 13:59:36 +00:00
import defineRoleEmojiPair from './models/roleEmojiPairs.js';
import defineVoiceChannel from './models/voiceChannels.js';
import defineMessage from './models/messages.js';
2024-01-28 23:30:33 +00:00
import { Sequelize } from 'sequelize';
import { config } from 'dotenv';
config();
const { DB_NAME, DB_USER, DB_PWD, DB_HOST } = process.env;
const sequelize = new Sequelize(DB_NAME, DB_USER, DB_PWD, {
storage: `${DB_NAME}.sqlite`,
dialect: 'sqlite',
logging: false,
host: DB_HOST,
});
2024-01-28 23:32:13 +00:00
const RoleEmojiPair = defineRoleEmojiPair(sequelize);
2024-01-28 23:32:32 +00:00
const VoiceChannel = defineVoiceChannel(sequelize);
2024-01-28 23:31:40 +00:00
const Message = defineMessage(sequelize);
2024-01-28 23:30:33 +00:00
sequelize.sync();
2024-01-28 23:32:32 +00:00
export { sequelize, RoleEmojiPair, VoiceChannel, Message };