move databse to server package, move tables to a better place

This commit is contained in:
Aria Moradi 2021-05-27 02:21:53 +04:30
parent 921a0a3361
commit e8d41f83c2
32 changed files with 58 additions and 58 deletions

View File

@ -1,4 +1,4 @@
package suwayomi.tachidesk.model.database package suwayomi.server.database
/* /*
* Copyright (C) Contributors to the Suwayomi project * Copyright (C) Contributors to the Suwayomi project
@ -12,8 +12,8 @@ import org.kodein.di.DI
import org.kodein.di.conf.global import org.kodein.di.conf.global
import org.kodein.di.instance import org.kodein.di.instance
import suwayomi.server.ApplicationDirs import suwayomi.server.ApplicationDirs
import suwayomi.tachidesk.model.database.migration.lib.loadMigrationsFrom import suwayomi.server.database.migration.lib.loadMigrationsFrom
import suwayomi.tachidesk.model.database.migration.lib.runMigrations import suwayomi.server.database.migration.lib.runMigrations
object DBManager { object DBManager {
val db by lazy { val db by lazy {
@ -27,6 +27,6 @@ fun databaseUp() {
val db = DBManager.db val db = DBManager.db
db.useNestedTransactions = true db.useNestedTransactions = true
val migrations = loadMigrationsFrom("suwayomi.tachidesk.model.database.migration") val migrations = loadMigrationsFrom("suwayomi.server.database.migration")
runMigrations(migrations) runMigrations(migrations)
} }

View File

@ -1,4 +1,4 @@
package suwayomi.tachidesk.model.database.migration package suwayomi.server.database.migration
/* /*
* Copyright (C) Contributors to the Suwayomi project * Copyright (C) Contributors to the Suwayomi project
@ -12,7 +12,7 @@ import org.jetbrains.exposed.dao.id.IdTable
import org.jetbrains.exposed.dao.id.IntIdTable import org.jetbrains.exposed.dao.id.IntIdTable
import org.jetbrains.exposed.sql.SchemaUtils import org.jetbrains.exposed.sql.SchemaUtils
import org.jetbrains.exposed.sql.transactions.transaction import org.jetbrains.exposed.sql.transactions.transaction
import suwayomi.tachidesk.model.database.migration.lib.Migration import suwayomi.server.database.migration.lib.Migration
@Suppress("ClassName", "unused") @Suppress("ClassName", "unused")
class M0001_Initial : Migration() { class M0001_Initial : Migration() {

View File

@ -1,4 +1,4 @@
package suwayomi.tachidesk.model.database.migration package suwayomi.server.database.migration
/* /*
* Copyright (C) Contributors to the Suwayomi project * Copyright (C) Contributors to the Suwayomi project
@ -9,7 +9,7 @@ package suwayomi.tachidesk.model.database.migration
import org.jetbrains.exposed.sql.transactions.TransactionManager import org.jetbrains.exposed.sql.transactions.TransactionManager
import org.jetbrains.exposed.sql.vendors.currentDialect import org.jetbrains.exposed.sql.vendors.currentDialect
import suwayomi.tachidesk.model.database.migration.lib.Migration import suwayomi.server.database.migration.lib.Migration
@Suppress("ClassName", "unused") @Suppress("ClassName", "unused")
class M0002_ChapterTableIndexRename : Migration() { class M0002_ChapterTableIndexRename : Migration() {

View File

@ -1,4 +1,4 @@
package suwayomi.tachidesk.model.database.migration package suwayomi.server.database.migration
/* /*
* Copyright (C) Contributors to the Suwayomi project * Copyright (C) Contributors to the Suwayomi project
@ -9,7 +9,7 @@ package suwayomi.tachidesk.model.database.migration
import org.jetbrains.exposed.sql.transactions.TransactionManager import org.jetbrains.exposed.sql.transactions.TransactionManager
import org.jetbrains.exposed.sql.vendors.currentDialect import org.jetbrains.exposed.sql.vendors.currentDialect
import suwayomi.tachidesk.model.database.migration.lib.Migration import suwayomi.server.database.migration.lib.Migration
@Suppress("ClassName", "unused") @Suppress("ClassName", "unused")
class M0003_DefaultCategory : Migration() { class M0003_DefaultCategory : Migration() {

View File

@ -1,4 +1,4 @@
package suwayomi.tachidesk.model.database.migration.lib package suwayomi.server.database.migration.lib
/* /*
* Copyright (C) Contributors to the Suwayomi project * Copyright (C) Contributors to the Suwayomi project

View File

@ -1,4 +1,4 @@
package suwayomi.tachidesk.model.database.migration.lib package suwayomi.server.database.migration.lib
/* /*
* Copyright (C) Contributors to the Suwayomi project * Copyright (C) Contributors to the Suwayomi project

View File

@ -1,4 +1,4 @@
package suwayomi.tachidesk.model.database.migration.lib package suwayomi.server.database.migration.lib
/* /*
* Copyright (C) Contributors to the Suwayomi project * Copyright (C) Contributors to the Suwayomi project
@ -63,7 +63,7 @@ fun runMigrations(migrations: List<Migration>, database: Database = TransactionM
@OptIn(ExperimentalPathApi::class) @OptIn(ExperimentalPathApi::class)
private fun getTopLevelClasses(packageName: String): List<Class<*>> { private fun getTopLevelClasses(packageName: String): List<Class<*>> {
ServerConfig::class.java.getResource("/" + "suwayomi.tachidesk.model.database.migration".replace('.', '/')) ServerConfig::class.java.getResource("/" + "suwayomi.server.database.migration".replace('.', '/'))
val path = "/" + packageName.replace('.', '/') val path = "/" + packageName.replace('.', '/')
val uri = ServerConfig::class.java.getResource(path).toURI() val uri = ServerConfig::class.java.getResource(path).toURI()

View File

@ -15,9 +15,9 @@ import org.jetbrains.exposed.sql.selectAll
import org.jetbrains.exposed.sql.transactions.transaction import org.jetbrains.exposed.sql.transactions.transaction
import org.jetbrains.exposed.sql.update import org.jetbrains.exposed.sql.update
import suwayomi.tachidesk.impl.CategoryManga.removeMangaFromCategory import suwayomi.tachidesk.impl.CategoryManga.removeMangaFromCategory
import suwayomi.tachidesk.model.database.table.CategoryMangaTable import suwayomi.tachidesk.model.table.CategoryMangaTable
import suwayomi.tachidesk.model.database.table.CategoryTable import suwayomi.tachidesk.model.table.CategoryTable
import suwayomi.tachidesk.model.database.table.toDataClass import suwayomi.tachidesk.model.table.toDataClass
import suwayomi.tachidesk.model.dataclass.CategoryDataClass import suwayomi.tachidesk.model.dataclass.CategoryDataClass
object Category { object Category {

View File

@ -14,10 +14,10 @@ import org.jetbrains.exposed.sql.insert
import org.jetbrains.exposed.sql.select import org.jetbrains.exposed.sql.select
import org.jetbrains.exposed.sql.transactions.transaction import org.jetbrains.exposed.sql.transactions.transaction
import org.jetbrains.exposed.sql.update import org.jetbrains.exposed.sql.update
import suwayomi.tachidesk.model.database.table.CategoryMangaTable import suwayomi.tachidesk.model.table.CategoryMangaTable
import suwayomi.tachidesk.model.database.table.CategoryTable import suwayomi.tachidesk.model.table.CategoryTable
import suwayomi.tachidesk.model.database.table.MangaTable import suwayomi.tachidesk.model.table.MangaTable
import suwayomi.tachidesk.model.database.table.toDataClass import suwayomi.tachidesk.model.table.toDataClass
import suwayomi.tachidesk.model.dataclass.CategoryDataClass import suwayomi.tachidesk.model.dataclass.CategoryDataClass
import suwayomi.tachidesk.model.dataclass.MangaDataClass import suwayomi.tachidesk.model.dataclass.MangaDataClass

View File

@ -19,10 +19,10 @@ import org.jetbrains.exposed.sql.update
import suwayomi.tachidesk.impl.Manga.getManga import suwayomi.tachidesk.impl.Manga.getManga
import suwayomi.tachidesk.impl.util.GetHttpSource.getHttpSource import suwayomi.tachidesk.impl.util.GetHttpSource.getHttpSource
import suwayomi.tachidesk.impl.util.lang.awaitSingle import suwayomi.tachidesk.impl.util.lang.awaitSingle
import suwayomi.tachidesk.model.database.table.ChapterTable import suwayomi.tachidesk.model.table.ChapterTable
import suwayomi.tachidesk.model.database.table.MangaTable import suwayomi.tachidesk.model.table.MangaTable
import suwayomi.tachidesk.model.database.table.PageTable import suwayomi.tachidesk.model.table.PageTable
import suwayomi.tachidesk.model.database.table.toDataClass import suwayomi.tachidesk.model.table.toDataClass
import suwayomi.tachidesk.model.dataclass.ChapterDataClass import suwayomi.tachidesk.model.dataclass.ChapterDataClass
object Chapter { object Chapter {

View File

@ -14,10 +14,10 @@ import org.jetbrains.exposed.sql.select
import org.jetbrains.exposed.sql.transactions.transaction import org.jetbrains.exposed.sql.transactions.transaction
import org.jetbrains.exposed.sql.update import org.jetbrains.exposed.sql.update
import suwayomi.tachidesk.impl.Manga.getManga import suwayomi.tachidesk.impl.Manga.getManga
import suwayomi.tachidesk.model.database.table.CategoryMangaTable import suwayomi.tachidesk.model.table.CategoryMangaTable
import suwayomi.tachidesk.model.database.table.CategoryTable import suwayomi.tachidesk.model.table.CategoryTable
import suwayomi.tachidesk.model.database.table.MangaTable import suwayomi.tachidesk.model.table.MangaTable
import suwayomi.tachidesk.model.database.table.toDataClass import suwayomi.tachidesk.model.table.toDataClass
import suwayomi.tachidesk.model.dataclass.MangaDataClass import suwayomi.tachidesk.model.dataclass.MangaDataClass
object Library { object Library {

View File

@ -23,8 +23,8 @@ import suwayomi.tachidesk.impl.util.lang.awaitSingle
import suwayomi.tachidesk.impl.util.network.await import suwayomi.tachidesk.impl.util.network.await
import suwayomi.tachidesk.impl.util.storage.CachedImageResponse.clearCachedImage import suwayomi.tachidesk.impl.util.storage.CachedImageResponse.clearCachedImage
import suwayomi.tachidesk.impl.util.storage.CachedImageResponse.getCachedImageResponse import suwayomi.tachidesk.impl.util.storage.CachedImageResponse.getCachedImageResponse
import suwayomi.tachidesk.model.database.table.MangaStatus import suwayomi.tachidesk.model.table.MangaStatus
import suwayomi.tachidesk.model.database.table.MangaTable import suwayomi.tachidesk.model.table.MangaTable
import suwayomi.tachidesk.model.dataclass.MangaDataClass import suwayomi.tachidesk.model.dataclass.MangaDataClass
import java.io.InputStream import java.io.InputStream

View File

@ -13,8 +13,8 @@ import org.jetbrains.exposed.sql.select
import org.jetbrains.exposed.sql.transactions.transaction import org.jetbrains.exposed.sql.transactions.transaction
import suwayomi.tachidesk.impl.util.GetHttpSource.getHttpSource import suwayomi.tachidesk.impl.util.GetHttpSource.getHttpSource
import suwayomi.tachidesk.impl.util.lang.awaitSingle import suwayomi.tachidesk.impl.util.lang.awaitSingle
import suwayomi.tachidesk.model.database.table.MangaStatus import suwayomi.tachidesk.model.table.MangaStatus
import suwayomi.tachidesk.model.database.table.MangaTable import suwayomi.tachidesk.model.table.MangaTable
import suwayomi.tachidesk.model.dataclass.MangaDataClass import suwayomi.tachidesk.model.dataclass.MangaDataClass
import suwayomi.tachidesk.model.dataclass.PagedMangaListDataClass import suwayomi.tachidesk.model.dataclass.PagedMangaListDataClass

View File

@ -21,9 +21,9 @@ import suwayomi.tachidesk.impl.util.GetHttpSource.getHttpSource
import suwayomi.tachidesk.impl.util.lang.awaitSingle import suwayomi.tachidesk.impl.util.lang.awaitSingle
import suwayomi.tachidesk.impl.util.storage.CachedImageResponse.getCachedImageResponse import suwayomi.tachidesk.impl.util.storage.CachedImageResponse.getCachedImageResponse
import suwayomi.tachidesk.impl.util.storage.SafePath import suwayomi.tachidesk.impl.util.storage.SafePath
import suwayomi.tachidesk.model.database.table.ChapterTable import suwayomi.tachidesk.model.table.ChapterTable
import suwayomi.tachidesk.model.database.table.MangaTable import suwayomi.tachidesk.model.table.MangaTable
import suwayomi.tachidesk.model.database.table.PageTable import suwayomi.tachidesk.model.table.PageTable
import java.io.File import java.io.File
import java.io.InputStream import java.io.InputStream

View File

@ -13,8 +13,8 @@ import org.jetbrains.exposed.sql.selectAll
import org.jetbrains.exposed.sql.transactions.transaction import org.jetbrains.exposed.sql.transactions.transaction
import suwayomi.tachidesk.impl.extension.Extension.getExtensionIconUrl import suwayomi.tachidesk.impl.extension.Extension.getExtensionIconUrl
import suwayomi.tachidesk.impl.util.GetHttpSource.getHttpSource import suwayomi.tachidesk.impl.util.GetHttpSource.getHttpSource
import suwayomi.tachidesk.model.database.table.ExtensionTable import suwayomi.tachidesk.model.table.ExtensionTable
import suwayomi.tachidesk.model.database.table.SourceTable import suwayomi.tachidesk.model.table.SourceTable
import suwayomi.tachidesk.model.dataclass.SourceDataClass import suwayomi.tachidesk.model.dataclass.SourceDataClass
object Source { object Source {

View File

@ -24,8 +24,8 @@ import suwayomi.tachidesk.impl.backup.models.ChapterImpl
import suwayomi.tachidesk.impl.backup.models.Manga import suwayomi.tachidesk.impl.backup.models.Manga
import suwayomi.tachidesk.impl.backup.models.MangaImpl import suwayomi.tachidesk.impl.backup.models.MangaImpl
import suwayomi.tachidesk.impl.util.GetHttpSource.getHttpSource import suwayomi.tachidesk.impl.util.GetHttpSource.getHttpSource
import suwayomi.tachidesk.model.database.table.ChapterTable import suwayomi.tachidesk.model.table.ChapterTable
import suwayomi.tachidesk.model.database.table.MangaTable import suwayomi.tachidesk.model.table.MangaTable
object LegacyBackupExport : LegacyBackupBase() { object LegacyBackupExport : LegacyBackupBase() {

View File

@ -28,7 +28,7 @@ import suwayomi.tachidesk.impl.backup.models.Track
import suwayomi.tachidesk.impl.backup.models.TrackImpl import suwayomi.tachidesk.impl.backup.models.TrackImpl
import suwayomi.tachidesk.impl.util.GetHttpSource.getHttpSource import suwayomi.tachidesk.impl.util.GetHttpSource.getHttpSource
import suwayomi.tachidesk.impl.util.lang.awaitSingle import suwayomi.tachidesk.impl.util.lang.awaitSingle
import suwayomi.tachidesk.model.database.table.MangaTable import suwayomi.tachidesk.model.table.MangaTable
import java.io.InputStream import java.io.InputStream
import java.util.Date import java.util.Date

View File

@ -11,7 +11,7 @@ import com.google.gson.JsonObject
import org.jetbrains.exposed.sql.select import org.jetbrains.exposed.sql.select
import org.jetbrains.exposed.sql.transactions.transaction import org.jetbrains.exposed.sql.transactions.transaction
import suwayomi.tachidesk.impl.backup.legacy.models.Backup import suwayomi.tachidesk.impl.backup.legacy.models.Backup
import suwayomi.tachidesk.model.database.table.SourceTable import suwayomi.tachidesk.model.table.SourceTable
object LegacyBackupValidator { object LegacyBackupValidator {
data class ValidationResult(val missingSources: List<String>, val missingTrackers: List<String>) data class ValidationResult(val missingSources: List<String>, val missingTrackers: List<String>)

View File

@ -1,7 +1,7 @@
package suwayomi.tachidesk.impl.backup.models package suwayomi.tachidesk.impl.backup.models
import org.jetbrains.exposed.sql.ResultRow import org.jetbrains.exposed.sql.ResultRow
import suwayomi.tachidesk.model.database.table.ChapterTable import suwayomi.tachidesk.model.table.ChapterTable
class ChapterImpl : Chapter { class ChapterImpl : Chapter {

View File

@ -1,7 +1,7 @@
package suwayomi.tachidesk.impl.backup.models package suwayomi.tachidesk.impl.backup.models
import org.jetbrains.exposed.sql.ResultRow import org.jetbrains.exposed.sql.ResultRow
import suwayomi.tachidesk.model.database.table.MangaTable import suwayomi.tachidesk.model.table.MangaTable
open class MangaImpl : Manga { open class MangaImpl : Manga {

View File

@ -40,8 +40,8 @@ import suwayomi.tachidesk.impl.util.PackageTools.loadExtensionSources
import suwayomi.tachidesk.impl.util.PackageTools.trustedSignatures import suwayomi.tachidesk.impl.util.PackageTools.trustedSignatures
import suwayomi.tachidesk.impl.util.network.await import suwayomi.tachidesk.impl.util.network.await
import suwayomi.tachidesk.impl.util.storage.CachedImageResponse.getCachedImageResponse import suwayomi.tachidesk.impl.util.storage.CachedImageResponse.getCachedImageResponse
import suwayomi.tachidesk.model.database.table.ExtensionTable import suwayomi.tachidesk.model.table.ExtensionTable
import suwayomi.tachidesk.model.database.table.SourceTable import suwayomi.tachidesk.model.table.SourceTable
import uy.kohesive.injekt.injectLazy import uy.kohesive.injekt.injectLazy
import java.io.File import java.io.File
import java.io.InputStream import java.io.InputStream

View File

@ -17,7 +17,7 @@ import org.jetbrains.exposed.sql.update
import suwayomi.tachidesk.impl.extension.Extension.getExtensionIconUrl import suwayomi.tachidesk.impl.extension.Extension.getExtensionIconUrl
import suwayomi.tachidesk.impl.extension.github.ExtensionGithubApi import suwayomi.tachidesk.impl.extension.github.ExtensionGithubApi
import suwayomi.tachidesk.impl.extension.github.OnlineExtension import suwayomi.tachidesk.impl.extension.github.OnlineExtension
import suwayomi.tachidesk.model.database.table.ExtensionTable import suwayomi.tachidesk.model.table.ExtensionTable
import suwayomi.tachidesk.model.dataclass.ExtensionDataClass import suwayomi.tachidesk.model.dataclass.ExtensionDataClass
import java.util.concurrent.ConcurrentHashMap import java.util.concurrent.ConcurrentHashMap

View File

@ -17,8 +17,8 @@ import org.kodein.di.conf.global
import org.kodein.di.instance import org.kodein.di.instance
import suwayomi.server.ApplicationDirs import suwayomi.server.ApplicationDirs
import suwayomi.tachidesk.impl.util.PackageTools.loadExtensionSources import suwayomi.tachidesk.impl.util.PackageTools.loadExtensionSources
import suwayomi.tachidesk.model.database.table.ExtensionTable import suwayomi.tachidesk.model.table.ExtensionTable
import suwayomi.tachidesk.model.database.table.SourceTable import suwayomi.tachidesk.model.table.SourceTable
import java.util.concurrent.ConcurrentHashMap import java.util.concurrent.ConcurrentHashMap
object GetHttpSource { object GetHttpSource {

View File

@ -7,7 +7,7 @@ package suwayomi.tachidesk.model.dataclass
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
import suwayomi.tachidesk.model.database.table.MangaStatus import suwayomi.tachidesk.model.table.MangaStatus
data class MangaDataClass( data class MangaDataClass(
val id: Int, val id: Int,

View File

@ -1,4 +1,4 @@
package suwayomi.tachidesk.model.database.table package suwayomi.tachidesk.model.table
/* /*
* Copyright (C) Contributors to the Suwayomi project * Copyright (C) Contributors to the Suwayomi project

View File

@ -1,4 +1,4 @@
package suwayomi.tachidesk.model.database.table package suwayomi.tachidesk.model.table
/* /*
* Copyright (C) Contributors to the Suwayomi project * Copyright (C) Contributors to the Suwayomi project

View File

@ -1,4 +1,4 @@
package suwayomi.tachidesk.model.database.table package suwayomi.tachidesk.model.table
/* /*
* Copyright (C) Contributors to the Suwayomi project * Copyright (C) Contributors to the Suwayomi project

View File

@ -1,4 +1,4 @@
package suwayomi.tachidesk.model.database.table package suwayomi.tachidesk.model.table
/* /*
* Copyright (C) Contributors to the Suwayomi project * Copyright (C) Contributors to the Suwayomi project

View File

@ -1,4 +1,4 @@
package suwayomi.tachidesk.model.database.table package suwayomi.tachidesk.model.table
/* /*
* Copyright (C) Contributors to the Suwayomi project * Copyright (C) Contributors to the Suwayomi project
@ -11,7 +11,7 @@ import eu.kanade.tachiyomi.source.model.SManga
import org.jetbrains.exposed.dao.id.IntIdTable import org.jetbrains.exposed.dao.id.IntIdTable
import org.jetbrains.exposed.sql.ResultRow import org.jetbrains.exposed.sql.ResultRow
import suwayomi.tachidesk.impl.MangaList.proxyThumbnailUrl import suwayomi.tachidesk.impl.MangaList.proxyThumbnailUrl
import suwayomi.tachidesk.model.database.table.MangaStatus.Companion import suwayomi.tachidesk.model.table.MangaStatus.Companion
import suwayomi.tachidesk.model.dataclass.MangaDataClass import suwayomi.tachidesk.model.dataclass.MangaDataClass
object MangaTable : IntIdTable() { object MangaTable : IntIdTable() {

View File

@ -1,4 +1,4 @@
package suwayomi.tachidesk.model.database.table package suwayomi.tachidesk.model.table
/* /*
* Copyright (C) Contributors to the Suwayomi project * Copyright (C) Contributors to the Suwayomi project

View File

@ -1,4 +1,4 @@
package suwayomi.tachidesk.model.database.table package suwayomi.tachidesk.model.table
/* /*
* Copyright (C) Contributors to the Suwayomi project * Copyright (C) Contributors to the Suwayomi project