1
0
Fork 1
mirror of https://gitlab.com/mangadex-pub/mangadex_at_home.git synced 2024-01-19 02:48:37 +00:00
This commit is contained in:
carbotaniuman 2021-02-19 22:04:54 -06:00
parent 69357c4173
commit d41c871e54
4 changed files with 27 additions and 4 deletions

View file

@ -17,6 +17,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Security
## [2.0.0-rc13] - 2021-02-19
### Changed
- [2021-02-19] Back to sqlite we go [@carbotaniuman].
## [2.0.0-rc12] - 2021-02-11
### Fixed
- [2021-02-11] Fixed stupid cross platform bug [@carbotaniuman].
@ -361,7 +365,8 @@ This release contains many breaking changes! Of note are the changes to the cach
### Fixed
- [2020-06-11] Tweaked logging configuration to reduce log file sizes by [@carbotaniuman].
[Unreleased]: https://gitlab.com/mangadex/mangadex_at_home/-/compare/2.0.0-rc12...HEAD
[Unreleased]: https://gitlab.com/mangadex/mangadex_at_home/-/compare/2.0.0-rc13...HEAD
[2.0.0-rc13]: https://gitlab.com/mangadex/mangadex_at_home/-/compare/2.0.0-rc12...2.0.0-rc13
[2.0.0-rc12]: https://gitlab.com/mangadex/mangadex_at_home/-/compare/2.0.0-rc11...2.0.0-rc12
[2.0.0-rc11]: https://gitlab.com/mangadex/mangadex_at_home/-/compare/2.0.0-rc10...2.0.0-rc11
[2.0.0-rc10]: https://gitlab.com/mangadex/mangadex_at_home/-/compare/2.0.0-rc9...2.0.0-rc10

View file

@ -21,7 +21,7 @@ package mdnet
import java.time.Duration
object Constants {
const val CLIENT_BUILD = 27
const val CLIENT_BUILD = 28
@JvmField val MAX_AGE_CACHE: Duration = Duration.ofDays(14)

View file

@ -94,6 +94,8 @@ class Main : Runnable {
throw IllegalArgumentException("Cache folder $cacheFolder must be a directory")
}
migrate(databaseFolder)
val client = MangaDexClient(settingsFile, databaseFolder, cacheFolder)
val hook = Thread {
client.shutdown()

View file

@ -22,12 +22,26 @@ import mdnet.cache.DbImage
import mdnet.cache.INIT_TABLE
import org.ktorm.database.Database
import org.ktorm.dsl.*
import java.nio.file.Files
import java.nio.file.Path
import java.nio.file.Paths
fun main() {
migrate(Paths.get("./"))
}
fun migrate(path: Path) {
val h2file = path.resolve("metadata.mv.db")
if (!Files.exists(h2file)) {
return
}
println("Migrating database - this may take a long time")
Class.forName("org.sqlite.JDBC")
val sqliteDb = Paths.get("./metadata.db")
val sqliteDb = path.resolve("metadata.db")
Files.delete(sqliteDb)
val sqlite = Database.connect("jdbc:sqlite:$sqliteDb")
sqlite.useConnection { conn ->
@ -36,7 +50,7 @@ fun main() {
}
}
val db = Paths.get("./metadata")
val db = path.resolve("metadata")
val h2 = Database.connect("jdbc:h2:$db")
h2.useConnection { conn ->
@ -54,4 +68,6 @@ fun main() {
}
}
}
Files.move(h2file, path.resolve("metadata.mv.db.old"))
}