-
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.
- Loading branch information
1 parent
65f8e05
commit 9f7e835
Showing
5 changed files
with
1,338 additions
and
1 deletion.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
node_modules | ||
.env | ||
google_credentials.json | ||
|
||
# Ignore seed csv data | ||
src/db/seed/database.csv | ||
|
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,26 @@ | ||
CREATE TABLE IF NOT EXISTS "testimonies" ( | ||
"id" text PRIMARY KEY NOT NULL, | ||
"user_id" text, | ||
"course_id" text NOT NULL, | ||
"user_name" text, | ||
"content" text NOT NULL, | ||
"assignments" text NOT NULL, | ||
"lecturer" text NOT NULL, | ||
"created_at" timestamp with time zone DEFAULT now() NOT NULL | ||
); | ||
--> statement-breakpoint | ||
ALTER TABLE "courses" ADD COLUMN "type" text DEFAULT 'Elective' NOT NULL;--> statement-breakpoint | ||
DO $$ BEGIN | ||
ALTER TABLE "testimonies" ADD CONSTRAINT "testimonies_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE set null ON UPDATE no action; | ||
EXCEPTION | ||
WHEN duplicate_object THEN null; | ||
END $$; | ||
--> statement-breakpoint | ||
DO $$ BEGIN | ||
ALTER TABLE "testimonies" ADD CONSTRAINT "testimonies_course_id_courses_id_fk" FOREIGN KEY ("course_id") REFERENCES "public"."courses"("id") ON DELETE cascade ON UPDATE no action; | ||
EXCEPTION | ||
WHEN duplicate_object THEN null; | ||
END $$; | ||
--> statement-breakpoint | ||
CREATE INDEX IF NOT EXISTS "testimonies_user_id_index" ON "testimonies" ("user_id");--> statement-breakpoint | ||
CREATE INDEX IF NOT EXISTS "testimonies_course_id_index" ON "testimonies" ("course_id"); |
Oops, something went wrong.