const knex = require("knex")({
    client: 'mysql',
    connection: {
      host: 'd4291.lon1.stableserver.net',
      user: 'd4291_root',
      password: 'WkRq@cgZ6y8',
      database: 'd4291_swd'
    }
    ,
  pool: {
    min: 10,        // Minimum number of connections
    max: 10000,       // Maximum number of connections
    acquireTimeoutMillis: 60000,  // Wait up to 60 seconds for a free connection
    idleTimeoutMillis: 30000,     // Close idle connections after 30 seconds
    createTimeoutMillis: 30000,
    reapIntervalMillis: 1000,
    propagateCreateError: false   // Prevent crashing when pool is full
  }
    // connection: {
    //   host: 'vps2374.tmdvps.com',
    //   user: 'truepestco_user_uk',
    //   password: '5y=3NnO&CcN&i@%',
    //   database: 'truepestco_db_ma'
    // }

  //   connection: {
  //     host: 'vps2374.tmdvps.com',
  //     user: 'truepestco_user_ma',
  //     password: 'Wj7p{95H$7Z*BFw',
  //     database: 'truepestco_db_ma'
  // }
  });

  class Connection
  {
    constructor()
    {
      console.log("connection has been established (mysql)")
    }
    kp()
    {
        return knex;
    }
  }

  module.exports = Connection;
