[questions][feat] update vote enum

pull/323/head
hpkoh 3 years ago
parent a43e6455d6
commit caec7b57bc

@ -0,0 +1,30 @@
/*
Warnings:
- Changed the type of `vote` on the `QuestionsAnswerCommentVote` table. No cast exists, the column would be dropped and recreated, which cannot be done if there is data, since the column is required.
- Changed the type of `vote` on the `QuestionsAnswerVote` table. No cast exists, the column would be dropped and recreated, which cannot be done if there is data, since the column is required.
- Changed the type of `vote` on the `QuestionsQuestionCommentVote` table. No cast exists, the column would be dropped and recreated, which cannot be done if there is data, since the column is required.
- Changed the type of `vote` on the `QuestionsQuestionVote` table. No cast exists, the column would be dropped and recreated, which cannot be done if there is data, since the column is required.
*/
-- CreateEnum
CREATE TYPE "Vote" AS ENUM ('UPVOTE', 'DOWNVOTE');
-- AlterTable
ALTER TABLE "QuestionsAnswerCommentVote" DROP COLUMN "vote",
ADD COLUMN "vote" "Vote" NOT NULL;
-- AlterTable
ALTER TABLE "QuestionsAnswerVote" DROP COLUMN "vote",
ADD COLUMN "vote" "Vote" NOT NULL;
-- AlterTable
ALTER TABLE "QuestionsQuestionCommentVote" DROP COLUMN "vote",
ADD COLUMN "vote" "Vote" NOT NULL;
-- AlterTable
ALTER TABLE "QuestionsQuestionVote" DROP COLUMN "vote",
ADD COLUMN "vote" "Vote" NOT NULL;
-- DropEnum
DROP TYPE "QuestionsVote";

@ -60,6 +60,11 @@ model User {
questionsAnswerCommentVotes QuestionsAnswerCommentVote[]
}
enum Vote {
UPVOTE
DOWNVOTE
}
model VerificationToken {
identifier String
token String @unique
@ -172,12 +177,6 @@ model ResumesCommentVote {
// use camelCase for field names, and try to name them consistently
// across all models in this file.
enum QuestionsVote {
NO_VOTE
UPVOTE
DOWNVOTE
}
enum QuestionsQuestionType {
CODING
SYSTEM_DESIGN
@ -215,12 +214,12 @@ model QuestionsQuestionEncounter {
}
model QuestionsQuestionVote {
id String @id @default(cuid())
id String @id @default(cuid())
questionId String
userId String?
vote QuestionsVote
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
vote Vote
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
user User? @relation(fields: [userId], references: [id], onDelete: SetNull)
question QuestionsQuestion @relation(fields: [questionId], references: [id], onDelete: Cascade)
@ -242,12 +241,12 @@ model QuestionsQuestionComment {
}
model QuestionsQuestionCommentVote {
id String @id @default(cuid())
id String @id @default(cuid())
questionCommentId String
userId String?
vote QuestionsVote
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
vote Vote
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
user User? @relation(fields: [userId], references: [id], onDelete: SetNull)
comment QuestionsQuestionComment @relation(fields: [questionCommentId], references: [id], onDelete: Cascade)
@ -270,12 +269,12 @@ model QuestionsAnswer {
}
model QuestionsAnswerVote {
id String @id @default(cuid())
id String @id @default(cuid())
answerId String
userId String?
vote QuestionsVote
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
vote Vote
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
user User? @relation(fields: [userId], references: [id], onDelete: SetNull)
answer QuestionsAnswer @relation(fields: [answerId], references: [id], onDelete: Cascade)
@ -297,12 +296,12 @@ model QuestionsAnswerComment {
}
model QuestionsAnswerCommentVote {
id String @id @default(cuid())
id String @id @default(cuid())
answerCommentId String
userId String?
vote QuestionsVote
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
vote Vote
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
user User? @relation(fields: [userId], references: [id], onDelete: SetNull)
comment QuestionsAnswerComment @relation(fields: [answerCommentId], references: [id], onDelete: Cascade)

Loading…
Cancel
Save