-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create ExerciseComment database table #2404
Merged
Merged
Changes from 6 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
d7d2f5e
create discussions table in prisma
HS-90 488fe1a
Merge branch 'master' into discussions-backend
flacial f5a3e8f
Merge branch 'master' into discussions-backend
flacial ebf3d8c
Merge branch 'garageScript:master' into discussions-backend
HS-90 9c43845
Merge branch 'garageScript:master' into discussions-backend
HS-90 b15b3c8
revision to Discussions table after team meeting
HS-90 fbb00cd
Merge branch 'master' into discussions-backend
HS-90 76e3554
change ExerciseComments to ExerciseComment
HS-90 0955ccc
Merge branch 'master' into discussions-backend
HS-90 e660fab
Merge branch 'master' into discussions-backend
HS-90 9bacfc3
Merge branch 'master' into discussions-backend
HS-90 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
prisma/migrations/20221006161259_create_discussions_table/migration.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,22 @@ | ||
-- CreateTable | ||
CREATE TABLE "Discussion" ( | ||
"id" SERIAL NOT NULL, | ||
"createdAt" TIMESTAMPTZ(6) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"updatedAt" TIMESTAMPTZ(6) NOT NULL, | ||
"authorId" INTEGER NOT NULL, | ||
"exerciseId" INTEGER NOT NULL, | ||
"userPic" TEXT NOT NULL, | ||
"content" TEXT NOT NULL, | ||
"parentId" INTEGER, | ||
|
||
CONSTRAINT "Discussion_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "Discussion" ADD CONSTRAINT "Discussion_authorId_fkey" FOREIGN KEY ("authorId") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "Discussion" ADD CONSTRAINT "Discussion_exerciseId_fkey" FOREIGN KEY ("exerciseId") REFERENCES "exercises"("id") ON DELETE CASCADE ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "Discussion" ADD CONSTRAINT "Discussion_parentId_fkey" FOREIGN KEY ("parentId") REFERENCES "Discussion"("id") ON DELETE SET NULL ON UPDATE CASCADE; |
2 changes: 2 additions & 0 deletions
2
prisma/migrations/20221006161545_create_discussions_table2/migration.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 @@ | ||
-- AlterTable | ||
ALTER TABLE "Discussion" ALTER COLUMN "userPic" DROP NOT NULL; | ||
5 changes: 5 additions & 0 deletions
5
prisma/migrations/20221006163340_create_discussions_table3/migration.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,5 @@ | ||
-- DropForeignKey | ||
ALTER TABLE "Discussion" DROP CONSTRAINT "Discussion_authorId_fkey"; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "Discussion" ADD CONSTRAINT "Discussion_authorId_fkey" FOREIGN KEY ("authorId") REFERENCES "users"("id") ON DELETE SET NULL ON UPDATE CASCADE; | ||
flacial marked this conversation as resolved.
Show resolved
Hide resolved
|
40 changes: 40 additions & 0 deletions
40
prisma/migrations/20221014185321_exercise_comments/migration.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,40 @@ | ||
/* | ||
Warnings: | ||
|
||
- You are about to drop the `Discussion` table. If the table is not empty, all the data it contains will be lost. | ||
|
||
*/ | ||
-- DropForeignKey | ||
ALTER TABLE "Discussion" DROP CONSTRAINT "Discussion_authorId_fkey"; | ||
|
||
-- DropForeignKey | ||
ALTER TABLE "Discussion" DROP CONSTRAINT "Discussion_exerciseId_fkey"; | ||
|
||
-- DropForeignKey | ||
ALTER TABLE "Discussion" DROP CONSTRAINT "Discussion_parentId_fkey"; | ||
|
||
-- DropTable | ||
DROP TABLE "Discussion"; | ||
|
||
-- CreateTable | ||
CREATE TABLE "ExerciseComments" ( | ||
"id" SERIAL NOT NULL, | ||
"createdAt" TIMESTAMPTZ(6) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"updatedAt" TIMESTAMPTZ(6) NOT NULL, | ||
"authorId" INTEGER NOT NULL, | ||
"exerciseId" INTEGER NOT NULL, | ||
"userPic" TEXT, | ||
"content" TEXT NOT NULL, | ||
"parentId" INTEGER, | ||
|
||
CONSTRAINT "ExerciseComments_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "ExerciseComments" ADD CONSTRAINT "ExerciseComments_authorId_fkey" FOREIGN KEY ("authorId") REFERENCES "users"("id") ON DELETE SET NULL ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "ExerciseComments" ADD CONSTRAINT "ExerciseComments_exerciseId_fkey" FOREIGN KEY ("exerciseId") REFERENCES "exercises"("id") ON DELETE CASCADE ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "ExerciseComments" ADD CONSTRAINT "ExerciseComments_parentId_fkey" FOREIGN KEY ("parentId") REFERENCES "ExerciseComments"("id") ON DELETE SET NULL ON UPDATE CASCADE; |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Setting userPic to not null, since not every user may have uploaded a profile picture