2024-01-28 23:31:40 +00:00
|
|
|
import defineMessage from './models/message.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:31:40 +00:00
|
|
|
const Message = defineMessage(sequelize);
|
2024-01-28 23:30:33 +00:00
|
|
|
|
|
|
|
sequelize.sync();
|
|
|
|
|
2024-01-28 23:31:40 +00:00
|
|
|
export { sequelize, Message };
|