Files
amcs/schema/files.dbml
Hein 91239bcf4b
Some checks failed
CI / build-and-test (push) Failing after -31m12s
refactor(store,tools): migrate IDs from UUID to bigserial int64
All internal entity lookups now use bigserial primary keys (int64) while
GUIDs are retained for external/public identification. Updated store
functions (TouchProject, UpdateThoughtMetadata, AddThoughtAttachment) to
query by id instead of guid, added GetThoughtByID, changed semanticSearch
and all tool helpers to use *int64 project IDs, and updated retry/backfill
workers to use int64 thought IDs throughout.
2026-05-03 11:43:34 +02:00

26 lines
739 B
Plaintext

Table stored_files {
id bigserial [pk]
guid uuid [unique, not null, default: `gen_random_uuid()`]
thought_id bigint [ref: > thoughts.id]
project_id bigint [ref: > projects.id]
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()`]
indexes {
thought_id
project_id
sha256
}
}
// Cross-file refs (for relspecgo merge)
Ref: stored_files.thought_id > thoughts.id [delete: set null]
Ref: stored_files.project_id > projects.id [delete: set null]