Unverified Commit d6566e37 authored by Gavin Brown's avatar Gavin Brown
Browse files

add a unique index

parent 70e050ae
...@@ -505,6 +505,7 @@ sub initialise_sqlite { ...@@ -505,6 +505,7 @@ sub initialise_sqlite {
$db->do(sprintf('CREATE INDEX IF NOT EXISTS `end_time_idx` ON %s(`end_time`)', $tbl)); $db->do(sprintf('CREATE INDEX IF NOT EXISTS `end_time_idx` ON %s(`end_time`)', $tbl));
$db->do(sprintf('CREATE INDEX IF NOT EXISTS `family_idx` ON %s(`family`)', $tbl)); $db->do(sprintf('CREATE INDEX IF NOT EXISTS `family_idx` ON %s(`family`)', $tbl));
$db->do(sprintf('CREATE INDEX IF NOT EXISTS `proto_idx` ON %s(`proto`)', $tbl)); $db->do(sprintf('CREATE INDEX IF NOT EXISTS `proto_idx` ON %s(`proto`)', $tbl));
$db->do(sprintf('CREATE UNIQUE INDEX IF NOT EXISTS `unique_idx` ON %s(`node_id`, `start_time`, `host`, `family`, `proto`)', $tbl));
$db->commit; $db->commit;
...@@ -543,6 +544,7 @@ sub initialise_mysql { ...@@ -543,6 +544,7 @@ sub initialise_mysql {
$db->do(sprintf('CREATE INDEX IF NOT EXISTS `end_time_idx` ON %s(`end_time`)', $tbl)); $db->do(sprintf('CREATE INDEX IF NOT EXISTS `end_time_idx` ON %s(`end_time`)', $tbl));
$db->do(sprintf('CREATE INDEX IF NOT EXISTS `family_idx` ON %s(`family`)', $tbl)); $db->do(sprintf('CREATE INDEX IF NOT EXISTS `family_idx` ON %s(`family`)', $tbl));
$db->do(sprintf('CREATE INDEX IF NOT EXISTS `proto_idx` ON %s(`proto`)', $tbl)); $db->do(sprintf('CREATE INDEX IF NOT EXISTS `proto_idx` ON %s(`proto`)', $tbl));
$db->do(sprintf('CREATE UNIQUE INDEX IF NOT EXISTS `unique_idx` ON %s(`node_id`, `start_time`, `host`, `family`, `proto`)', $tbl));
$db->disconnect(); $db->disconnect();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment