QoL fixes
This commit is contained in:
@@ -593,7 +593,7 @@ CREATE TABLE public.comment_files (
|
|||||||
id integer NOT NULL,
|
id integer NOT NULL,
|
||||||
comment_id integer,
|
comment_id integer,
|
||||||
user_id integer NOT NULL,
|
user_id integer NOT NULL,
|
||||||
dest character varying(40) NOT NULL,
|
dest character varying(60) NOT NULL,
|
||||||
mime character varying(100) NOT NULL,
|
mime character varying(100) NOT NULL,
|
||||||
size integer NOT NULL,
|
size integer NOT NULL,
|
||||||
checksum character varying(255) 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 (
|
CREATE TABLE public.items (
|
||||||
id integer DEFAULT nextval('public.items_id_seq'::regclass) NOT NULL,
|
id integer DEFAULT nextval('public.items_id_seq'::regclass) NOT NULL,
|
||||||
src character varying(255) 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,
|
mime character varying(100) NOT NULL,
|
||||||
size integer NOT NULL,
|
size integer NOT NULL,
|
||||||
checksum character varying(255) 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 (
|
CREATE TABLE IF NOT EXISTS public.comment_poll_options (
|
||||||
id SERIAL PRIMARY KEY,
|
id SERIAL PRIMARY KEY,
|
||||||
poll_id INTEGER NOT NULL REFERENCES public.comment_polls(id) ON DELETE CASCADE,
|
poll_id INTEGER NOT NULL REFERENCES public.comment_polls(id) ON DELETE CASCADE,
|
||||||
option_text TEXT NOT NULL,
|
text TEXT NOT NULL,
|
||||||
display_order SMALLINT NOT NULL DEFAULT 0
|
sort_order SMALLINT NOT NULL DEFAULT 0
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS public.comment_poll_votes (
|
CREATE TABLE IF NOT EXISTS public.comment_poll_votes (
|
||||||
|
|||||||
@@ -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 width integer`.catch(() => {});
|
||||||
db`ALTER TABLE items ADD COLUMN IF NOT EXISTS height 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) => {
|
export const handleUpload = async (req, res, self) => {
|
||||||
// Manual session lookup is required here because this handler is called from a
|
// Manual session lookup is required here because this handler is called from a
|
||||||
// bypass middleware that runs in parallel with the main session middleware.
|
// bypass middleware that runs in parallel with the main session middleware.
|
||||||
|
|||||||
Reference in New Issue
Block a user