- Add explicit Ref: blocks at bottom of each DBML file for cross-file FK relationships - files.dbml: stored_files → thoughts, projects - skills.dbml: project_skills/project_guardrails → projects - meta.dbml: chat_histories → projects - Update Makefile to use the relspec merge workflow where applicable - Regenerate 020_generated_schema.sql with proper cross-file constraints Addresses review comment on PR #20
26 lines
743 B
Plaintext
26 lines
743 B
Plaintext
Table stored_files {
|
|
id bigserial [pk]
|
|
guid uuid [unique, not null, default: `gen_random_uuid()`]
|
|
thought_id uuid [ref: > thoughts.guid]
|
|
project_id uuid [ref: > projects.guid]
|
|
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.guid [delete: set null]
|
|
Ref: stored_files.project_id > projects.guid [delete: set null]
|