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

Loading…
Cancel
Save