From c10fadebeb7ea4c95f37ca2cba5b0a42c8c61cb1 Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Sat, 23 Dec 2023 13:36:09 +0000 Subject: [PATCH] Only alter COL_AWARD_SUMMITED if it exists in the qso table --- .../migrations/161_award_submitted_typo.php | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/application/migrations/161_award_submitted_typo.php b/application/migrations/161_award_submitted_typo.php index 762eba84..315562a8 100644 --- a/application/migrations/161_award_submitted_typo.php +++ b/application/migrations/161_award_submitted_typo.php @@ -12,11 +12,20 @@ class Migration_award_submitted_typo extends CI_Migration { public function up() { - $this->db->query( - 'ALTER TABLE ' . - $this->db->escape_identifiers($this->config->item('table_name')) . - ' CHANGE COL_AWARD_SUMMITED COL_AWARD_SUBMITTED VARCHAR(255)' - ); + // if COL_AWARD_SUMMITED column exists, change it to COL_AWARD_SUBMITTED + $fields = $this->db->field_data($this->config->item('table_name')); + foreach ($fields as $field) + { + if ($field->name == 'COL_AWARD_SUMMITED') + { + $this->db->query( + 'ALTER TABLE ' . + $this->db->escape_identifiers($this->config->item('table_name')) . + ' CHANGE COL_AWARD_SUMMITED COL_AWARD_SUBMITTED VARCHAR(255)' + ); + return; + } + } } public function down()