<commit_before><?php

if(!CM_Db_Db::existsColumn('cm_tmp_location', 'coordinates')) {
	CM_Db_Db::exec('ALTER TABLE `cm_tmp_location` ADD COLUMN `coordinates` point NOT NULL');
	CM_Db_Db::exec('UPDATE `cm_tmp_location` SET `coordinates` = POINT( lat, lon )');
	CM_Db_Db::exec("UPDATE `cm_tmp_location` SET `coordinates` = POINT( 0, 0) WHERE `coordinates` = ''");
	CM_Db_Db::exec('CREATE SPATIAL INDEX `coordinates_spatial` ON cm_tmp_location(`coordinates`)');

	CM_Db_Db::exec('ALTER TABLE `cm_tmp_location` DROP COLUMN `lat`');
	CM_Db_Db::exec('ALTER TABLE `cm_tmp_location` DROP COLUMN `lon`');
}

if(!CM_Db_Db::existsColumn('cm_locationCity', 'coordinates')) {
	CM_Db_Db::exec('ALTER TABLE `cm_locationCity` ADD COLUMN `coordinates` point default POINT(0, 0)');
	CM_Db_Db::exec('UPDATE `cm_locationCity` SET `coordinates` = POINT( lat, lon )');
	CM_Db_Db::exec("UPDATE `cm_locationCity` SET `coordinates` = POINT( 0, 0) WHERE `coordinates` = ''");
	CM_Db_Db::exec('CREATE SPATIAL INDEX `coordinates_spatial` ON cm_tmp_location(`coordinates`)');
}

<commit_msg>Refactored update script<commit_after><?php

if(!CM_Db_Db::existsColumn('cm_tmp_location', 'coordinates')) {
	CM_Db_Db::exec('ALTER TABLE `cm_tmp_location` ADD COLUMN `coordinates` point NOT NULL');
	CM_Db_Db::exec('UPDATE `cm_tmp_location` SET `coordinates` = POINT( lat, lon )');
	CM_Db_Db::exec("UPDATE `cm_tmp_location` SET `coordinates` = POINT( 0, 0) WHERE `coordinates` = ''");
	CM_Db_Db::exec('CREATE SPATIAL INDEX `coordinates_spatial` ON cm_tmp_location(`coordinates`)');

	CM_Db_Db::exec('ALTER TABLE `cm_tmp_location` DROP COLUMN `lat`');
	CM_Db_Db::exec('ALTER TABLE `cm_tmp_location` DROP COLUMN `lon`');
}

{'fraction_non_alphanumeric': 0.16399286987522282, 'fraction_numerical': 0.004753416518122401, 'mean_word_length': 8.790697674418604, 'pattern_counts': {'":': 0, '<': 5, '<?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': '7026396', 'n_tokens_mistral': 638, 'n_tokens_neox': 634, 'n_words': 128}