Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ kotlin.code.style=official
org.gradle.jvmargs=-Xmx2G

# Mod Properties
modVersion = 1.3.21
modVersion = 1.3.22
mavenGroup = com.github.quiltservertools
modId = ledger
modName = Ledger
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ object DatabaseSpec : ConfigSpec() {
val batchDelay by optional<Int>(10)
val logSQL by optional<Boolean>(false)
val location by optional<String?>(null)
val updateSchema by optional<Boolean>(false)
}

fun Config.getDatabasePath(): Path {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,12 @@ object DatabaseManager {
Tables.Sources,
Tables.Worlds,
)
try {
exec("CREATE INDEX IF NOT EXISTS actions_time ON actions(time)")
} catch (e: java.sql.SQLException) {
logWarn("Could not create actions_time index (MySQL 8.0.12+ required if using MySQL): ${e.message}")
if (config[DatabaseSpec.updateSchema]) {
try {
exec("CREATE INDEX IF NOT EXISTS actions_time ON actions(time)")
} catch (e: java.sql.SQLException) {
logWarn("Could not create actions_time index (MySQL 8.0.12+ required if using MySQL): ${e.message}")
}
}
logInfo("Tables created")
}
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/ledger.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ batchSize = 1000
batchDelay = 10
# The location of the database file. Defaults to the world folder if not specified
#location = "./custom-dir"
# Allow the database format to be updated on startup (can be slow)
updateSchema = false

[search]
# Number of actions to show per page
Expand Down
Loading