mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Idk if this will work, but may as well try
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
const Sequelize = require('sequelize');
|
||||
|
||||
const database = new Sequelize(process.env.DB_URL, { logging: false });
|
||||
|
||||
class Database {
|
||||
static get db() {
|
||||
return database;
|
||||
}
|
||||
|
||||
start() {
|
||||
database.authenticate()
|
||||
.then(() => console.log('Connection to database has been established successfully.'))
|
||||
.then(() => console.log('Synchronizing database...'))
|
||||
.then(() => database.sync()
|
||||
.then(() => console.log('Synchronizing database done!'))
|
||||
.catch(error => console.error(`Error synchronizing the database: ${error}`))
|
||||
)
|
||||
.then(() => console.log('Ready to rock!'))
|
||||
.catch(err => console.error(`Unable to connect to the database: ${err}`));
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Database;
|
||||
Reference in New Issue
Block a user