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
4 changes: 3 additions & 1 deletion docs/schema/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
| [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) | 9 | | BASE TABLE |
| [public.spec_documents](public.spec_documents.md) | 10 | | 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 @@ -65,6 +65,7 @@ erDiagram
"public.refresh_tokens" }o--o| "public.refresh_tokens" : "FOREIGN KEY (replaces) REFERENCES refresh_tokens(id) ON DELETE SET NULL"
"public.test_files" }o--|| "public.analyses" : "FOREIGN KEY (analysis_id) REFERENCES analyses(id) ON DELETE CASCADE"
"public.spec_documents" }o--|| "public.analyses" : "FOREIGN KEY (analysis_id) REFERENCES analyses(id) ON DELETE CASCADE"
"public.spec_documents" }o--|| "public.users" : "FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE"
"public.spec_domains" }o--|| "public.spec_documents" : "FOREIGN KEY (document_id) REFERENCES spec_documents(id) ON DELETE CASCADE"
"public.spec_features" }o--|| "public.spec_domains" : "FOREIGN KEY (domain_id) REFERENCES spec_domains(id) ON DELETE CASCADE"
"public.spec_behaviors" }o--o| "public.test_cases" : "FOREIGN KEY (source_test_case_id) REFERENCES test_cases(id) ON DELETE SET NULL"
Expand Down Expand Up @@ -254,6 +255,7 @@ erDiagram
timestamp_with_time_zone created_at
timestamp_with_time_zone updated_at
integer version
uuid user_id FK
}
"public.spec_domains" {
uuid id
Expand Down
1 change: 1 addition & 0 deletions docs/schema/public.analyses.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ erDiagram
timestamp_with_time_zone created_at
timestamp_with_time_zone updated_at
integer version
uuid user_id FK

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The user_id column has been incorrectly added to the public.analyses table definition in this Mermaid ER diagram. Based on the PR description, user_id is intended for public.spec_documents only. Please remove this line to maintain accuracy.

}
"public.usage_events" {
uuid id
Expand Down
39 changes: 27 additions & 12 deletions docs/schema/public.spec_documents.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,27 @@
| 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) | |

## Constraints

| Name | Type | Definition |
| ----------------------------------------- | ----------- | ------------------------------------------------------------------- |
| fk_spec_documents_analysis | FOREIGN KEY | FOREIGN KEY (analysis_id) REFERENCES analyses(id) ON DELETE CASCADE |
| spec_documents_pkey | PRIMARY KEY | PRIMARY KEY (id) |
| uq_spec_documents_analysis_lang_version | UNIQUE | UNIQUE (analysis_id, language, version) |
| uq_spec_documents_hash_lang_model_version | UNIQUE | UNIQUE (content_hash, language, model_id, version) |
| 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) |

## Indexes

| Name | Definition |
| ----------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| spec_documents_pkey | CREATE UNIQUE INDEX spec_documents_pkey ON public.spec_documents USING btree (id) |
| idx_spec_documents_analysis | CREATE INDEX idx_spec_documents_analysis ON public.spec_documents USING btree (analysis_id) |
| uq_spec_documents_analysis_lang_version | CREATE UNIQUE INDEX uq_spec_documents_analysis_lang_version ON public.spec_documents USING btree (analysis_id, language, version) |
| uq_spec_documents_hash_lang_model_version | CREATE UNIQUE INDEX uq_spec_documents_hash_lang_model_version ON public.spec_documents USING btree (content_hash, language, model_id, version) |
| Name | Definition |
| ---------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| spec_documents_pkey | CREATE UNIQUE INDEX spec_documents_pkey ON public.spec_documents USING btree (id) |
| idx_spec_documents_analysis | CREATE INDEX idx_spec_documents_analysis ON public.spec_documents USING btree (analysis_id) |
| uq_spec_documents_user_analysis_lang_version | CREATE UNIQUE INDEX uq_spec_documents_user_analysis_lang_version ON public.spec_documents USING btree (user_id, analysis_id, language, version) |
| 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) |

## Relations

Expand All @@ -43,6 +46,7 @@ erDiagram
"public.user_specview_history" }o--|| "public.spec_documents" : "FOREIGN KEY (document_id) REFERENCES spec_documents(id) ON DELETE CASCADE"
"public.usage_events" }o--o| "public.spec_documents" : "FOREIGN KEY (document_id) REFERENCES spec_documents(id) ON DELETE SET NULL"
"public.spec_documents" }o--|| "public.analyses" : "FOREIGN KEY (analysis_id) REFERENCES analyses(id) ON DELETE CASCADE"
"public.spec_documents" }o--|| "public.users" : "FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE"

"public.spec_documents" {
uuid id
Expand All @@ -54,6 +58,7 @@ erDiagram
timestamp_with_time_zone created_at
timestamp_with_time_zone updated_at
integer version
uuid user_id FK
}
"public.spec_domains" {
uuid id
Expand Down Expand Up @@ -96,6 +101,16 @@ erDiagram
timestamp_with_time_zone committed_at
varchar_100_ parser_version
}
"public.users" {
uuid id
varchar_255_ email
varchar_255_ username
text avatar_url
timestamp_with_time_zone last_login_at
timestamp_with_time_zone created_at
timestamp_with_time_zone updated_at
integer token_version
}
Comment on lines +104 to +113

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The full definition for the public.users table is duplicated here. This information should ideally reside only in public.users.md to avoid redundancy and potential inconsistencies if the public.users schema changes in the future. Please remove this duplicated block.

```

---
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 @@ -66,6 +66,7 @@ erDiagram
timestamp_with_time_zone created_at
timestamp_with_time_zone updated_at
integer version
uuid user_id FK

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The user_id column has been incorrectly added to the public.spec_domains table definition in this Mermaid ER diagram. Based on the PR description, user_id is intended for public.spec_documents only. Please remove this line to maintain accuracy.

}
```

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 @@ -86,6 +86,7 @@ erDiagram
timestamp_with_time_zone created_at
timestamp_with_time_zone updated_at
integer version
uuid user_id FK

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The user_id column has been incorrectly added to the public.usage_events table definition in this Mermaid ER diagram. Based on the PR description, user_id is intended for public.spec_documents only. Please remove this line to maintain accuracy.

}
```

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The user_id column has been incorrectly added to the public.user_specview_history table definition in this Mermaid ER diagram. Based on the PR description, user_id is intended for public.spec_documents only. Please remove this line to maintain accuracy.

}
```

Expand Down
Loading