feat(files): implement file storage functionality with save, load, and list operations

This commit is contained in:
2026-03-30 22:24:18 +02:00
parent 79d8219836
commit 7f2b2b9fee
12 changed files with 676 additions and 33 deletions

View File

@@ -0,0 +1,20 @@
create table if not exists stored_files (
id bigserial primary key,
guid uuid not null default gen_random_uuid(),
thought_id uuid references thoughts(guid) on delete set null,
project_id uuid references projects(guid) on delete set null,
name text not null,
media_type text not null,
kind text not null default 'file',
encoding text not null default 'base64',
size_bytes bigint not null,
sha256 text not null,
content bytea not null,
created_at timestamptz not null default now(),
updated_at timestamptz not null default now(),
constraint stored_files_guid_unique unique (guid)
);
create index if not exists stored_files_thought_id_idx on stored_files (thought_id);
create index if not exists stored_files_project_id_idx on stored_files (project_id);
create index if not exists stored_files_sha256_idx on stored_files (sha256);