<commit_before>const fs = require('fs');
const path = require('path');
const Sequelize = require('sequelize');
const config = require('../../config');
const dbConfig = require('../../config/db')[config.environment];

const basename = path.basename(__filename);
const db = {};
const sequelize = new Sequelize(dbConfig.database, dbConfig.username, dbConfig.password, dbConfig);

fs.readdirSync(__dirname)
  .filter(file => file.indexOf('.') !== 0 && file !== basename && file.slice(-3) === '.js')
  .forEach(file => {
    const model = sequelize.import(path.join(__dirname, file));
    db[model.name] = model;
  });

Object.keys(db).forEach(modelName => {
  if (db[modelName].associate) db[modelName].associate(db);
});

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

module.exports = db;<commit_msg>fix: fixing sequelize model imports, due to sequelize version upgrade (#549)<commit_after>const fs = require('fs');
const path = require('path');
const Sequelize = require('sequelize');
const config = require('../../config');
const dbConfig = require('../../config/db')[config.environment];

const basename = path.basename(__filename);
const db = {};
const sequelize = new Sequelize(dbConfig.database, dbConfig.username, dbConfig.password, dbConfig);

fs.readdirSync(__dirname)
  .filter(file => file.indexOf('.') !== 0 && file !== basename && file.slice(-3) === '.js')
  .forEach(file => {
    // eslint-disable-next-line global-require
    const model = require(path.join(__dirname, file))(sequelize, Sequelize.DataTypes);
    db[model.name] = model;
  });

Object.keys(db).forEach(modelName => {
  if (db[modelName].associate) db[modelName].associate(db);
});

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

module.exports = db;
{'fraction_non_alphanumeric': 0.1860999425617461, 'fraction_numerical': 0.00402067777139575, 'mean_word_length': 4.945392491467577, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '814856', 'n_tokens_mistral': 562, 'n_tokens_neox': 549, 'n_words': 116}