Skip to content

Commit

Permalink
TheHive-Project#1469 Add information on already migrated entities
Browse files Browse the repository at this point in the history
  • Loading branch information
To-om committed Aug 10, 2020
1 parent 2db770b commit 028b52e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class MigrationStats() {
count = 0
sum = 0
}
def isEmpty: Boolean = count == 0
def isEmpty: Boolean = count == 0L
override def toString: String = if (isEmpty) "0" else (sum / count).toString
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,27 @@ class Output @Inject() (
caseTemplates = caseTemplatesBuilder.result()
caseNumbers = caseNumbersBuilder.result()
alerts = alertsBuilder.result()
if (profiles.nonEmpty ||
organisations.nonEmpty ||
users.nonEmpty ||
impactStatuses.nonEmpty ||
resolutionStatuses.nonEmpty ||
observableTypes.nonEmpty ||
customFields.nonEmpty ||
caseTemplates.nonEmpty ||
caseNumbers.nonEmpty ||
alerts.nonEmpty)
logger.info(s"""Already migrated:
| ${profiles.size} profiles\n
| ${organisations.size} organisations\n
| ${users.size} users\n
| ${impactStatuses.size} impactStatuses\n
| ${resolutionStatuses.size} resolutionStatuses\n
| ${observableTypes.size} observableTypes\n
| ${customFields.size} customFields\n
| ${caseTemplates.size} caseTemplates\n
| ${caseNumbers.size} caseNumbers\n
| ${alerts.size} alerts""".stripMargin)
}

def startMigration(): Try[Unit] = {
Expand Down

0 comments on commit 028b52e

Please sign in to comment.