Skip to content

Commit

Permalink
Modify the warehouse and add fields
Browse files Browse the repository at this point in the history
In this submission, the original redundant table `t_user_repository`
was deleted, and the current table `t_user_star_repository` was added
to reflect the collection relationship.

And now two fields are added to the warehouse table, `http_url` for the
link under the https protocol and `ssh_url` for the link under the ssh
protocol.

See #46 and #48.
  • Loading branch information
Quentin9922 committed Sep 20, 2024
1 parent 263fa3f commit f08a751
Show file tree
Hide file tree
Showing 6 changed files with 187 additions and 276 deletions.
7 changes: 1 addition & 6 deletions database/constraint/all_column_constraint.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,4 @@ ADD CONSTRAINT pk_repository PRIMARY KEY (id);

-- The constraint of t_user is added to the table.
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);
ADD CONSTRAINT pk_user_table 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(255) NOT NULL,
ssh_url character varying(255) 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.';

0 comments on commit f08a751

Please sign in to comment.