Skip to content
This repository was archived by the owner on Feb 17, 2026. It is now read-only.

docs: update schema documentation#5

Merged
kubrickcode merged 1 commit intomainfrom
docs/update-schema-docs
Jan 23, 2026
Merged

docs: update schema documentation#5
kubrickcode merged 1 commit intomainfrom
docs/update-schema-docs

Conversation

@kubrickcode
Copy link
Member

Automated update of schema documentation from specvital-infra.

Generated by tbls - includes:

  • Table details with columns, types, constraints
  • Indexes and unique keys
  • ER diagram (Mermaid)

Triggered by: feat(db): add user_id column to spec_documents table

AI Spec documents incur LLM API costs, requiring access control so only creators can view their documents.
The previous global cache structure had a cost fairness issue where user B could freely view documents that user A paid to generate.

Included user_id in unique constraints to implement per-user document isolation.
Set ON DELETE CASCADE so documents are deleted when users are removed.

@gemini-code-assist
Copy link

Summary of Changes

Hello @kubrickcode, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request automates the update of the database schema documentation, primarily driven by the addition of a user_id column to the spec_documents table. This critical change enables robust per-user document isolation, addressing previous concerns regarding cost fairness for AI-generated content. The update also ensures data integrity by implementing cascading deletes for user-owned documents and propagates the user_id foreign key relationship across relevant ER diagrams.

Highlights

  • User ID Integration: The spec_documents table now includes a user_id column, establishing ownership for each document and enabling per-user document isolation.
  • Unique Constraint Updates: Existing unique constraints on spec_documents (uq_spec_documents_analysis_lang_version and uq_spec_documents_hash_lang_model_version) have been modified to incorporate user_id, preventing cost fairness issues by ensuring uniqueness per user.
  • Cascading Deletes: A new foreign key constraint fk_spec_documents_user has been added, linking spec_documents to users with ON DELETE CASCADE, ensuring that documents are automatically removed when their owner is deleted.
  • Automated Schema Documentation Update: The database schema documentation, including README.md, individual table markdown files, and schema.json, has been automatically updated to reflect these structural changes and new relationships.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

The pull request successfully updates the schema documentation to reflect the addition of the user_id column to the public.spec_documents table. This change aligns with the stated goal of implementing per-user document isolation and managing LLM API costs. The updates to schema.json and the main README.md are accurate. However, there appear to be some inconsistencies in the generated Mermaid ER diagrams across several individual table documentation files, where the user_id column has been incorrectly added to tables other than public.spec_documents. Additionally, some full table definitions are duplicated across multiple documentation files, which could lead to maintenance challenges.

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.

Comment on lines +104 to +113
"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
}

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.

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.

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.

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.

Comment on lines +135 to +146
"public.spec_documents" {
uuid id
uuid analysis_id FK
bytea content_hash
varchar_10_ language
text executive_summary
varchar_100_ model_id
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 full definition for the public.spec_documents table is duplicated here. This information should ideally reside only in public.spec_documents.md to avoid redundancy and potential inconsistencies if the public.spec_documents schema changes in the future. Please remove this duplicated block.

@kubrickcode kubrickcode merged commit 49742fe into main Jan 23, 2026
1 check passed
@kubrickcode kubrickcode deleted the docs/update-schema-docs branch January 23, 2026 13:34
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant