<commit_before>const { dbURL } = require('../../config.json');
const Logger = require('../util/Logger');
const path = require('path');
const readdir = require('util').promisify(require('fs').readdir);
const Sequelize = require('sequelize');

const db = new Sequelize(dbURL, { logging: false });

class Database {
	static get db() {
		return db;
	}

	static async authenticate() {
		try {
			await db.authenticate();
			Logger.info('Connection to database has been established successfully.', { tag: 'Postgres' });
			await this.loadModels(path.join(__dirname, '..', 'models'));
		} catch (err) {
			Logger.error('Unable to connect to the database:', { tag: 'Postgres' });
			Logger.stacktrace(err, { tag: 'Postgres' });
			Logger.info('Attempting to connect again in 5 seconds...', { tag: 'Postgres' });
			setTimeout(this.authenticate, 5000);
		}
	}

	static async loadModels(modelsPath) {
		const files = await readdir(modelsPath);

		for (const file of files) {
			const filePath = path.join(modelsPath, file);
			if (!filePath.endsWith('.js')) continue;
			await require(filePath).sync({ alter: true }); // eslint-disable-line no-await-in-loop
		}
	}
}

module.exports = Database;<commit_msg>Remove alter from sync<commit_after>const { dbURL } = require('../../config.json');
const Logger = require('../util/Logger');
const path = require('path');
const readdir = require('util').promisify(require('fs').readdir);
const Sequelize = require('sequelize');

const db = new Sequelize(dbURL, { logging: false });

class Database {
	static get db() {
		return db;
	}

	static async authenticate() {
		try {
			await db.authenticate();
			Logger.info('Connection to database has been established successfully.', { tag: 'Postgres' });
			await this.loadModels(path.join(__dirname, '..', 'models'));
		} catch (err) {
			Logger.error('Unable to connect to the database:', { tag: 'Postgres' });
			Logger.stacktrace(err, { tag: 'Postgres' });
			Logger.info('Attempting to connect again in 5 seconds...', { tag: 'Postgres' });
			setTimeout(this.authenticate, 5000);
		}
	}

	static async loadModels(modelsPath) {
		const files = await readdir(modelsPath);

		for (const file of files) {
			const filePath = path.join(modelsPath, file);
			if (!filePath.endsWith('.js')) continue;
			await require(filePath).sync(); // eslint-disable-line no-await-in-loop
		}
	}
}

module.exports = Database;
{'fraction_non_alphanumeric': 0.1672254819782062, 'fraction_numerical': 0.004191114836546521, 'mean_word_length': 4.200435729847494, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5593915', 'n_tokens_mistral': 816, 'n_tokens_neox': 740, 'n_words': 194}