Files
amcs/schema/core.dbml
T
warkanum 4b3f0b1b55
CI / build-and-test (push) Failing after 1m53s
CI / build-and-test (pull_request) Failing after 1m43s
feat: add per-user tenant scoping
2026-07-15 04:27:44 +02:00

76 lines
1.7 KiB
Plaintext

Table thoughts {
id bigserial [pk]
guid uuid [unique, not null, default: `gen_random_uuid()`]
content text [not null]
metadata jsonb [default: `'{}'::jsonb`]
created_at timestamptz [default: `now()`]
updated_at timestamptz [default: `now()`]
project_id bigint [ref: > projects.id]
tenant_key text
archived_at timestamptz
indexes {
tenant_key
(tenant_key, project_id)
}
}
Table projects {
id bigserial [pk]
guid uuid [unique, not null, default: `gen_random_uuid()`]
name text [not null]
description text
tenant_key text
created_at timestamptz [default: `now()`]
last_active_at timestamptz [default: `now()`]
indexes {
(tenant_key, name) [unique]
tenant_key
}
}
Table thought_links {
id bigserial [pk]
from_id bigint [not null, ref: > thoughts.id]
to_id bigint [not null, ref: > thoughts.id]
relation text [not null]
created_at timestamptz [default: `now()`]
indexes {
(from_id, to_id, relation) [pk]
from_id
to_id
}
}
Table thought_learning_links {
id bigserial [pk]
thought_id bigint [not null, ref: > thoughts.id]
learning_id bigint [not null, ref: > learnings.id]
relation text [not null, default: `'source'`]
created_at timestamptz [not null, default: `now()`]
indexes {
(thought_id, learning_id) [unique]
thought_id
learning_id
}
}
Table embeddings {
id bigserial [pk]
guid uuid [unique, not null, default: `gen_random_uuid()`]
thought_id bigint [not null, ref: > thoughts.id]
model text [not null]
dim int [not null]
embedding vector [not null]
created_at timestamptz [default: `now()`]
updated_at timestamptz [default: `now()`]
indexes {
(thought_id, model) [unique]
thought_id
}
}