mirror of
https://github.com/lukevella/rallly.git
synced 2025-06-13 16:11:51 +02:00
Update house keeping tasks
This commit is contained in:
parent
d58ed5fddd
commit
d73a2f53ef
6 changed files with 63 additions and 69 deletions
|
@ -0,0 +1,14 @@
|
|||
-- CreateIndex
|
||||
CREATE INDEX "comments_poll_id_idx" ON "comments"("poll_id");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "options_poll_id_idx" ON "options"("poll_id");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "participants_poll_id_idx" ON "participants"("poll_id");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "polls_deleted_touched_at_idx" ON "polls"("deleted", "touched_at");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "votes_poll_id_idx" ON "votes"("poll_id");
|
|
@ -0,0 +1,32 @@
|
|||
-- DropIndex
|
||||
DROP INDEX "comments_poll_id_idx";
|
||||
|
||||
-- DropIndex
|
||||
DROP INDEX "options_poll_id_idx";
|
||||
|
||||
-- DropIndex
|
||||
DROP INDEX "participants_poll_id_idx";
|
||||
|
||||
-- DropIndex
|
||||
DROP INDEX "votes_poll_id_idx";
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "comments_poll_id_idx" ON "comments" USING HASH ("poll_id");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "options_poll_id_idx" ON "options" USING HASH ("poll_id");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "participants_poll_id_idx" ON "participants" USING HASH ("poll_id");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "votes_poll_id_idx" ON "votes" USING HASH ("poll_id");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "votes_participant_id_idx" ON "votes" USING HASH ("participant_id");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "votes_option_id_idx" ON "votes" USING HASH ("option_id");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "watchers_poll_id_idx" ON "watchers" USING HASH ("poll_id");
|
|
@ -0,0 +1,2 @@
|
|||
-- CreateIndex
|
||||
CREATE INDEX "polls_deleted_deleted_at_idx" ON "polls"("deleted", "deleted_at");
|
|
@ -146,6 +146,8 @@ model Poll {
|
|||
comments Comment[] @relation("PollToComments")
|
||||
votes Vote[] @relation("PollToVotes")
|
||||
|
||||
@@index([deleted, touchedAt])
|
||||
@@index([deleted, deletedAt])
|
||||
@@map("polls")
|
||||
}
|
||||
|
||||
|
@ -173,6 +175,7 @@ model Watcher {
|
|||
|
||||
poll Poll @relation("PollToWatchers", fields: [pollId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@index([pollId], type: Hash)
|
||||
@@map("watchers")
|
||||
}
|
||||
|
||||
|
@ -181,7 +184,6 @@ model Participant {
|
|||
name String
|
||||
email String?
|
||||
userId String? @map("user_id")
|
||||
poll Poll @relation("PollToParticipants", fields: [pollId], references: [id], onDelete: Cascade)
|
||||
pollId String @map("poll_id")
|
||||
locale String?
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
|
@ -190,7 +192,9 @@ model Participant {
|
|||
deletedAt DateTime? @map("deleted_at")
|
||||
|
||||
votes Vote[] @relation("ParticipantToVotes")
|
||||
poll Poll @relation("PollToParticipants", fields: [pollId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@index([pollId], type: Hash)
|
||||
@@map("participants")
|
||||
}
|
||||
|
||||
|
@ -202,6 +206,7 @@ model Option {
|
|||
poll Poll @relation("PollToOptions", fields: [pollId], references: [id], onDelete: Cascade)
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
|
||||
@@index([pollId], type: Hash)
|
||||
@@map("options")
|
||||
}
|
||||
|
||||
|
@ -225,6 +230,9 @@ model Vote {
|
|||
participant Participant @relation("ParticipantToVotes", fields: [participantId], references: [id], onDelete: Cascade)
|
||||
poll Poll @relation("PollToVotes", fields: [pollId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@index([pollId], type: Hash)
|
||||
@@index([participantId], type: Hash)
|
||||
@@index([optionId], type: Hash)
|
||||
@@map("votes")
|
||||
}
|
||||
|
||||
|
@ -240,6 +248,7 @@ model Comment {
|
|||
|
||||
poll Poll @relation("PollToComments", fields: [pollId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@index([pollId], type: Hash)
|
||||
@@map("comments")
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue