mirror of
https://github.com/Suwayomi/Suwayomi-Server.git
synced 2026-07-14 08:14:34 -05:00
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:
@@ -15,7 +15,7 @@ import suwayomi.tachidesk.manga.model.dataclass.IncludeOrExclude
|
||||
|
||||
object CategoryTable : IntIdTable() {
|
||||
val name = varchar("name", 64)
|
||||
val order = integer("order").default(0)
|
||||
val order = integer("sort_order").default(0)
|
||||
val isDefault = bool("is_default").default(false)
|
||||
val includeInUpdate = integer("include_in_update").default(IncludeOrExclude.UNSET.value)
|
||||
val includeInDownload = integer("include_in_download").default(IncludeOrExclude.UNSET.value)
|
||||
|
||||
@@ -17,16 +17,17 @@ import suwayomi.tachidesk.manga.model.dataclass.MangaDataClass
|
||||
import suwayomi.tachidesk.manga.model.dataclass.toGenreList
|
||||
import suwayomi.tachidesk.manga.model.table.MangaStatus.Companion
|
||||
import suwayomi.tachidesk.manga.model.table.columns.truncatingVarchar
|
||||
import suwayomi.tachidesk.manga.model.table.columns.unlimitedVarchar
|
||||
|
||||
object MangaTable : IntIdTable() {
|
||||
val url = varchar("url", 2048)
|
||||
val title = truncatingVarchar("title", 512)
|
||||
val initialized = bool("initialized").default(false)
|
||||
|
||||
val artist = truncatingVarchar("artist", Integer.MAX_VALUE).nullable()
|
||||
val author = truncatingVarchar("author", Integer.MAX_VALUE).nullable()
|
||||
val description = truncatingVarchar("description", Integer.MAX_VALUE).nullable()
|
||||
val genre = truncatingVarchar("genre", Integer.MAX_VALUE).nullable()
|
||||
val artist = unlimitedVarchar("artist").nullable()
|
||||
val author = unlimitedVarchar("author").nullable()
|
||||
val description = unlimitedVarchar("description").nullable()
|
||||
val genre = unlimitedVarchar("genre").nullable()
|
||||
|
||||
val status = integer("status").default(SManga.UNKNOWN)
|
||||
val thumbnail_url = varchar("thumbnail_url", 2048).nullable()
|
||||
|
||||
@@ -9,11 +9,12 @@ package suwayomi.tachidesk.manga.model.table
|
||||
|
||||
import org.jetbrains.exposed.dao.id.IntIdTable
|
||||
import org.jetbrains.exposed.sql.ReferenceOption
|
||||
import suwayomi.tachidesk.manga.model.table.columns.unlimitedVarchar
|
||||
|
||||
object PageTable : IntIdTable() {
|
||||
val index = integer("index")
|
||||
val url = varchar("url", 2048)
|
||||
val imageUrl = varchar("image_url", Integer.MAX_VALUE).nullable()
|
||||
val imageUrl = unlimitedVarchar("image_url").nullable()
|
||||
|
||||
val chapter = reference("chapter", ChapterTable, ReferenceOption.CASCADE)
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@ import io.github.oshai.kotlinlogging.KotlinLogging
|
||||
import org.jetbrains.exposed.sql.Column
|
||||
import org.jetbrains.exposed.sql.Table
|
||||
import org.jetbrains.exposed.sql.VarCharColumnType
|
||||
import suwayomi.tachidesk.graphql.types.DatabaseType
|
||||
import suwayomi.tachidesk.server.serverConfig
|
||||
|
||||
class TruncatingVarCharColumn(
|
||||
private val table: String,
|
||||
@@ -34,3 +36,12 @@ fun Table.truncatingVarchar(
|
||||
length: Int,
|
||||
collate: String? = null,
|
||||
): Column<String> = registerColumn(name, TruncatingVarCharColumn(this.tableName, name, length, collate))
|
||||
|
||||
fun Table.unlimitedVarchar(
|
||||
name: String,
|
||||
collate: String? = null,
|
||||
): Column<String> =
|
||||
when (serverConfig.databaseType.value) {
|
||||
DatabaseType.H2 -> truncatingVarchar(name, Int.MAX_VALUE, collate)
|
||||
DatabaseType.POSTGRESQL -> text(name, collate)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user