From fb1e949acf923245a6a7d19832d034b82d632b0c Mon Sep 17 00:00:00 2001 From: Michael Cullen Date: Fri, 17 May 2019 02:00:11 +0100 Subject: [PATCH] dxcc tables: extend prefix/call field to 32 characters While importing the clublog data, I noticed there's an entry with a 11 character callsign. This is longer than the 10 characters allowed for the field, causing a problem. This commit extends it to 32 characters, which should be more than enough, while also being a power of 2. fixes #272 --- application/config/migration.php | 2 +- .../migrations/015_extenddxccprefix.php | 19 +++++++++++++++++++ install/assets/install.sql | 12 ++++++------ 3 files changed, 26 insertions(+), 7 deletions(-) create mode 100644 application/migrations/015_extenddxccprefix.php diff --git a/application/config/migration.php b/application/config/migration.php index be1022fd..4b5f4a0c 100644 --- a/application/config/migration.php +++ b/application/config/migration.php @@ -21,7 +21,7 @@ $config['migration_enabled'] = TRUE; | be upgraded / downgraded to. | */ -$config['migration_version'] = 14; +$config['migration_version'] = 15; /* |-------------------------------------------------------------------------- diff --git a/application/migrations/015_extenddxccprefix.php b/application/migrations/015_extenddxccprefix.php new file mode 100644 index 00000000..a608616a --- /dev/null +++ b/application/migrations/015_extenddxccprefix.php @@ -0,0 +1,19 @@ +db->query("ALTER TABLE dxcc CHANGE COLUMN `prefix` `prefix` varchar(32) NOT NULL; # was varchar(10) NOT NULL"); + $this->db->query("ALTER TABLE dxcc_entities CHANGE COLUMN `prefix` `prefix` varchar(32) NOT NULL; # was varchar(10) NOT NULL"); + $this->db->query("ALTER TABLE dxcc_exceptions CHANGE COLUMN `call` `call` varchar(32) NOT NULL; # was varchar(10) NOT NULL"); + $this->db->query("ALTER TABLE dxcc_prefixes CHANGE COLUMN `call` `call` varchar(32) NOT NULL; # was varchar(10) NOT NULL"); + } + + public function down(){ + $this->db->query("ALTER TABLE dxcc CHANGE COLUMN `prefix` `prefix` varchar(10) NOT NULL; # was varchar(10) NOT NULL"); + $this->db->query("ALTER TABLE dxcc_entities CHANGE COLUMN `prefix` `prefix` varchar(10) NOT NULL; # was varchar(10) NOT NULL"); + $this->db->query("ALTER TABLE dxcc_exceptions CHANGE COLUMN `call` `call` varchar(10) NOT NULL; # was varchar(10) NOT NULL"); + $this->db->query("ALTER TABLE dxcc_prefixes CHANGE COLUMN `call` `call` varchar(10) NOT NULL; # was varchar(10) NOT NULL"); + } +} diff --git a/install/assets/install.sql b/install/assets/install.sql index 7f461cf5..747e67e4 100755 --- a/install/assets/install.sql +++ b/install/assets/install.sql @@ -115,7 +115,7 @@ CREATE TABLE `contests` ( -- ---------------------------- DROP TABLE IF EXISTS `dxcc`; CREATE TABLE `dxcc` ( - `prefix` varchar(10) NOT NULL, + `prefix` varchar(32) NOT NULL, `name` varchar(150) DEFAULT NULL, `cqz` float NOT NULL, `ituz` float NOT NULL, @@ -3555,7 +3555,7 @@ CREATE TABLE `migrations` ( -- ---------------------------- -- Records of migrations -- ---------------------------- -INSERT INTO `migrations` VALUES ('14'); +INSERT INTO `migrations` VALUES ('15'); -- ---------------------------- -- Table structure for notes @@ -3909,7 +3909,7 @@ INSERT INTO `users` VALUES ('4', 'm0abc', '$2a$08$r9UF3YhipAY6htSQoZRjeOFDx3Yuh7 CREATE TABLE `dxcc_entities` ( `adif` smallint(6) NOT NULL, `name` varchar(150) DEFAULT NULL, - `prefix` varchar(10) NOT NULL, + `prefix` varchar(32) NOT NULL, `cqz` smallint(6) NOT NULL, `ituz` smallint(6) NOT NULL, `cont` varchar(5) NOT NULL, @@ -3921,7 +3921,7 @@ CREATE TABLE `dxcc_entities` ( CREATE TABLE `dxcc_exceptions` ( `record` int(11) NOT NULL, - `call` varchar(10) DEFAULT NULL, + `call` varchar(32) DEFAULT NULL, `entity` varchar(255) NOT NULL, `adif` smallint(6) NOT NULL, `cqz` smallint(6) NOT NULL, @@ -3934,7 +3934,7 @@ CREATE TABLE `dxcc_exceptions` ( CREATE TABLE `dxcc_prefixes` ( `record` int(11) NOT NULL, - `call` varchar(10) DEFAULT NULL, + `call` varchar(32) DEFAULT NULL, `entity` varchar(255) NOT NULL, `adif` smallint(6) NOT NULL, `cqz` smallint(6) NOT NULL, @@ -3961,4 +3961,4 @@ ALTER TABLE `dxcc_exceptions` -- Indexes for table `dxcc_prefixes` -- ALTER TABLE `dxcc_prefixes` - ADD PRIMARY KEY (`record`); \ No newline at end of file + ADD PRIMARY KEY (`record`);