feat(files): implement file storage functionality with save, load, and list operations
This commit is contained in:
20
migrations/016_create_stored_files.sql
Normal file
20
migrations/016_create_stored_files.sql
Normal 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);
|
||||
Reference in New Issue
Block a user