mirror of
https://github.com/Suwayomi/Tachidesk.git
synced 2025-12-21 12:02:35 +01:00
Fix handling of too long page image urls migration (#1552)
* Delete duplicated chapter page rows by index and chapter In case duplicated rows based on the condition for the updated unique constraint existed, the new constraint could not be added and caused the migration to fail * Drop UC_PAGE only if it exists
This commit is contained in:
@@ -13,7 +13,14 @@ import de.neonew.exposed.migrations.helpers.SQLMigration
|
||||
class M0050_FixHandlingOfTooLongPageImageUrls : SQLMigration() {
|
||||
override val sql: String =
|
||||
"""
|
||||
ALTER TABLE PAGE DROP CONSTRAINT UC_PAGE;
|
||||
DELETE FROM PAGE
|
||||
WHERE ID NOT IN (
|
||||
SELECT MIN(ID)
|
||||
FROM PAGE
|
||||
GROUP BY INDEX, CHAPTER
|
||||
);
|
||||
|
||||
ALTER TABLE PAGE DROP CONSTRAINT IF EXISTS UC_PAGE;
|
||||
ALTER TABLE PAGE ADD CONSTRAINT UC_PAGE UNIQUE (INDEX, CHAPTER);
|
||||
|
||||
ALTER TABLE PAGE ALTER COLUMN IMAGE_URL VARCHAR; -- the default length is `Integer.MAX_VALUE`
|
||||
|
||||
Reference in New Issue
Block a user