-
-
Notifications
You must be signed in to change notification settings - Fork 24
/
mainV1.kt
69 lines (64 loc) · 1.76 KB
/
mainV1.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package org.hyacinthbots.lilybot.database.migrations.main
import org.hyacinthbots.lilybot.database.entities.StatusData
import org.litote.kmongo.coroutine.CoroutineDatabase
// This was commented out due to the remindme data class being removed
suspend fun mainV1(db: CoroutineDatabase) {
// val reminders = db.getCollection<RemindMeData>("remindMeData")
//
// val repeating = mutableListOf<ReplaceOneModel<RemindMeData>>()
// val nonRepeating = mutableListOf<ReplaceOneModel<RemindMeData>>()
// reminders.find().consumeEach {
// if (it.repeating) {
// repeating.add(
// replaceOne(
// RemindMeData::initialSetTime eq it.initialSetTime,
//
// RemindMeData(
// it.initialSetTime,
// it.guildId,
// it.userId,
// it.channelId,
// it.remindTime,
// it.originalMessageUrl,
// it.customMessage,
// true,
// DateTimePeriod(days = 1),
// it.id
// ),
//
// replaceUpsert()
// )
// )
// } else {
// nonRepeating.add(
// replaceOne(
// RemindMeData::initialSetTime eq it.initialSetTime,
//
// RemindMeData(
// it.initialSetTime,
// it.guildId,
// it.userId,
// it.channelId,
// it.remindTime,
// it.originalMessageUrl,
// it.customMessage,
// false,
// null,
// it.id
// ),
//
// replaceUpsert()
// )
// )
// }
// }
// if (repeating.isNotEmpty()) {
// reminders.bulkWrite(requests = repeating, BulkWriteOptions().ordered(true))
// }
// if (nonRepeating.isNotEmpty()) {
// reminders.bulkWrite(requests = nonRepeating, BulkWriteOptions().ordered(true))
// }
db.dropCollection("statusData")
db.createCollection("statusData")
db.getCollection<StatusData>("statusData").insertOne(StatusData(null))
}