fix(library): increase reading threshold constraint max to 100

The database check constraint for the library reading threshold was previously enforcing a maximum value of 1, causing an internal server error when configuring a threshold greater than 1% via the UI. The constraint max has been increased to 100 to support percentage-based values and align with the mark_as_finished constraint.

Closes #142
This commit is contained in:
neon
2026-05-31 01:22:11 +00:00
parent 26b3c8ba18
commit cc7cbb13a1
4 changed files with 10260 additions and 1 deletions
@@ -0,0 +1,2 @@
ALTER TABLE "libraries" DROP CONSTRAINT "libraries_reading_threshold_range_chk";--> statement-breakpoint
ALTER TABLE "libraries" ADD CONSTRAINT "libraries_reading_threshold_range_chk" CHECK ("libraries"."reading_threshold" >= 0 and "libraries"."reading_threshold" <= 100);
File diff suppressed because it is too large Load Diff
@@ -71,6 +71,13 @@
"when": 1780159365997,
"tag": "0009_user-preferences-theme-sync",
"breakpoints": true
},
{
"idx": 10,
"version": "7",
"when": 1780190394625,
"tag": "0010_fix_reading_threshold",
"breakpoints": true
}
]
}
+1 -1
View File
@@ -84,7 +84,7 @@ export const libraries = pgTable(
uniqueIndex('libraries_name_lower_uidx').on(sql`lower(${t.name})`),
check('libraries_display_order_nonnegative_chk', sql`${t.displayOrder} >= 0`),
check('libraries_organization_mode_chk', sql`${t.organizationMode} in ('book_per_folder', 'book_per_file')`),
check('libraries_reading_threshold_range_chk', sql`${t.readingThreshold} >= 0 and ${t.readingThreshold} <= 1`),
check('libraries_reading_threshold_range_chk', sql`${t.readingThreshold} >= 0 and ${t.readingThreshold} <= 100`),
check('libraries_mark_finished_percent_range_chk', sql`${t.markAsFinishedPercentComplete} >= 0 and ${t.markAsFinishedPercentComplete} <= 100`),
check('libraries_scan_mode_chk', sql`${t.scanMode} in ('auto', 'manual')`),
check('libraries_poll_interval_nonnegative_chk', sql`${t.pollInterval} is null or ${t.pollInterval} >= 0`),