GHOSCHT
b4503db688
preparation for access_token refresh, since JWT cookies cannot be refreshed from the server side
77 lines
2.3 KiB
SQL
77 lines
2.3 KiB
SQL
-- CreateTable
|
|
CREATE TABLE "User" (
|
|
"id" TEXT NOT NULL PRIMARY KEY,
|
|
"name" TEXT,
|
|
"email" TEXT,
|
|
"emailVerified" DATETIME,
|
|
"image" TEXT,
|
|
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
"updatedAt" DATETIME NOT NULL
|
|
);
|
|
|
|
-- CreateTable
|
|
CREATE TABLE "Account" (
|
|
"id" TEXT NOT NULL PRIMARY KEY,
|
|
"userId" TEXT NOT NULL,
|
|
"type" TEXT NOT NULL,
|
|
"provider" TEXT NOT NULL,
|
|
"providerAccountId" TEXT NOT NULL,
|
|
"refresh_token" TEXT,
|
|
"access_token" TEXT,
|
|
"expires_at" INTEGER,
|
|
"token_type" TEXT,
|
|
"scope" TEXT,
|
|
"id_token" TEXT,
|
|
"session_state" TEXT,
|
|
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
"updatedAt" DATETIME NOT NULL,
|
|
CONSTRAINT "Account_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE CASCADE ON UPDATE CASCADE
|
|
);
|
|
|
|
-- CreateTable
|
|
CREATE TABLE "Session" (
|
|
"id" TEXT NOT NULL PRIMARY KEY,
|
|
"sessionToken" TEXT NOT NULL,
|
|
"userId" TEXT NOT NULL,
|
|
"expires" DATETIME NOT NULL,
|
|
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
"updatedAt" DATETIME NOT NULL,
|
|
CONSTRAINT "Session_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE CASCADE ON UPDATE CASCADE
|
|
);
|
|
|
|
-- CreateTable
|
|
CREATE TABLE "VerificationToken" (
|
|
"identifier" TEXT NOT NULL,
|
|
"token" TEXT NOT NULL,
|
|
"expires" DATETIME NOT NULL
|
|
);
|
|
|
|
-- CreateTable
|
|
CREATE TABLE "Authenticator" (
|
|
"credentialID" TEXT NOT NULL,
|
|
"userId" TEXT NOT NULL,
|
|
"providerAccountId" TEXT NOT NULL,
|
|
"credentialPublicKey" TEXT NOT NULL,
|
|
"counter" INTEGER NOT NULL,
|
|
"credentialDeviceType" TEXT NOT NULL,
|
|
"credentialBackedUp" BOOLEAN NOT NULL,
|
|
"transports" TEXT,
|
|
|
|
PRIMARY KEY ("userId", "credentialID"),
|
|
CONSTRAINT "Authenticator_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE CASCADE ON UPDATE CASCADE
|
|
);
|
|
|
|
-- CreateIndex
|
|
CREATE UNIQUE INDEX "User_email_key" ON "User"("email");
|
|
|
|
-- CreateIndex
|
|
CREATE UNIQUE INDEX "Account_provider_providerAccountId_key" ON "Account"("provider", "providerAccountId");
|
|
|
|
-- CreateIndex
|
|
CREATE UNIQUE INDEX "Session_sessionToken_key" ON "Session"("sessionToken");
|
|
|
|
-- CreateIndex
|
|
CREATE UNIQUE INDEX "VerificationToken_identifier_token_key" ON "VerificationToken"("identifier", "token");
|
|
|
|
-- CreateIndex
|
|
CREATE UNIQUE INDEX "Authenticator_credentialID_key" ON "Authenticator"("credentialID");
|