Réorganisation des sources
This commit is contained in:
@@ -1,23 +0,0 @@
|
||||
const DB = require('../database');
|
||||
const sequelize = require('../database/config/sequelize');
|
||||
const associate = require('../database/relationships');
|
||||
|
||||
// Connect to the database and log a message to the console
|
||||
const connectDB = async () => {
|
||||
try {
|
||||
await sequelize.authenticate();
|
||||
console.log('Connection has been established successfully🔥');
|
||||
|
||||
// Synchronize the database with the models without need of dropping the tables
|
||||
await DB.sequelize.sync({
|
||||
force: false,
|
||||
});
|
||||
|
||||
associate(); // Call the associate function to create the relationships between the models
|
||||
} catch (error) {
|
||||
console.error('Unable to connect to the database:', error);
|
||||
process.exit(1); // Exit the process if the connection is not successful
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = connectDB;
|
||||
Reference in New Issue
Block a user