Skip to content

Commit

Permalink
Add indexes to help db query amounts
Browse files Browse the repository at this point in the history
  • Loading branch information
t3dotgg committed Dec 21, 2021
1 parent 827d894 commit 3c22f6e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions prisma/migrations/20211221040220_add_indexes/migration.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
-- CreateIndex
CREATE INDEX `Vote_votedForId_idx` ON `Vote`(`votedForId`);

-- CreateIndex
CREATE INDEX `Vote_votedAgainstId_idx` ON `Vote`(`votedAgainstId`);
3 changes: 3 additions & 0 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ model Vote {
votedForId Int
votedAgainst Pokemon @relation(name: "votesAgainst", fields: [votedAgainstId], references: [id])
votedAgainstId Int
@@index([votedForId])
@@index([votedAgainstId])
}

model Pokemon {
Expand Down

0 comments on commit 3c22f6e

Please sign in to comment.