From c1f1acb0ae806c7d7d7ef0a19688aac891457b04 Mon Sep 17 00:00:00 2001 From: NoComment Date: Mon, 26 Feb 2024 21:12:18 +0000 Subject: [PATCH] Add migration for new issue --- .../lilybot/database/migrations/Migrator.kt | 2 ++ .../lilybot/database/migrations/main/mainV10.kt | 12 ++++++++++++ 2 files changed, 14 insertions(+) create mode 100644 src/main/kotlin/org/hyacinthbots/lilybot/database/migrations/main/mainV10.kt diff --git a/src/main/kotlin/org/hyacinthbots/lilybot/database/migrations/Migrator.kt b/src/main/kotlin/org/hyacinthbots/lilybot/database/migrations/Migrator.kt index 8497b07d..4cf1fcec 100644 --- a/src/main/kotlin/org/hyacinthbots/lilybot/database/migrations/Migrator.kt +++ b/src/main/kotlin/org/hyacinthbots/lilybot/database/migrations/Migrator.kt @@ -26,6 +26,7 @@ import org.hyacinthbots.lilybot.database.migrations.config.configV5 import org.hyacinthbots.lilybot.database.migrations.config.configV6 import org.hyacinthbots.lilybot.database.migrations.config.configV7 import org.hyacinthbots.lilybot.database.migrations.main.mainV1 +import org.hyacinthbots.lilybot.database.migrations.main.mainV10 import org.hyacinthbots.lilybot.database.migrations.main.mainV2 import org.hyacinthbots.lilybot.database.migrations.main.mainV3 import org.hyacinthbots.lilybot.database.migrations.main.mainV4 @@ -73,6 +74,7 @@ object Migrator : KordExKoinComponent { 7 -> ::mainV7 8 -> ::mainV8 9 -> ::mainV9 + 10 -> ::mainV10 else -> break }(db.mainDatabase) diff --git a/src/main/kotlin/org/hyacinthbots/lilybot/database/migrations/main/mainV10.kt b/src/main/kotlin/org/hyacinthbots/lilybot/database/migrations/main/mainV10.kt new file mode 100644 index 00000000..b7a156b3 --- /dev/null +++ b/src/main/kotlin/org/hyacinthbots/lilybot/database/migrations/main/mainV10.kt @@ -0,0 +1,12 @@ +package org.hyacinthbots.lilybot.database.migrations.main + +import org.hyacinthbots.lilybot.database.entities.AutoThreadingData +import org.litote.kmongo.coroutine.CoroutineDatabase +import org.litote.kmongo.exists +import org.litote.kmongo.setValue + +suspend fun mainV10(db: CoroutineDatabase) { + with(db.getCollection()) { + updateMany(AutoThreadingData::extraRoleIds exists false, setValue(AutoThreadingData::extraRoleIds, emptyList())) + } +}