From 73cf21c69112d9d2d418caf675e49c579c4a78f2 Mon Sep 17 00:00:00 2001 From: Andreas <6977712+AndreasK79@users.noreply.github.com> Date: Wed, 9 Feb 2022 20:05:40 +0100 Subject: [PATCH] [Migration] Added duplicate check on columns in script 082 --- .../migrations/082_add_reset_pass_to_users.php | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/application/migrations/082_add_reset_pass_to_users.php b/application/migrations/082_add_reset_pass_to_users.php index 90eaada0..27060f8a 100644 --- a/application/migrations/082_add_reset_pass_to_users.php +++ b/application/migrations/082_add_reset_pass_to_users.php @@ -13,12 +13,19 @@ class Migration_add_reset_pass_to_users extends CI_Migration { public function up() { - $fields = array( - 'reset_password_code varchar(50) DEFAULT NULL', - 'reset_password_date TIMESTAMP NULL DEFAULT NULL', - ); + if (!$this->db->field_exists('reset_password_code', 'users')) { + $fields = array( + 'reset_password_code varchar(50) DEFAULT NULL', + ); + $this->dbforge->add_column('users', $fields); + } - $this->dbforge->add_column('users', $fields); + if (!$this->db->field_exists('reset_password_date', 'users')) { + $fields = array( + 'reset_password_date TIMESTAMP NULL DEFAULT NULL', + ); + $this->dbforge->add_column('users', $fields); + } } public function down()