QoL fixes

This commit is contained in:
2026-06-03 08:54:56 +02:00
parent 066fa97c43
commit e72f9a6ef3
2 changed files with 12 additions and 4 deletions

View File

@@ -593,7 +593,7 @@ CREATE TABLE public.comment_files (
id integer NOT NULL,
comment_id integer,
user_id integer NOT NULL,
dest character varying(40) NOT NULL,
dest character varying(60) NOT NULL,
mime character varying(100) NOT NULL,
size integer NOT NULL,
checksum character varying(255) NOT NULL,
@@ -887,7 +887,7 @@ ALTER SEQUENCE public.items_id_seq OWNER TO f0ckm;
CREATE TABLE public.items (
id integer DEFAULT nextval('public.items_id_seq'::regclass) NOT NULL,
src character varying(255) NOT NULL,
dest character varying(40) NOT NULL,
dest character varying(60) NOT NULL,
mime character varying(100) NOT NULL,
size integer NOT NULL,
checksum character varying(255) NOT NULL,
@@ -2857,8 +2857,8 @@ CREATE TABLE IF NOT EXISTS public.comment_polls (
CREATE TABLE IF NOT EXISTS public.comment_poll_options (
id SERIAL PRIMARY KEY,
poll_id INTEGER NOT NULL REFERENCES public.comment_polls(id) ON DELETE CASCADE,
option_text TEXT NOT NULL,
display_order SMALLINT NOT NULL DEFAULT 0
text TEXT NOT NULL,
sort_order SMALLINT NOT NULL DEFAULT 0
);
CREATE TABLE IF NOT EXISTS public.comment_poll_votes (

View File

@@ -26,6 +26,14 @@ db`ALTER TABLE items ADD COLUMN IF NOT EXISTS title text`.catch(() => {});
db`ALTER TABLE items ADD COLUMN IF NOT EXISTS width integer`.catch(() => {});
db`ALTER TABLE items ADD COLUMN IF NOT EXISTS height integer`.catch(() => {});
// One-time migration: widen checksum column to varchar(255) for SHA-256 + bypass suffix support
// (old schema had varchar(40), sized for SHA-1 — SHA-256 is 64 chars and bypass suffix adds more)
db`ALTER TABLE items ALTER COLUMN checksum TYPE character varying(255)`.catch(() => {});
// One-time migration: widen dest column to varchar(60) — UUID (32) + dot + extension can exceed 40 chars
db`ALTER TABLE items ALTER COLUMN dest TYPE character varying(60)`.catch(() => {});
db`ALTER TABLE comment_files ALTER COLUMN dest TYPE character varying(60)`.catch(() => {});
export const handleUpload = async (req, res, self) => {
// Manual session lookup is required here because this handler is called from a
// bypass middleware that runs in parallel with the main session middleware.