add index to created_at columns

This commit is contained in:
keyan 2021-10-06 07:43:32 -07:00
parent 61be400365
commit 4d1b8bb11e
2 changed files with 23 additions and 1 deletions

View File

@ -0,0 +1,17 @@
-- CreateIndex
CREATE INDEX "Invoice.created_at_index" ON "Invoice"("created_at");
-- CreateIndex
CREATE INDEX "Item.created_at_index" ON "Item"("created_at");
-- CreateIndex
CREATE INDEX "ItemAct.created_at_index" ON "ItemAct"("created_at");
-- CreateIndex
CREATE INDEX "Mention.created_at_index" ON "Mention"("created_at");
-- CreateIndex
CREATE INDEX "Withdrawl.created_at_index" ON "Withdrawl"("created_at");
-- CreateIndex
CREATE INDEX "users.created_at_index" ON "users"("created_at");

View File

@ -33,6 +33,7 @@ model User {
tipDefault Int @default(0)
pubkey String? @unique
@@index([createdAt])
@@map(name: "users")
}
@ -68,6 +69,7 @@ model Item {
path Unsupported("LTREE")?
User User[] @relation("Item")
@@index([createdAt])
@@index([userId])
@@index([parentId])
}
@ -92,6 +94,7 @@ model ItemAct {
@@index([itemId])
@@index([userId])
@@index([act])
@@index([createdAt])
}
model Mention {
@ -104,6 +107,7 @@ model Mention {
userId Int
@@unique([itemId, userId])
@@index([createdAt])
@@index([itemId])
@@index([userId])
}
@ -123,6 +127,7 @@ model Invoice {
msatsReceived Int?
cancelled Boolean @default(false)
@@index([createdAt])
@@index([userId])
}
@ -150,7 +155,7 @@ model Withdrawl {
msatsFeePaid Int?
status WithdrawlStatus?
@@index([createdAt])
@@index([userId])
}