Skip to main content

max / multithreaded

670 B · 18 lines History Blame Raw
1 -- Image uploads for forum posts
2 CREATE TABLE images (
3 id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
4 uploader_id UUID NOT NULL REFERENCES users(mnw_account_id),
5 community_id UUID NOT NULL REFERENCES communities(id),
6 s3_key TEXT NOT NULL,
7 filename TEXT NOT NULL,
8 content_type TEXT NOT NULL,
9 size_bytes BIGINT NOT NULL,
10 created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
11 removed_at TIMESTAMPTZ,
12 removed_by UUID REFERENCES users(mnw_account_id)
13 );
14
15 CREATE INDEX idx_images_uploader ON images(uploader_id);
16 CREATE INDEX idx_images_community ON images(community_id);
17 CREATE INDEX idx_images_s3_key ON images(s3_key);
18