Skip to content
Permalink
Browse files

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
  • Loading branch information...
Michael Cullen
Michael Cullen committed May 17, 2019
1 parent 2f85b19 commit fb1e949acf923245a6a7d19832d034b82d632b0c
Showing with 26 additions and 7 deletions.
  1. +1 −1 application/config/migration.php
  2. +19 −0 application/migrations/015_extenddxccprefix.php
  3. +6 −6 install/assets/install.sql
@@ -21,7 +21,7 @@
| be upgraded / downgraded to.
|
*/
$config['migration_version'] = 14;
$config['migration_version'] = 15;
/*
|--------------------------------------------------------------------------
@@ -0,0 +1,19 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
class Migration_extenddxccprefix extends CI_Migration {
public function up()
{
$this->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");
}
}
@@ -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`);
ADD PRIMARY KEY (`record`);

0 comments on commit fb1e949

Please sign in to comment.
You can’t perform that action at this time.