From 0c7bc08f9374b6e10d9bfaf54f06fc2c6c30c606 Mon Sep 17 00:00:00 2001 From: To-om Date: Wed, 3 Jun 2020 12:20:55 +0200 Subject: [PATCH] #1340 Add missing index on tags --- thehive/app/org/thp/thehive/models/SchemaUpdater.scala | 1 + thehive/app/org/thp/thehive/models/Tag.scala | 9 +++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/thehive/app/org/thp/thehive/models/SchemaUpdater.scala b/thehive/app/org/thp/thehive/models/SchemaUpdater.scala index 3ca07f5332..558ea352c6 100644 --- a/thehive/app/org/thp/thehive/models/SchemaUpdater.scala +++ b/thehive/app/org/thp/thehive/models/SchemaUpdater.scala @@ -58,5 +58,6 @@ class SchemaUpdater @Inject() (theHiveSchema: TheHiveSchema, db: Database, userS removeIndexLock("DataData") removePropertyLock("data") } + .addIndex("Tag", IndexType.tryUnique, "namespace", "predicate", "value") .execute(db)(userSrv.getSystemAuthContext) } diff --git a/thehive/app/org/thp/thehive/models/Tag.scala b/thehive/app/org/thp/thehive/models/Tag.scala index 9648caacd7..faf2aebb16 100644 --- a/thehive/app/org/thp/thehive/models/Tag.scala +++ b/thehive/app/org/thp/thehive/models/Tag.scala @@ -1,12 +1,13 @@ package org.thp.thehive.models -import scala.util.Try -import scala.util.matching.Regex - +import org.thp.scalligraph.VertexEntity +import org.thp.scalligraph.models.{DefineIndex, IndexType} import play.api.Logger -import org.thp.scalligraph.VertexEntity +import scala.util.Try +import scala.util.matching.Regex +@DefineIndex(IndexType.tryUnique, "namespace", "predicate", "value") @VertexEntity case class Tag( namespace: String,