package com.mrpowergamerbr.loritta.tables

import com.mrpowergamerbr.loritta.utils.exposed.array
import org.jetbrains.exposed.dao.LongIdTable
import org.jetbrains.exposed.sql.TextColumnType

object StoredMessages : LongIdTable() {
	val authorId = long("author_id").index()
	val channelId = long("channel_id")
	val content = text("content")
	val createdAt = long("created_at")
	val editedAt = long("edited_at").nullable()
	val storedAttachments = array<String>("stored_attachments", TextColumnType())
	val initializationVector = text("initialization_vector")
}
package com.mrpowergamerbr.loritta.tables

import com.mrpowergamerbr.loritta.utils.exposed.array
import org.jetbrains.exposed.dao.LongIdTable
import org.jetbrains.exposed.sql.TextColumnType

object StoredMessages : LongIdTable() {
	val authorId = long("author_id").index()
	val channelId = long("channel_id")
	val content = text("content")
	val createdAt = long("created_at").index()
	val editedAt = long("edited_at").nullable()
	val storedAttachments = array<String>("stored_attachments", TextColumnType())
	val initializationVector = text("initialization_vector")
}
Add index for the created_at field
Add index for the created_at field

Sometimes it can take up to 60s just to purge the old stored messages!

LorittaBot/Loritta,LorittaBot/Loritta,LorittaBot/Loritta,LorittaBot/Loritta