completed migrate to prisma-rust-client

This commit is contained in:
Ren Amamiya
2023-04-05 09:20:33 +07:00
parent 3f87d510ab
commit fc8dc8fd0d
25 changed files with 342 additions and 213 deletions

View File

@@ -27,7 +27,7 @@ CREATE TABLE "Note" (
"content" TEXT NOT NULL,
"parent_id" TEXT NOT NULL,
"parent_comment_id" TEXT NOT NULL,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"createdAt" INTEGER NOT NULL,
"accountId" INTEGER NOT NULL,
CONSTRAINT "Note_accountId_fkey" FOREIGN KEY ("accountId") REFERENCES "Account" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
);
@@ -38,7 +38,7 @@ CREATE TABLE "Message" (
"pubkey" TEXT NOT NULL,
"content" TEXT NOT NULL,
"tags" TEXT NOT NULL,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"createdAt" INTEGER NOT NULL,
"accountId" INTEGER NOT NULL,
CONSTRAINT "Message_accountId_fkey" FOREIGN KEY ("accountId") REFERENCES "Account" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
);

View File

@@ -0,0 +1,11 @@
-- DropIndex
DROP INDEX "Message_pubkey_idx";
-- DropIndex
DROP INDEX "Note_eventId_idx";
-- CreateIndex
CREATE INDEX "Message_pubkey_createdAt_idx" ON "Message"("pubkey", "createdAt");
-- CreateIndex
CREATE INDEX "Note_eventId_createdAt_idx" ON "Note"("eventId", "createdAt");

View File

@@ -36,33 +36,33 @@ model Follow {
}
model Note {
id Int @id @default(autoincrement())
eventId String @unique
id Int @id @default(autoincrement())
eventId String @unique
pubkey String
kind Int
tags String
content String
parent_id String
parent_comment_id String
createdAt DateTime @default(now())
createdAt Int
Account Account @relation(fields: [accountId], references: [id])
accountId Int
@@index([eventId])
@@index([eventId, createdAt])
}
model Message {
id Int @id @default(autoincrement())
id Int @id @default(autoincrement())
pubkey String
content String
tags String
createdAt DateTime @default(now())
createdAt Int
Account Account @relation(fields: [accountId], references: [id])
accountId Int
@@index([pubkey])
@@index([pubkey, createdAt])
}
model Relay {