Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify the tables and add fields #50

Merged
merged 1 commit into from
Sep 24, 2024
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
7 changes: 3 additions & 4 deletions database/constraint/all_column_constraint.sql
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ ADD CONSTRAINT pk_repository PRIMARY KEY (id);
ALTER TABLE ONLY public.t_user
ADD CONSTRAINT pk_user_table PRIMARY KEY (id);

-- The constraint of t_user_repository is not necessary,
-- as the primary key is already unique.
ALTER TABLE ONLY public.t_user_repository
ADD CONSTRAINT pk_user_repository PRIMARY KEY (id);
-- The constraint of t_user_star_repository is added to the table.
ALTER TABLE ONLY public.t_user_star_repository
ADD CONSTRAINT pk_user_star_repository PRIMARY KEY (id);
414 changes: 162 additions & 252 deletions database/diagram/gcs_back_end.drawio

Large diffs are not rendered by default.

Binary file modified database/diagram/gcs_back_end.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions database/table/t_repository.sql
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ CREATE TABLE public.t_repository (
star integer DEFAULT 0 NOT NULL,
fork integer DEFAULT 0 NOT NULL,
watcher integer DEFAULT 0 NOT NULL,
https_url character varying(1024) NOT NULL,
ssh_url character varying(1024) NOT NULL,
gmt_created timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
gmt_updated timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
gmt_deleted timestamp without time zone
Expand All @@ -19,6 +21,11 @@ COMMENT ON COLUMN public.t_repository.repository_name IS 'Name of the repository
COMMENT ON COLUMN public.t_repository.repository_description IS 'Description of the repository.';
COMMENT ON COLUMN public.t_repository.is_private IS 'Indicates if the repository is private.';
COMMENT ON COLUMN public.t_repository.user_id IS 'ID of the user who owns the repository.';
COMMENT ON COLUMN public.t_repository.star IS 'Number of stars the repository has received.';
COMMENT ON COLUMN public.t_repository.fork IS 'Number of times the repository has been forked.';
COMMENT ON COLUMN public.t_repository.watcher IS 'Number of users watching the repository.';
COMMENT ON COLUMN public.t_repository.https_url IS 'Repository link under HTTPS protocol.';
COMMENT ON COLUMN public.t_repository.ssh_url IS 'Repository link under SSH protocol.';
COMMENT ON COLUMN public.t_repository.gmt_created IS 'Timestamp when the repository was created.';
COMMENT ON COLUMN public.t_repository.gmt_updated IS 'Timestamp when the repository was last updated.';
COMMENT ON COLUMN public.t_repository.gmt_deleted IS 'Timestamp when the repository was deleted.
Expand Down
18 changes: 0 additions & 18 deletions database/table/t_user_repository.sql

This file was deleted.

17 changes: 17 additions & 0 deletions database/table/t_user_star_repository.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
CREATE TABLE public.t_user_star_repository (
id bigint NOT NULL,
user_id bigint NOT NULL,
repository_id bigint NOT NULL,
gmt_created timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
gmt_updated timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
gmt_deleted timestamp without time zone
);

COMMENT ON TABLE public.t_user_star_repository IS 'Table for storing relationships between users and starred repositories.';

COMMENT ON COLUMN public.t_user_star_repository.id IS 'Primary key of the user_star_repository table.';
COMMENT ON COLUMN public.t_user_star_repository.user_id IS 'ID of the user who starred the repository.';
COMMENT ON COLUMN public.t_user_star_repository.repository_id IS 'ID of the repository that has been starred.';
COMMENT ON COLUMN public.t_user_star_repository.gmt_created IS 'Timestamp when the relationship was created.';
COMMENT ON COLUMN public.t_user_star_repository.gmt_updated IS 'Timestamp when the relationship was last updated.';
COMMENT ON COLUMN public.t_user_star_repository.gmt_deleted IS 'Timestamp when the relationship was deleted. If set to NULL, it indicates that this relationship has not been deleted.';
Loading