This repository has been archived by the owner on Jul 2, 2024. It is now read-only.
forked from eesast/hasura
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: tables for course (eesast#176)
* feat: tables for course * fix(ci)
- Loading branch information
Showing
41 changed files
with
546 additions
and
17 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
migrations/1715862217496_alter_table_public_share_course_alter_column_year/down.sql
This file contains 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 @@ | ||
alter table "public"."share_course" alter column "year" set default '2000'; |
1 change: 1 addition & 0 deletions
1
migrations/1715862217496_alter_table_public_share_course_alter_column_year/up.sql
This file contains 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 @@ | ||
ALTER TABLE "public"."share_course" ALTER COLUMN "year" drop default; |
1 change: 1 addition & 0 deletions
1
migrations/1715862389376_rename_table_public_share_course/down.sql
This file contains 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 @@ | ||
alter table "public"."course" rename to "share_course"; |
1 change: 1 addition & 0 deletions
1
migrations/1715862389376_rename_table_public_share_course/up.sql
This file contains 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 @@ | ||
alter table "public"."share_course" rename to "course"; |
1 change: 1 addition & 0 deletions
1
migrations/1715862553637_create_table_public_course_manager/down.sql
This file contains 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 @@ | ||
DROP TABLE "public"."course_manager"; |
1 change: 1 addition & 0 deletions
1
migrations/1715862553637_create_table_public_course_manager/up.sql
This file contains 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 @@ | ||
CREATE TABLE "public"."course_manager" ("user" uuid NOT NULL, PRIMARY KEY ("user") , FOREIGN KEY ("user") REFERENCES "public"."users"("uuid") ON UPDATE restrict ON DELETE cascade, UNIQUE ("user"));COMMENT ON TABLE "public"."course_manager" IS E'课程共享平台的管理员'; |
1 change: 1 addition & 0 deletions
1
migrations/1715863435652_create_table_public_course_info/down.sql
This file contains 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 @@ | ||
DROP TABLE "public"."course_info"; |
1 change: 1 addition & 0 deletions
1
migrations/1715863435652_create_table_public_course_info/up.sql
This file contains 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 @@ | ||
CREATE TABLE "public"."course_info" ("course_id" uuid NOT NULL, "key" text NOT NULL, "value" text, PRIMARY KEY ("course_id","key") , FOREIGN KEY ("course_id") REFERENCES "public"."course"("uuid") ON UPDATE restrict ON DELETE cascade);COMMENT ON TABLE "public"."course_info" IS E'课程信息键值对表,对manager开放编辑'; |
1 change: 1 addition & 0 deletions
1
migrations/1715863956306_create_table_public_course_comment/down.sql
This file contains 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 @@ | ||
DROP TABLE "public"."course_comment"; |
2 changes: 2 additions & 0 deletions
2
migrations/1715863956306_create_table_public_course_comment/up.sql
This file contains 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,2 @@ | ||
CREATE TABLE "public"."course_comment" ("uuid" uuid NOT NULL DEFAULT gen_random_uuid(), "course" uuid NOT NULL, "user" uuid NOT NULL, "comment" text NOT NULL, "created_at" timestamptz NOT NULL DEFAULT now(), PRIMARY KEY ("uuid") , FOREIGN KEY ("course") REFERENCES "public"."course"("uuid") ON UPDATE restrict ON DELETE cascade, FOREIGN KEY ("user") REFERENCES "public"."users"("uuid") ON UPDATE restrict ON DELETE cascade, UNIQUE ("uuid"));COMMENT ON TABLE "public"."course_comment" IS E'用户评论表'; | ||
CREATE EXTENSION IF NOT EXISTS pgcrypto; |
1 change: 1 addition & 0 deletions
1
migrations/1715863998351_alter_table_public_course_info_alter_column_course_id/down.sql
This file contains 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 @@ | ||
alter table "public"."course_info" rename column "course" to "course_id"; |
1 change: 1 addition & 0 deletions
1
migrations/1715863998351_alter_table_public_course_info_alter_column_course_id/up.sql
This file contains 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 @@ | ||
alter table "public"."course_info" rename column "course_id" to "course"; |
1 change: 1 addition & 0 deletions
1
migrations/1715865468541_create_table_public_course_rating/down.sql
This file contains 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 @@ | ||
DROP TABLE "public"."course_rating"; |
17 changes: 17 additions & 0 deletions
17
migrations/1715865468541_create_table_public_course_rating/up.sql
This file contains 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,17 @@ | ||
CREATE TABLE "public"."course_rating" ("course" uuid NOT NULL, "user" uuid NOT NULL, "dim1" integer NOT NULL, "dim2" integer NOT NULL, "dim3" integer NOT NULL, "dim4" integer NOT NULL, "dim5" integer NOT NULL, "dim6" integer NOT NULL, "created_at" timestamptz NOT NULL DEFAULT now(), "updated_at" timestamptz NOT NULL DEFAULT now(), PRIMARY KEY ("course","user") , FOREIGN KEY ("course") REFERENCES "public"."course"("uuid") ON UPDATE restrict ON DELETE cascade, FOREIGN KEY ("user") REFERENCES "public"."users"("uuid") ON UPDATE restrict ON DELETE cascade);COMMENT ON TABLE "public"."course_rating" IS E'用户评分表'; | ||
CREATE OR REPLACE FUNCTION "public"."set_current_timestamp_updated_at"() | ||
RETURNS TRIGGER AS $$ | ||
DECLARE | ||
_new record; | ||
BEGIN | ||
_new := NEW; | ||
_new."updated_at" = NOW(); | ||
RETURN _new; | ||
END; | ||
$$ LANGUAGE plpgsql; | ||
CREATE TRIGGER "set_public_course_rating_updated_at" | ||
BEFORE UPDATE ON "public"."course_rating" | ||
FOR EACH ROW | ||
EXECUTE PROCEDURE "public"."set_current_timestamp_updated_at"(); | ||
COMMENT ON TRIGGER "set_public_course_rating_updated_at" ON "public"."course_rating" | ||
IS 'trigger to set value of column "updated_at" to current timestamp on row update'; |
1 change: 1 addition & 0 deletions
1
migrations/1715865744257_alter_table_public_course_rating_alter_column_dim1/down.sql
This file contains 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 @@ | ||
comment on column "public"."course_rating"."dim1" is NULL; |
1 change: 1 addition & 0 deletions
1
migrations/1715865744257_alter_table_public_course_rating_alter_column_dim1/up.sql
This file contains 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 @@ | ||
comment on column "public"."course_rating"."dim1" is E'任务量'; |
1 change: 1 addition & 0 deletions
1
migrations/1715865756507_alter_table_public_course_rating_alter_column_dim2/down.sql
This file contains 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 @@ | ||
comment on column "public"."course_rating"."dim2" is NULL; |
1 change: 1 addition & 0 deletions
1
migrations/1715865756507_alter_table_public_course_rating_alter_column_dim2/up.sql
This file contains 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 @@ | ||
comment on column "public"."course_rating"."dim2" is E'内容难度'; |
1 change: 1 addition & 0 deletions
1
migrations/1715865767848_alter_table_public_course_rating_alter_column_dim3/down.sql
This file contains 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 @@ | ||
comment on column "public"."course_rating"."dim3" is NULL; |
1 change: 1 addition & 0 deletions
1
migrations/1715865767848_alter_table_public_course_rating_alter_column_dim3/up.sql
This file contains 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 @@ | ||
comment on column "public"."course_rating"."dim3" is E'上课质量'; |
1 change: 1 addition & 0 deletions
1
migrations/1715865788461_alter_table_public_course_rating_alter_column_dim4/down.sql
This file contains 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 @@ | ||
comment on column "public"."course_rating"."dim4" is NULL; |
1 change: 1 addition & 0 deletions
1
migrations/1715865788461_alter_table_public_course_rating_alter_column_dim4/up.sql
This file contains 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 @@ | ||
comment on column "public"."course_rating"."dim4" is E'收获感'; |
1 change: 1 addition & 0 deletions
1
migrations/1715865799918_alter_table_public_course_rating_alter_column_dim5/down.sql
This file contains 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 @@ | ||
comment on column "public"."course_rating"."dim5" is NULL; |
1 change: 1 addition & 0 deletions
1
migrations/1715865799918_alter_table_public_course_rating_alter_column_dim5/up.sql
This file contains 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 @@ | ||
comment on column "public"."course_rating"."dim5" is E'给分好坏'; |
1 change: 1 addition & 0 deletions
1
migrations/1715865812399_alter_table_public_course_rating_alter_column_dim6/down.sql
This file contains 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 @@ | ||
comment on column "public"."course_rating"."dim6" is NULL; |
1 change: 1 addition & 0 deletions
1
migrations/1715865812399_alter_table_public_course_rating_alter_column_dim6/up.sql
This file contains 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 @@ | ||
comment on column "public"."course_rating"."dim6" is E'考试作业讲课相关度'; |
1 change: 1 addition & 0 deletions
1
migrations/1715865946838_alter_table_public_course_comment_alter_column_course/down.sql
This file contains 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 @@ | ||
alter table "public"."course_comment" rename column "course_id" to "course"; |
1 change: 1 addition & 0 deletions
1
migrations/1715865946838_alter_table_public_course_comment_alter_column_course/up.sql
This file contains 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 @@ | ||
alter table "public"."course_comment" rename column "course" to "course_id"; |
1 change: 1 addition & 0 deletions
1
migrations/1715865961801_alter_table_public_course_comment_alter_column_user/down.sql
This file contains 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 @@ | ||
alter table "public"."course_comment" rename column "user_uuid" to "user"; |
1 change: 1 addition & 0 deletions
1
migrations/1715865961801_alter_table_public_course_comment_alter_column_user/up.sql
This file contains 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 @@ | ||
alter table "public"."course_comment" rename column "user" to "user_uuid"; |
1 change: 1 addition & 0 deletions
1
migrations/1715865975726_alter_table_public_course_info_alter_column_course/down.sql
This file contains 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 @@ | ||
alter table "public"."course_info" rename column "course_id" to "course"; |
1 change: 1 addition & 0 deletions
1
migrations/1715865975726_alter_table_public_course_info_alter_column_course/up.sql
This file contains 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 @@ | ||
alter table "public"."course_info" rename column "course" to "course_id"; |
1 change: 1 addition & 0 deletions
1
migrations/1715865989663_alter_table_public_course_manager_alter_column_user/down.sql
This file contains 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 @@ | ||
alter table "public"."course_manager" rename column "user_uuid" to "user"; |
1 change: 1 addition & 0 deletions
1
migrations/1715865989663_alter_table_public_course_manager_alter_column_user/up.sql
This file contains 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 @@ | ||
alter table "public"."course_manager" rename column "user" to "user_uuid"; |
1 change: 1 addition & 0 deletions
1
migrations/1715866006997_alter_table_public_course_rating_alter_column_course/down.sql
This file contains 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 @@ | ||
alter table "public"."course_rating" rename column "course_id" to "course"; |
1 change: 1 addition & 0 deletions
1
migrations/1715866006997_alter_table_public_course_rating_alter_column_course/up.sql
This file contains 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 @@ | ||
alter table "public"."course_rating" rename column "course" to "course_id"; |
1 change: 1 addition & 0 deletions
1
migrations/1715866021810_alter_table_public_course_rating_alter_column_user/down.sql
This file contains 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 @@ | ||
alter table "public"."course_rating" rename column "user_uuid" to "user"; |
1 change: 1 addition & 0 deletions
1
migrations/1715866021810_alter_table_public_course_rating_alter_column_user/up.sql
This file contains 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 @@ | ||
alter table "public"."course_rating" rename column "user" to "user_uuid"; |
21 changes: 21 additions & 0 deletions
21
migrations/1715945631359_alter_table_public_course_comment_add_column_updated_at/down.sql
This file contains 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,21 @@ | ||
-- Could not auto-generate a down migration. | ||
-- Please write an appropriate down migration for the SQL below: | ||
-- alter table "public"."course_comment" add column "updated_at" timestamptz | ||
-- null default now(); | ||
-- | ||
-- CREATE OR REPLACE FUNCTION "public"."set_current_timestamp_updated_at"() | ||
-- RETURNS TRIGGER AS $$ | ||
-- DECLARE | ||
-- _new record; | ||
-- BEGIN | ||
-- _new := NEW; | ||
-- _new."updated_at" = NOW(); | ||
-- RETURN _new; | ||
-- END; | ||
-- $$ LANGUAGE plpgsql; | ||
-- CREATE TRIGGER "set_public_course_comment_updated_at" | ||
-- BEFORE UPDATE ON "public"."course_comment" | ||
-- FOR EACH ROW | ||
-- EXECUTE PROCEDURE "public"."set_current_timestamp_updated_at"(); | ||
-- COMMENT ON TRIGGER "set_public_course_comment_updated_at" ON "public"."course_comment" | ||
-- IS 'trigger to set value of column "updated_at" to current timestamp on row update'; |
19 changes: 19 additions & 0 deletions
19
migrations/1715945631359_alter_table_public_course_comment_add_column_updated_at/up.sql
This file contains 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,19 @@ | ||
alter table "public"."course_comment" add column "updated_at" timestamptz | ||
null default now(); | ||
|
||
CREATE OR REPLACE FUNCTION "public"."set_current_timestamp_updated_at"() | ||
RETURNS TRIGGER AS $$ | ||
DECLARE | ||
_new record; | ||
BEGIN | ||
_new := NEW; | ||
_new."updated_at" = NOW(); | ||
RETURN _new; | ||
END; | ||
$$ LANGUAGE plpgsql; | ||
CREATE TRIGGER "set_public_course_comment_updated_at" | ||
BEFORE UPDATE ON "public"."course_comment" | ||
FOR EACH ROW | ||
EXECUTE PROCEDURE "public"."set_current_timestamp_updated_at"(); | ||
COMMENT ON TRIGGER "set_public_course_comment_updated_at" ON "public"."course_comment" | ||
IS 'trigger to set value of column "updated_at" to current timestamp on row update'; |