diff --git a/database/constraint/all_column_constraint.sql b/database/constraint/all_column_constraint.sql index 3deb7a5..db6cd16 100644 --- a/database/constraint/all_column_constraint.sql +++ b/database/constraint/all_column_constraint.sql @@ -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); \ No newline at end of file diff --git a/database/diagram/gcs_back_end.drawio b/database/diagram/gcs_back_end.drawio index 51b670e..0df2262 100644 --- a/database/diagram/gcs_back_end.drawio +++ b/database/diagram/gcs_back_end.drawio @@ -1,467 +1,377 @@ - + - + - + - - + + - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - + + - + - - - + + + - - + + - + - - - + + + - - + + - + - - - + + + - - + + - + - - - + + + - - + + - + - - - + + + - - + + - + - - - + + + - - + + - + - - - - - - - - - - - + + + - - - - + + - - + + - + - - - + + + - - + + - + - - - + + + - - + + - + - - - + + + - - + + - + - - - + + + - - - - - + + - + - + - - + + - + - + - - + + - + - + - - + + - + - + - - + + - + - + - - + + - + - + - - + + - + - + - - + + - + - + - - + + - - - - + - - - - - - - - - - - + + + - - - - + + - - + + - + - - - + + + - - + + - + - - - + + + - - + + - + - - - + + + - - + + - + - - - + + + - - + + - + - - - + + + - - + + - + - - - + + + - - - - - - + + + + - - - + + + + diff --git a/database/diagram/gcs_back_end.png b/database/diagram/gcs_back_end.png index 9b7b77d..79cc3f2 100644 Binary files a/database/diagram/gcs_back_end.png and b/database/diagram/gcs_back_end.png differ diff --git a/database/table/t_repository.sql b/database/table/t_repository.sql index a571ecf..5f46b23 100644 --- a/database/table/t_repository.sql +++ b/database/table/t_repository.sql @@ -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 @@ -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. diff --git a/database/table/t_user_repository.sql b/database/table/t_user_repository.sql deleted file mode 100644 index 3c142c8..0000000 --- a/database/table/t_user_repository.sql +++ /dev/null @@ -1,18 +0,0 @@ -CREATE TABLE public.t_user_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_repository IS 'Table for storing relationships between users and repositories.'; - -COMMENT ON COLUMN public.t_user_repository.id IS 'Primary key of the user_repository table.'; -COMMENT ON COLUMN public.t_user_repository.user_id IS 'ID of the user.'; -COMMENT ON COLUMN public.t_user_repository.repository_id IS 'ID of the repository.'; -COMMENT ON COLUMN public.t_user_repository.gmt_created IS 'Timestamp when the relationship was created.'; -COMMENT ON COLUMN public.t_user_repository.gmt_updated IS 'Timestamp when the relationship was last updated.'; -COMMENT ON COLUMN public.t_user_repository.gmt_deleted IS 'Timestamp when the relationship was deleted. -If set to NULL, it indicates that this table has not been deleted.'; diff --git a/database/table/t_user_star_repository.sql b/database/table/t_user_star_repository.sql new file mode 100644 index 0000000..a90a11a --- /dev/null +++ b/database/table/t_user_star_repository.sql @@ -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.';