Skip to content
This repository was archived by the owner on Feb 17, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions docs/schema/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
| [public.users](public.users.md) | 8 | | BASE TABLE |
| [public.oauth_accounts](public.oauth_accounts.md) | 9 | | BASE TABLE |
| [public.user_bookmarks](public.user_bookmarks.md) | 4 | | BASE TABLE |
| [public.user_analysis_history](public.user_analysis_history.md) | 5 | | BASE TABLE |
| [public.user_analysis_history](public.user_analysis_history.md) | 6 | | BASE TABLE |
| [public.github_organizations](public.github_organizations.md) | 8 | | BASE TABLE |
| [public.user_github_org_memberships](public.user_github_org_memberships.md) | 6 | | BASE TABLE |
| [public.user_github_repositories](public.user_github_repositories.md) | 20 | | BASE TABLE |
| [public.github_app_installations](public.github_app_installations.md) | 10 | | BASE TABLE |
| [public.refresh_tokens](public.refresh_tokens.md) | 8 | | BASE TABLE |
| [public.test_files](public.test_files.md) | 5 | | BASE TABLE |
| [public.system_config](public.system_config.md) | 3 | | BASE TABLE |
| [public.spec_documents](public.spec_documents.md) | 10 | | BASE TABLE |
| [public.spec_documents](public.spec_documents.md) | 11 | | BASE TABLE |
| [public.spec_domains](public.spec_domains.md) | 8 | | BASE TABLE |
| [public.spec_features](public.spec_features.md) | 7 | | BASE TABLE |
| [public.spec_behaviors](public.spec_behaviors.md) | 7 | | BASE TABLE |
Expand Down Expand Up @@ -174,6 +174,7 @@ erDiagram
timestamp_with_time_zone created_at
timestamp_with_time_zone updated_at
uuid id
integer retention_days_at_creation
}
"public.github_organizations" {
uuid id
Expand Down Expand Up @@ -260,6 +261,7 @@ erDiagram
timestamp_with_time_zone updated_at
integer version
uuid user_id FK
integer retention_days_at_creation
}
"public.spec_domains" {
uuid id
Expand Down
2 changes: 2 additions & 0 deletions docs/schema/public.analyses.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ erDiagram
timestamp_with_time_zone created_at
timestamp_with_time_zone updated_at
uuid id
integer retention_days_at_creation
}
"public.test_files" {
uuid id
Expand All @@ -87,6 +88,7 @@ erDiagram
timestamp_with_time_zone updated_at
integer version
uuid user_id FK
integer retention_days_at_creation
}
"public.usage_events" {
uuid id
Expand Down
42 changes: 23 additions & 19 deletions docs/schema/public.spec_documents.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,30 @@

## Columns

| Name | Type | Default | Nullable | Children | Parents | Comment |
| ----------------- | ------------------------ | ----------------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------- | ------- |
| id | uuid | gen_random_uuid() | false | [public.spec_domains](public.spec_domains.md) [public.user_specview_history](public.user_specview_history.md) [public.usage_events](public.usage_events.md) | | |
| analysis_id | uuid | | false | | [public.analyses](public.analyses.md) | |
| content_hash | bytea | | false | | | |
| language | varchar(10) | 'en'::character varying | false | | | |
| executive_summary | text | | true | | | |
| model_id | varchar(100) | | false | | | |
| created_at | timestamp with time zone | now() | false | | | |
| updated_at | timestamp with time zone | now() | false | | | |
| version | integer | 1 | false | | | |
| user_id | uuid | | false | | [public.users](public.users.md) | |
| Name | Type | Default | Nullable | Children | Parents | Comment |
| -------------------------- | ------------------------ | ----------------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------- | ------- |
| id | uuid | gen_random_uuid() | false | [public.spec_domains](public.spec_domains.md) [public.user_specview_history](public.user_specview_history.md) [public.usage_events](public.usage_events.md) | | |
| analysis_id | uuid | | false | | [public.analyses](public.analyses.md) | |
| content_hash | bytea | | false | | | |
| language | varchar(10) | 'en'::character varying | false | | | |
| executive_summary | text | | true | | | |
| model_id | varchar(100) | | false | | | |
| created_at | timestamp with time zone | now() | false | | | |
| updated_at | timestamp with time zone | now() | false | | | |
| version | integer | 1 | false | | | |
| user_id | uuid | | false | | [public.users](public.users.md) | |
| retention_days_at_creation | integer | | true | | | |

## Constraints

| Name | Type | Definition |
| ---------------------------------------------- | ----------- | ------------------------------------------------------------------- |
| fk_spec_documents_analysis | FOREIGN KEY | FOREIGN KEY (analysis_id) REFERENCES analyses(id) ON DELETE CASCADE |
| fk_spec_documents_user | FOREIGN KEY | FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE |
| spec_documents_pkey | PRIMARY KEY | PRIMARY KEY (id) |
| uq_spec_documents_user_analysis_lang_version | UNIQUE | UNIQUE (user_id, analysis_id, language, version) |
| uq_spec_documents_user_hash_lang_model_version | UNIQUE | UNIQUE (user_id, content_hash, language, model_id, version) |
| Name | Type | Definition |
| ---------------------------------------------- | ----------- | ---------------------------------------------------------------------------------- |
| chk_retention_days_positive | CHECK | CHECK (((retention_days_at_creation IS NULL) OR (retention_days_at_creation > 0))) |
| fk_spec_documents_analysis | FOREIGN KEY | FOREIGN KEY (analysis_id) REFERENCES analyses(id) ON DELETE CASCADE |
| fk_spec_documents_user | FOREIGN KEY | FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE |
| spec_documents_pkey | PRIMARY KEY | PRIMARY KEY (id) |
| uq_spec_documents_user_analysis_lang_version | UNIQUE | UNIQUE (user_id, analysis_id, language, version) |
| uq_spec_documents_user_hash_lang_model_version | UNIQUE | UNIQUE (user_id, content_hash, language, model_id, version) |

## Indexes

Expand All @@ -37,6 +39,7 @@
| uq_spec_documents_user_hash_lang_model_version | CREATE UNIQUE INDEX uq_spec_documents_user_hash_lang_model_version ON public.spec_documents USING btree (user_id, content_hash, language, model_id, version) |
| idx_spec_documents_user_created | CREATE INDEX idx_spec_documents_user_created ON public.spec_documents USING btree (user_id, created_at) |
| idx_spec_documents_content_hash_lang_model | CREATE INDEX idx_spec_documents_content_hash_lang_model ON public.spec_documents USING btree (content_hash, language, model_id) |
| idx_spec_documents_retention_cleanup | CREATE INDEX idx_spec_documents_retention_cleanup ON public.spec_documents USING btree (created_at) WHERE (retention_days_at_creation IS NOT NULL) |

## Relations

Expand All @@ -60,6 +63,7 @@ erDiagram
timestamp_with_time_zone updated_at
integer version
uuid user_id FK
integer retention_days_at_creation
}
"public.spec_domains" {
uuid id
Expand Down
1 change: 1 addition & 0 deletions docs/schema/public.spec_domains.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ erDiagram
timestamp_with_time_zone updated_at
integer version
uuid user_id FK
integer retention_days_at_creation
}
```

Expand Down
1 change: 1 addition & 0 deletions docs/schema/public.usage_events.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ erDiagram
timestamp_with_time_zone updated_at
integer version
uuid user_id FK
integer retention_days_at_creation
}
```

Expand Down
Loading