From 3d7c5b5c6e8260f99c2878deb547b0b5994b47a4 Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Thu, 7 Sep 2023 15:17:39 +0100 Subject: [PATCH] [Migration] Make the callsign field in the table lotw_users unique Make the callsign field in the table lotw_users unique to stop issue #2469 happening again --- application/config/migration.php | 2 +- .../migrations/142_lotw_users_call_unique.php | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 application/migrations/142_lotw_users_call_unique.php diff --git a/application/config/migration.php b/application/config/migration.php index ff4a5901..0ced4c6e 100644 --- a/application/config/migration.php +++ b/application/config/migration.php @@ -22,7 +22,7 @@ $config['migration_enabled'] = TRUE; | */ -$config['migration_version'] = 141; +$config['migration_version'] = 142; /* |-------------------------------------------------------------------------- diff --git a/application/migrations/142_lotw_users_call_unique.php b/application/migrations/142_lotw_users_call_unique.php new file mode 100644 index 00000000..0f561fad --- /dev/null +++ b/application/migrations/142_lotw_users_call_unique.php @@ -0,0 +1,16 @@ +db->query("ALTER TABLE lotw_users ADD UNIQUE `callsign_index` (`callsign`);"); + } + + public function down(){ + // Update lotw_users and make the callsign column not unique + $this->db->query("ALTER TABLE lotw_users DROP UNIQUE `callsign_index`;"); + } +}