-
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
43feb32
commit c90065c
Showing
10 changed files
with
13 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 3 additions & 18 deletions
21
src/main/kotlin/org/hyacinthbots/lilybot/database/migrations/config/configV7.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,9 @@ | ||
package org.hyacinthbots.lilybot.database.migrations.config | ||
|
||
import com.mongodb.kotlin.client.coroutine.MongoDatabase | ||
import kotlinx.coroutines.flow.toList | ||
import org.hyacinthbots.lilybot.database.entities.AdaptedData | ||
|
||
suspend fun configV7(db: MongoDatabase, tempKeDb: MongoDatabase) { | ||
// Done twice due to updates in the data-adapter | ||
with(db.getCollection<AdaptedData>("ext-pluralkit")) { | ||
val data = find().toList() | ||
|
||
tempKeDb.createCollection("data-ext-pluralkit") // create new with correct name | ||
tempKeDb.getCollection<AdaptedData>("data-ext-pluralkit").insertMany(data) // add the data | ||
drop() // drop old | ||
} | ||
|
||
with(db.getCollection<AdaptedData>("data-ext-pluralkit")) { | ||
val data = find().toList() | ||
|
||
tempKeDb.createCollection("data-ext-pluralkit") // create new | ||
tempKeDb.getCollection<AdaptedData>("data-ext-pluralkit").insertMany(data) // add the data | ||
drop() // drop old | ||
} | ||
suspend fun configV7(db: MongoDatabase) { | ||
db.getCollection<AdaptedData>("ext-pluralkit").drop() | ||
db.getCollection<AdaptedData>("data-ext-pluralkit").drop() | ||
} |