From e8be6f86202658dae062f0b59148098779b70c10 Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Mon, 27 Sep 2021 15:07:38 +0100 Subject: [PATCH] Only create the fields in db if they arent there --- application/migrations/073_add_userid_to_station_profiles.php | 4 +++- .../074_add_active_station_logbook_to_user_table.php | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/application/migrations/073_add_userid_to_station_profiles.php b/application/migrations/073_add_userid_to_station_profiles.php index fd97b925..7a2c5161 100644 --- a/application/migrations/073_add_userid_to_station_profiles.php +++ b/application/migrations/073_add_userid_to_station_profiles.php @@ -10,7 +10,9 @@ class Migration_add_userid_to_station_profiles extends CI_Migration { 'user_id BIGINT(20) DEFAULT NULL', ); - $this->dbforge->add_column('station_profile', $fields); + if (!$this->db->field_exists('user_id', 'station_profile')) { + $this->dbforge->add_column('station_profile', $fields); + } } public function down() diff --git a/application/migrations/074_add_active_station_logbook_to_user_table.php b/application/migrations/074_add_active_station_logbook_to_user_table.php index 61bc1718..89967405 100644 --- a/application/migrations/074_add_active_station_logbook_to_user_table.php +++ b/application/migrations/074_add_active_station_logbook_to_user_table.php @@ -15,7 +15,9 @@ class Migration_add_active_station_logbook_to_user_table extends CI_Migration { 'active_station_logbook int(11)', ); - $this->dbforge->add_column('users', $fields); + if (!$this->db->field_exists('active_station_logbook', 'users')) { + $this->dbforge->add_column('users', $fields); + } } public function down()