fix missing column (we should call the command and not only write it in the array)

This commit is contained in:
HB9HIL
2024-12-27 14:24:16 +01:00
parent 0fb7afbf36
commit 999dfcdeb3

View File

@@ -137,12 +137,10 @@ class Migration_adif_315 extends CI_Migration {
* https://adif.org/315/ADIF_315_annotated.htm#Primary_Administrative_Subdivision
*/
$prim_subdiv = [];
// Add a column to flag entries as deprecated
$col_check = $this->db->query("SHOW COLUMNS FROM `primary_subdivisions` LIKE 'deprecated';")->num_rows() > 0;
if (!$col_check) {
$prim_subdiv[] = "ALTER TABLE `primary_subdivisions` ADD COLUMN deprecated TINYINT(1) DEFAULT 0;";
$this->db->query("ALTER TABLE `primary_subdivisions` ADD COLUMN deprecated TINYINT(1) DEFAULT 0");
} else {
log_message('info', 'Column "deprecated" already exists, skipping ALTER TABLE.');
}
@@ -158,6 +156,7 @@ class Migration_adif_315 extends CI_Migration {
// Add Unique IDX
$this->add_unique_ix('`primary_subdivisions`','IDX_UNIQ_SUBDIVISON#adif#state#deprecated','`adif`,`state`,`deprecated`');
$prim_subdiv = [];
// Mark 'Märket' as deprecated
$prim_subdiv[] = "UPDATE `primary_subdivisions` SET deprecated = 1 WHERE adif = '5' AND state = '051';";