const Sequelize = require("sequelize");
const db = {}
const sequelize = new Sequelize("pcaco6bd_DB_TTHH", "pcaco6bd_TTHH", "TTHH2025%%", {    
host: 'pcacompany.com.ec', dialect: "mysql", operatorsAliase: false,

//const sequelize = new Sequelize("copca1_DB_TTHH_DESARROLLO", "copca1_TTHH", "TTHH2025%%", {
//    host: 'appscompanypca.com', dialect: "mysql", operatorsAliase: false,
    define: { freezeTableName: true, plural: false },
    pool: { max: 5, min: 0, acquire: 30000, idle: 10000 }
});


db.sequelize = sequelize;
db.Sequelize = Sequelize;

sequelize
    .authenticate()
    .then(() => {
        console.log('Connection has been established successfully.');
    })
    .catch(err => {
        console.error('Unable to connect to the database:', err);
    });

module.exports = db;