store requests

This commit is contained in:
Pablo Fernandez
2023-11-05 18:29:57 +09:00
parent d2cc06244e
commit 3d9aa4f459
3 changed files with 40 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
-- CreateTable
CREATE TABLE "Request" (
"id" TEXT NOT NULL PRIMARY KEY,
"keyName" TEXT NOT NULL,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"requestId" TEXT NOT NULL,
"remotePubkey" TEXT NOT NULL
);

View File

@@ -0,0 +1,22 @@
/*
Warnings:
- Added the required column `method` to the `Request` table without a default value. This is not possible if the table is not empty.
*/
-- RedefineTables
PRAGMA foreign_keys=OFF;
CREATE TABLE "new_Request" (
"id" TEXT NOT NULL PRIMARY KEY,
"keyName" TEXT NOT NULL,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"requestId" TEXT NOT NULL,
"remotePubkey" TEXT NOT NULL,
"method" TEXT NOT NULL,
"params" TEXT
);
INSERT INTO "new_Request" ("createdAt", "id", "keyName", "remotePubkey", "requestId") SELECT "createdAt", "id", "keyName", "remotePubkey", "requestId" FROM "Request";
DROP TABLE "Request";
ALTER TABLE "new_Request" RENAME TO "Request";
PRAGMA foreign_key_check;
PRAGMA foreign_keys=ON;

View File

@@ -7,6 +7,16 @@ datasource db {
url = "file:../config/nsecbunker.db"
}
model Request {
id String @id @default(uuid())
keyName String
createdAt DateTime @default(now())
requestId String
remotePubkey String
method String
params String?
}
model KeyUser {
id Int @id @default(autoincrement())
keyName String