feat: add DBML schema files and relspecgo migration generation
- Add schema/*.dbml covering all existing tables (001-019) - Wire relspecgo via make generate-migrations target - Add make check-schema-drift for CI drift detection - Add schema/README.md documenting the DBML-first workflow Closes #19
This commit is contained in:
48
schema/core.dbml
Normal file
48
schema/core.dbml
Normal file
@@ -0,0 +1,48 @@
|
||||
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 uuid [ref: > projects.guid]
|
||||
archived_at timestamptz
|
||||
}
|
||||
|
||||
Table projects {
|
||||
id bigserial [pk]
|
||||
guid uuid [unique, not null, default: `gen_random_uuid()`]
|
||||
name text [unique, not null]
|
||||
description text
|
||||
created_at timestamptz [default: `now()`]
|
||||
last_active_at timestamptz [default: `now()`]
|
||||
}
|
||||
|
||||
Table thought_links {
|
||||
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 embeddings {
|
||||
id bigserial [pk]
|
||||
guid uuid [unique, not null, default: `gen_random_uuid()`]
|
||||
thought_id uuid [not null, ref: > thoughts.guid]
|
||||
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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user