fix: truncate furniture-line slug to fit caption_save varchar(25)

Line pages used caption_save 'imp_line_<slug>' which could exceed the
25-char column limit (e.g. imp_line_pixel_collectible = 26 chars),
causing the INSERT to fail. Cap the slug at 16 chars.
This commit is contained in:
openhands committed 2026-08-22 11:36:09 +02:00
1 parent b109ca6f32
commit eb885c044f
1 file changed
+3 -1
+3 -1
View File
@@ -506,12 +506,14 @@ export async function organizeCatalogAll(): Promise<OrganizeCatalogResult> {
const base = classname.split("*")[0];
return (base && furnilineByClass.get(base)) || "";
};
// The `caption_save` column is varchar(25). The line prefix `imp_line_`
// takes 9 chars, so the slug may be at most 16 chars to stay within limit.
const slug = (value: string): string =>
value
.toLowerCase()
.replace(/[^a-z0-9]+/g, "_")
.replace(/^_+|_+$/g, "")
.slice(0, 40);
.slice(0, 16);
// Minimum number of items a furniture line must have before it gets its own
// dedicated catalog page. Lines below this threshold (one-off customs, etc.)