Policies and single-use tokens
This commit is contained in:
parent
28f4788aec
commit
c43f1cc95e
15 changed files with 402 additions and 91 deletions
19
prisma/migrations/20230603134135_tokens/migration.sql
Normal file
19
prisma/migrations/20230603134135_tokens/migration.sql
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
-- CreateTable
|
||||
CREATE TABLE "Token" (
|
||||
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||
"token" TEXT NOT NULL,
|
||||
"clientName" TEXT NOT NULL,
|
||||
"createdBy" TEXT NOT NULL,
|
||||
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updatedAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"deletedAt" DATETIME,
|
||||
"expiresAt" DATETIME,
|
||||
"redeemedAt" DATETIME,
|
||||
"keyUserId" INTEGER,
|
||||
"policyId" INTEGER,
|
||||
CONSTRAINT "Token_keyUserId_fkey" FOREIGN KEY ("keyUserId") REFERENCES "KeyUser" ("id") ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
CONSTRAINT "Token_policyId_fkey" FOREIGN KEY ("policyId") REFERENCES "Policy" ("id") ON DELETE SET NULL ON UPDATE CASCADE
|
||||
);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "Token_token_key" ON "Token"("token");
|
||||
Loading…
Add table
Add a link
Reference in a new issue