<commit_before>exports.drop = function (driver, opts, cb) {
	var i, queries = [], pending;

	queries.push("DROP TABLE IF EXISTS " + driver.query.escapeId(opts.table));

	for (i = 0; i < opts.many_associations.length; i++) {
		queries.push("DROP TABLE IF EXISTS " + driver.query.escapeId(opts.many_associations[i].mergeTable));
	}

	pending = queries.length;

	if (driver.opts.pool) {
		return driver.db.pool.getConnection(function (err, db) {
			for (i = 0; i < queries.length; i++) {
				db.query(queries[i], function (err) {
					if (--pending === 0) {
						return cb(err);
					}
				});
			}
		});
	}

	for (i = 0; i < queries.length; i++) {
		driver.db.query(queries[i], function (err) {
			if (--pending === 0) {
				return cb(err);
			}
		});
	}
};

exports.sync = function (driver, opts, cb) {
	var queries = [];
	var definitions = [];
	var k, i, pending;
	var primary_keys = opts.keys.map(function (k) { return driver.query.escapeId(k); });
	var keys = [];

	for (i = 0; i < opts.keys.length; i++) {
		if (opts.properties.hasOwnProperty(opts.keys[i])) continue;

		keys.push(driver.query.escapeId(opts.keys[i]));
	}

	for (i = 0; i < keys.length; i++) {
		definitions.push(keys[i] + " INT(11) UNSIGNED NOT NULL");
	}
	if (opts.keys.length == 1) {
		definitions[definitions.length - 1] += " AUTO_INCREMENT";
	}

	for (k in opts.properties) {
		definitions.push(buildColumnDefinition(driver, k, opts.properties[k]));
	}

	for (i = 0; i < opts.one_associations.length; i++) {
		if (opts.one_associations[i].reversed) continue;
		definitions.push(
			driver.query.escapeId(opts.one_associations[i].field) + " INT(11) UNSIGNED" +
			(opts.one_associations[i].required ? ' NOT NULL' : '')
		);
	}

	for (k in opts.properties) {
		if (opts.properties[k].unique === true) {
			definitions.push("UNIQUE KEY " + driver.query.escapeId(k) + " (" + driver.query.escapeId(k) + ")");
		} else if (opts.properties[k].index) {
			definitions.push("INDEX (" + driver.query.escapeId(k) + ")");
		}
	}
	for (i = 0; i < opts.one_associations.length; i++) {
		if (opts.one_associations[i].reversed) continue;
		definitions.push("INDEX (" + driver.query.escapeId(opts.one_associations[i].field) + ")");
	}
	for (i = 0; i < opts.indexes.length; i++) {
		definitions.push("INDEX (" + opts.indexes[i].split(/[,;]+/).map(function (el) {
			return driver.query.escapeId(el);
		}).join(", ") + ")");
	}

	definitions.push("PRIMARY KEY (" + primary_keys.join(", ") + ")");

	queries.push(
		"CREATE TABLE IF NOT EXISTS " + driver.query.escapeId(opts.table) +
		" (" + definitions.join(", ") + ")"
	);
	console.log("CREATE TABLE IF NOT EXISTS " + driver.query.escapeId(opts.table) +
		" (" + definitions.join(", ") + ")");

	for (i = 0; i < opts.many_associations.length; i++) {
		definitions = [];

		definitions.push(driver.query.escapeId(opts.many_associations[i].mergeId) + " INT(11) UNSIGNED NOT NULL");
		definitions.push(driver.query.escapeId(opts.many_associations[i].mergeAssocId) + " INT(11) UNSIGNED NOT NULL");

		for (k in opts.many_associations[i].props) {<commit_msg>Removes console.log from mysql DDL<commit_after>exports.drop = function (driver, opts, cb) {
	var i, queries = [], pending;

	queries.push("DROP TABLE IF EXISTS " + driver.query.escapeId(opts.table));

	for (i = 0; i < opts.many_associations.length; i++) {
		queries.push("DROP TABLE IF EXISTS " + driver.query.escapeId(opts.many_associations[i].mergeTable));
	}

	pending = queries.length;

	if (driver.opts.pool) {
		return driver.db.pool.getConnection(function (err, db) {
			for (i = 0; i < queries.length; i++) {
				db.query(queries[i], function (err) {
					if (--pending === 0) {
						return cb(err);
					}
				});
			}
		});
	}

	for (i = 0; i < queries.length; i++) {
		driver.db.query(queries[i], function (err) {
			if (--pending === 0) {
				return cb(err);
			}
		});
	}
};

exports.sync = function (driver, opts, cb) {
	var queries = [];
	var definitions = [];
	var k, i, pending;
	var primary_keys = opts.keys.map(function (k) { return driver.query.escapeId(k); });
	var keys = [];

	for (i = 0; i < opts.keys.length; i++) {
		if (opts.properties.hasOwnProperty(opts.keys[i])) continue;

		keys.push(driver.query.escapeId(opts.keys[i]));
	}

	for (i = 0; i < keys.length; i++) {
		definitions.push(keys[i] + " INT(11) UNSIGNED NOT NULL");
	}
	if (opts.keys.length == 1) {
		definitions[definitions.length - 1] += " AUTO_INCREMENT";
	}

	for (k in opts.properties) {
		definitions.push(buildColumnDefinition(driver, k, opts.properties[k]));
	}

	for (i = 0; i < opts.one_associations.length; i++) {
		if (opts.one_associations[i].reversed) continue;
		definitions.push(
			driver.query.escapeId(opts.one_associations[i].field) + " INT(11) UNSIGNED" +
			(opts.one_associations[i].required ? ' NOT NULL' : '')
		);
	}

	for (k in opts.properties) {
		if (opts.properties[k].unique === true) {
			definitions.push("UNIQUE KEY " + driver.query.escapeId(k) + " (" + driver.query.escapeId(k) + ")");
		} else if (opts.properties[k].index) {
			definitions.push("INDEX (" + driver.query.escapeId(k) + ")");
		}
	}
	for (i = 0; i < opts.one_associations.length; i++) {
		if (opts.one_associations[i].reversed) continue;
		definitions.push("INDEX (" + driver.query.escapeId(opts.one_associations[i].field) + ")");
	}
	for (i = 0; i < opts.indexes.length; i++) {
		definitions.push("INDEX (" + opts.indexes[i].split(/[,;]+/).map(function (el) {
			return driver.query.escapeId(el);
		}).join(", ") + ")");
	}

	definitions.push("PRIMARY KEY (" + primary_keys.join(", ") + ")");

	queries.push(
		"CREATE TABLE IF NOT EXISTS " + driver.query.escapeId(opts.table) +
		" (" + definitions.join(", ") + ")"
	);

	for (i = 0; i < opts.many_associations.length; i++) {
		definitions = [];

		definitions.push(driver.query.escapeId(opts.many_associations[i].mergeId) + " INT(11) UNSIGNED NOT NULL");
		definitions.push(driver.query.escapeId(opts.many_associations[i].mergeAssocId) + " INT(11) UNSIGNED NOT NULL");

		for (k in opts.many_associations[i].props) {
{'fraction_non_alphanumeric': 0.19694453669877118, 'fraction_numerical': 0.006974427100631019, 'mean_word_length': 3.787758346581876, 'pattern_counts': {'":': 0, '<': 21, '<?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': '6240350', 'n_tokens_mistral': 2430, 'n_tokens_neox': 2216, 'n_words': 417}