Minor fixes

This commit is contained in:
Potatoboy9999 2024-04-10 10:14:10 -07:00
parent c583e32bab
commit 9f1f12318d
No known key found for this signature in database
GPG Key ID: 59B6B6930BF7F2AB
6 changed files with 20 additions and 7 deletions

View File

@ -28,6 +28,8 @@ url = ""
username = "" username = ""
password = "" password = ""
properties = [] properties = []
maxPoolSize = 10
connectionTimeout = 60000
``` ```
`url`: Must be URL of database with `/<database_name>` appended. An example URL would be `localhost/ledger`. You can optionally add port information such as `localhost:3000/ledger` `url`: Must be URL of database with `/<database_name>` appended. An example URL would be `localhost/ledger`. You can optionally add port information such as `localhost:3000/ledger`
@ -41,6 +43,15 @@ url = ""
username = "" username = ""
password = "" password = ""
properties = [] properties = []
maxPoolSize = 10
connectionTimeout = 60000
```
## SQLite
```toml
[database_extensions]
database = "SQLITE"
``` ```
## Connector properties ## Connector properties

View File

@ -11,6 +11,3 @@ org.gradle.jvmargs=-Xmx2G
mod_version = 1.2.0 mod_version = 1.2.0
maven_group = net.quiltservertools maven_group = net.quiltservertools
archives_base_name = ledger-databases archives_base_name = ledger-databases
# Dependencies
fabric_version=0.58.0+1.19

View File

@ -26,6 +26,9 @@ object MySQL : LedgerDatabase {
addDataSourceProperty("useLocalSessionState", true) addDataSourceProperty("useLocalSessionState", true)
addDataSourceProperty("elideSetAutoCommits", true) addDataSourceProperty("elideSetAutoCommits", true)
addDataSourceProperty("alwaysSendSetIsolation", false) addDataSourceProperty("alwaysSendSetIsolation", false)
addDataSourceProperty("useJDBCCompliantTimezoneShift", true)
addDataSourceProperty("useLegacyDatetimeCode", false)
addDataSourceProperty("serverTimezone", "UTC")
for ((key, value) in Ledger.config[DatabaseExtensionSpec.properties]) { for ((key, value) in Ledger.config[DatabaseExtensionSpec.properties]) {
addDataSourceProperty(key, value) addDataSourceProperty(key, value)
} }

View File

@ -14,6 +14,7 @@ object PostgreSQL : LedgerDatabase {
username = Ledger.config[DatabaseExtensionSpec.userName] username = Ledger.config[DatabaseExtensionSpec.userName]
password = Ledger.config[DatabaseExtensionSpec.password] password = Ledger.config[DatabaseExtensionSpec.password]
maximumPoolSize = Ledger.config[DatabaseExtensionSpec.maxPoolSize] maximumPoolSize = Ledger.config[DatabaseExtensionSpec.maxPoolSize]
addDataSourceProperty("reWriteBatchedInserts", "true")
for ((key, value) in Ledger.config[DatabaseExtensionSpec.properties]) { for ((key, value) in Ledger.config[DatabaseExtensionSpec.properties]) {
addDataSourceProperty(key, value) addDataSourceProperty(key, value)
} }

View File

@ -3,10 +3,11 @@ package net.quiltservertools.ledger.databases.databases
import com.github.quiltservertools.ledger.Ledger import com.github.quiltservertools.ledger.Ledger
import org.sqlite.SQLiteDataSource import org.sqlite.SQLiteDataSource
import java.nio.file.Path import java.nio.file.Path
import kotlin.io.path.pathString
object SQLite : LedgerDatabase { object SQLite : LedgerDatabase {
override fun getDataSource(savePath: Path) = SQLiteDataSource().apply { override fun getDataSource(savePath: Path) = SQLiteDataSource().apply {
url = "jdbc:sqlite:$savePath" url = "jdbc:sqlite:${savePath.pathString}"
} }
override fun getDatabaseIdentifier() = Ledger.identifier(Ledger.DEFAULT_DATABASE) override fun getDatabaseIdentifier() = Ledger.identifier(Ledger.DEFAULT_DATABASE)

View File

@ -9,8 +9,8 @@
"yitzy299" "yitzy299"
], ],
"contact": { "contact": {
"homepage": "https://fabricmc.net/", "homepage": "https://modrinth.com/project/ledger-databases",
"sources": "https://github.com/FabricMC/fabric-example-mod" "sources": "https://github.com/QuiltServerTools/Ledger-Databases"
}, },
"license": "LGPL-3.0", "license": "LGPL-3.0",