-- CreateTable
CREATE TABLE "AuthTicket" (
    "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
    "username" TEXT,
    "ticket" TEXT NOT NULL
);

-- CreateTable
CREATE TABLE "DiscordAuth" (
    "id" TEXT NOT NULL PRIMARY KEY,
    "authTicketId" INTEGER NOT NULL,
    "accessToken" TEXT NOT NULL,
    "refreshToken" TEXT NOT NULL,
    "refreshAt" DATETIME NOT NULL,
    CONSTRAINT "DiscordAuth_authTicketId_fkey" FOREIGN KEY ("authTicketId") REFERENCES "AuthTicket" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
);

-- CreateIndex
CREATE UNIQUE INDEX "DiscordAuth_authTicketId_key" ON "DiscordAuth"("authTicketId");
