text: const fs = require('fs')
  const path = require('path')
  const Sequelize = require('sequelize')
  const db = {}
  
  const sequelize = new Sequelize(
    process.env.DB_NAME,
    process.env.DB_USER,
    process.env.DB_PASS,
    {
      dialect: process.env.DB_DIALECT,
      host: process.env.DB_HOST,
      port: process.env.DB_PORT,
      define: {
        charset: 'utf8mb4'
      },
      pool: {
        max: 5,
        min: 0,
        acquire: 30000,
        idle: 10000
      }
    }
  )
  
  fs
    .readdirSync(__dirname)
    .filter(file => file !== 'index.js')
    .forEach((file) => {
      const model = sequelize.import(path.join(__dirname, file))
      db[model.name] = model
    })
  Object
    .keys(db)
    .forEach(function (modelName) {
      if ('associate' in db[modelName]) {
        db[modelName].associate(db)
      }
    })
  
  db.sequelize = sequelize
  db.Sequelize = Sequelize
  
  module.exports = db
  