Support PostgreSQL Databases (#1617)

* Support PostgreSQL Databases

* Set the database Schema

* See if we can test postgres

* Another test

* Disable node container

* Update database when changed

* Simplify test workflow

* Only exit on failed migrations

* Run the first databaseUp sync

* Map the port

* Use absolute path for LD_PRELOAD

* Timeout after 1m

* Open the server in both database configurations

* Only exit on migration failed in ci

* Lint

* Use new ServerConfig configuration
This commit is contained in:
Mitchell Syer
2025-09-02 12:29:09 -04:00
committed by GitHub
parent 4cdc7b348d
commit dc79b4c90a
26 changed files with 313 additions and 47 deletions

View File

@@ -0,0 +1,6 @@
package suwayomi.tachidesk.graphql.types
enum class DatabaseType {
H2,
POSTGRESQL,
}

View File

@@ -24,6 +24,7 @@ import kotlinx.coroutines.flow.mapLatest
import kotlinx.coroutines.flow.onEach
import org.jetbrains.exposed.sql.SortOrder
import suwayomi.tachidesk.graphql.types.AuthMode
import suwayomi.tachidesk.graphql.types.DatabaseType
import suwayomi.tachidesk.graphql.types.DownloadConversion
import suwayomi.tachidesk.graphql.types.KoreaderSyncChecksumMethod
import suwayomi.tachidesk.graphql.types.KoreaderSyncStrategy
@@ -636,6 +637,32 @@ class ServerConfig(
requiresRestart = true,
)
val databaseType: MutableStateFlow<DatabaseType> by EnumSetting(
protoNumber = 69,
group = SettingGroup.DATABASE,
defaultValue = DatabaseType.H2,
enumClass = DatabaseType::class,
typeInfo = SettingsRegistry.PartialTypeInfo(imports = listOf("suwayomi.tachidesk.graphql.types.DatabaseType")),
)
val databaseUrl: MutableStateFlow<String> by StringSetting(
protoNumber = 70,
group = SettingGroup.DATABASE,
defaultValue = "postgresql://localhost:5432/suwayomi",
)
val databaseUsername: MutableStateFlow<String> by StringSetting(
protoNumber = 71,
group = SettingGroup.DATABASE,
defaultValue = "",
)
val databasePassword: MutableStateFlow<String> by StringSetting(
protoNumber = 72,
group = SettingGroup.DATABASE,
defaultValue = "",
)
/** ****************************************************************** **/
/** **/
/** Renamed settings **/

View File

@@ -4,6 +4,7 @@ enum class SettingGroup(
val value: String,
) {
NETWORK("Network"),
DATABASE("Database"),
PROXY("Proxy"),
WEB_UI("WebUI"),
DOWNLOADER("Downloader"),