Fix/m0045 prevent duplicated chapter pages migration (#1361)

* Fix "imageUrl" column name in migration

* Rename column "imageUrl" to "IMAGE_URL" of table "Page"
This commit is contained in:
schroda
2025-04-28 01:33:15 +02:00
committed by GitHub
parent 7594ae5fa5
commit 785c0469ac
3 changed files with 20 additions and 2 deletions

View File

@@ -13,7 +13,7 @@ import org.jetbrains.exposed.sql.ReferenceOption
object PageTable : IntIdTable() {
val index = integer("index")
val url = varchar("url", 2048)
val imageUrl = varchar("imageUrl", 2048).nullable()
val imageUrl = varchar("image_url", 2048).nullable()
val chapter = reference("chapter", ChapterTable, ReferenceOption.CASCADE)
}

View File

@@ -21,6 +21,6 @@ class M0045_PreventDuplicatedChapterPages : SQLMigration() {
);
ALTER TABLE PAGE
ADD CONSTRAINT UC_PAGE UNIQUE (INDEX, imageUrl, CHAPTER)
ADD CONSTRAINT UC_PAGE UNIQUE (INDEX, "imageUrl", CHAPTER);
""".trimIndent()
}

View File

@@ -0,0 +1,18 @@
package suwayomi.tachidesk.server.database.migration
/*
* Copyright (C) Contributors to the Suwayomi project
*
* This Source Code Form is subject to the terms of the Mozilla Public
* 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/. */
import de.neonew.exposed.migrations.helpers.RenameFieldMigration
@Suppress("ClassName", "unused")
class M0046_RenamePageImageUrlColumn :
RenameFieldMigration(
"Page",
"\"imageUrl\"",
"image_url",
)