Skip to content

Commit

Permalink
add: add tables related to course comment - likes, stars & comments (e…
Browse files Browse the repository at this point in the history
  • Loading branch information
zzdhybthu authored May 25, 2024
1 parent 9c11183 commit a7fa81d
Show file tree
Hide file tree
Showing 17 changed files with 364 additions and 11 deletions.
351 changes: 340 additions & 11 deletions metadata/tables.yaml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
drop schema "course_comment_likes" cascade;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
create schema "course_comment_likes";
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-- Could not auto-generate a down migration.
-- Please write an appropriate down migration for the SQL below:
-- drop schema "course_comment_likes" cascade;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
drop schema "course_comment_likes" cascade;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DROP TABLE "public"."course_comment_likes";
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CREATE TABLE "public"."course_comment_likes" ("comment_uuid" uuid NOT NULL, "user_uuid" uuid NOT NULL, PRIMARY KEY ("comment_uuid","user_uuid") , FOREIGN KEY ("comment_uuid") REFERENCES "public"."course_comment"("uuid") ON UPDATE restrict ON DELETE restrict, FOREIGN KEY ("user_uuid") REFERENCES "public"."users"("uuid") ON UPDATE restrict ON DELETE restrict);
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alter table "public"."course_comment_like" rename to "course_comment_likes";
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alter table "public"."course_comment_likes" rename to "course_comment_like";
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DROP TABLE "public"."course_comment_star";
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CREATE TABLE "public"."course_comment_star" ("comment_uuid" uuid NOT NULL, "user_uuid" uuid NOT NULL, PRIMARY KEY ("comment_uuid","user_uuid") , FOREIGN KEY ("comment_uuid") REFERENCES "public"."course_comment"("uuid") ON UPDATE restrict ON DELETE restrict, FOREIGN KEY ("user_uuid") REFERENCES "public"."users"("uuid") ON UPDATE restrict ON DELETE restrict);
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
comment on column "public"."course_comment"."star" is E'用户评论表';
alter table "public"."course_comment" alter column "star" set default 0;
alter table "public"."course_comment" alter column "star" drop not null;
alter table "public"."course_comment" add column "star" int4;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alter table "public"."course_comment" drop column "star" cascade;
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
comment on column "public"."course_comment"."like" is E'用户评论表';
alter table "public"."course_comment" alter column "like" set default 0;
alter table "public"."course_comment" alter column "like" drop not null;
alter table "public"."course_comment" add column "like" int4;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alter table "public"."course_comment" drop column "like" cascade;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DROP TABLE "public"."course_comment_comment";
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CREATE TABLE "public"."course_comment_comment" ("comment_uuid" uuid NOT NULL, "user_uuid" uuid NOT NULL, "comment" text NOT NULL, "create_at" timestamptz NOT NULL DEFAULT now(), "update_at" timestamptz NOT NULL DEFAULT now(), PRIMARY KEY ("comment_uuid","user_uuid") , FOREIGN KEY ("comment_uuid") REFERENCES "public"."course_comment"("uuid") ON UPDATE restrict ON DELETE restrict, FOREIGN KEY ("user_uuid") REFERENCES "public"."users"("uuid") ON UPDATE restrict ON DELETE restrict);

0 comments on commit a7fa81d

Please sign in to comment.