This repository was archived by the owner on Feb 17, 2026. It is now read-only.
generated from kubrickcode/Template-Repository
-
-
Notifications
You must be signed in to change notification settings - Fork 0
docs: update schema documentation #9
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| # public.quota_reservations | ||
|
|
||
| ## Description | ||
|
|
||
| ## Columns | ||
|
|
||
| | Name | Type | Default | Nullable | Children | Parents | Comment | | ||
| | --------------- | ------------------------ | ------------------------------ | -------- | -------- | ------------------------------- | ------- | | ||
| | id | uuid | gen_random_uuid() | false | | | | | ||
| | user_id | uuid | | false | | [public.users](public.users.md) | | | ||
| | event_type | usage_event_type | | false | | | | | ||
| | reserved_amount | integer | | false | | | | | ||
| | job_id | bigint | | false | | | | | ||
| | expires_at | timestamp with time zone | (now() + '01:00:00'::interval) | false | | | | | ||
| | created_at | timestamp with time zone | now() | false | | | | | ||
|
Comment on lines
+9
to
+15
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The For example:
|
||
|
|
||
| ## Constraints | ||
|
|
||
| | Name | Type | Definition | | ||
| | ---------------------------- | ----------- | ------------------------------------------------------------ | | ||
| | chk_reserved_amount_positive | CHECK | CHECK ((reserved_amount > 0)) | | ||
| | fk_quota_reservations_user | FOREIGN KEY | FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE | | ||
| | quota_reservations_pkey | PRIMARY KEY | PRIMARY KEY (id) | | ||
| | uq_quota_reservations_job_id | UNIQUE | UNIQUE (job_id) | | ||
|
|
||
| ## Indexes | ||
|
|
||
| | Name | Definition | | ||
| | --------------------------------- | ------------------------------------------------------------------------------------------------------------- | | ||
| | quota_reservations_pkey | CREATE UNIQUE INDEX quota_reservations_pkey ON public.quota_reservations USING btree (id) | | ||
| | uq_quota_reservations_job_id | CREATE UNIQUE INDEX uq_quota_reservations_job_id ON public.quota_reservations USING btree (job_id) | | ||
| | idx_quota_reservations_expires | CREATE INDEX idx_quota_reservations_expires ON public.quota_reservations USING btree (expires_at) | | ||
| | idx_quota_reservations_user_event | CREATE INDEX idx_quota_reservations_user_event ON public.quota_reservations USING btree (user_id, event_type) | | ||
|
|
||
| ## Relations | ||
|
|
||
| ```mermaid | ||
| erDiagram | ||
|
|
||
| "public.quota_reservations" }o--|| "public.users" : "FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE" | ||
|
|
||
| "public.quota_reservations" { | ||
| uuid id | ||
| uuid user_id FK | ||
| usage_event_type event_type | ||
| integer reserved_amount | ||
| bigint job_id | ||
| timestamp_with_time_zone expires_at | ||
| timestamp_with_time_zone created_at | ||
| } | ||
| "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 | ||
| } | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| > Generated by [tbls](https://github.com/k1LoW/tbls) | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
Descriptionsection for the newquota_reservationstable is empty. Adding a brief explanation of the table's purpose would significantly improve the documentation's clarity, especially for new developers. You could use information from the pull request description to explain how this table helps prevent race conditions in quota management.