Skip to content

Commit 8a71d5f

Browse files
committed
Drop the unique key from short and sync changes between v0.4-to-v0.5.sql
and our main schema.
1 parent d8a3470 commit 8a71d5f

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

schema/00_echofish-schema.sql

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -382,9 +382,10 @@ CREATE TABLE `host` (
382382
id int unsigned primary key auto_increment,
383383
ip int unsigned default 0,
384384
fqdn varchar(255) NOT NULL,
385-
short varchar(50) unique,
385+
short varchar(50),
386386
description text,
387-
unique key `host_details` (fqdn,short,ip)
387+
KEY (`short`),
388+
UNIQUE KEY `host_details` (`short`,`fqdn`,`ip`)
388389
) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_unicode_ci;
389390

390391
DROP TABLE IF EXISTS `trail`;

schema/updates/v0.4-to-v0.5.sql

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@ ALTER TABLE `syslog` CHANGE `host` `host` INT UNSIGNED NOT NULL ;
1515

1616
ALTER TABLE `host` DROP PRIMARY KEY;
1717
ALTER TABLE `host` ADD `id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST ;
18-
ALTER TABLE `host` ADD UNIQUE ( `short` );
19-
ALTER TABLE `host` ADD UNIQUE key `host_details` (`fqdn`,`short`,`ip`);
18+
DROP INDEX `short` ON `host`; /* This is meant for the unique index */
19+
CREATE INDEX `short` on `host`(`short`);
20+
CREATE UNIQUE INDEX `host_details` ON `host`(`fqdn`,`short`,`ip`);
2021

2122
UPDATE `syslog` as t1 LEFT JOIN host as t2 ON t1.host=t2.ip SET t1.host=t2.id;
2223
UPDATE `archive` as t1 LEFT JOIN host as t2 ON t1.host=t2.ip SET t1.host=t2.id;

0 commit comments

Comments
 (0)