some api routes

This commit is contained in:
jane 2022-04-10 14:26:47 -04:00
parent 6591e0987f
commit 6e58f59274
39 changed files with 324 additions and 21 deletions

View file

@ -0,0 +1,68 @@
-- 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,
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,
CONSTRAINT "Session_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE CASCADE ON UPDATE CASCADE
);
-- CreateTable
CREATE TABLE "User" (
"id" TEXT NOT NULL PRIMARY KEY,
"name" TEXT,
"email" TEXT,
"emailVerified" DATETIME,
"image" TEXT
);
-- CreateTable
CREATE TABLE "VerificationToken" (
"identifier" TEXT NOT NULL,
"token" TEXT NOT NULL,
"expires" DATETIME NOT NULL
);
-- CreateTable
CREATE TABLE "ApplicationUserData" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"discordId" TEXT NOT NULL,
"borderUrl" TEXT,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" DATETIME NOT NULL
);
-- 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 "User_email_key" ON "User"("email");
-- CreateIndex
CREATE UNIQUE INDEX "VerificationToken_token_key" ON "VerificationToken"("token");
-- CreateIndex
CREATE UNIQUE INDEX "VerificationToken_identifier_token_key" ON "VerificationToken"("identifier", "token");
-- CreateIndex
CREATE UNIQUE INDEX "ApplicationUserData_discordId_key" ON "ApplicationUserData"("discordId");

View file

@ -0,0 +1,22 @@
/*
Warnings:
- You are about to drop the column `discordId` on the `ApplicationUserData` table. All the data in the column will be lost.
- Added the required column `userId` to the `ApplicationUserData` table without a default value. This is not possible if the table is not empty.
*/
-- RedefineTables
PRAGMA foreign_keys=OFF;
CREATE TABLE "new_ApplicationUserData" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"userId" TEXT NOT NULL,
"borderUrl" TEXT,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" DATETIME NOT NULL
);
INSERT INTO "new_ApplicationUserData" ("borderUrl", "createdAt", "id", "updatedAt") SELECT "borderUrl", "createdAt", "id", "updatedAt" FROM "ApplicationUserData";
DROP TABLE "ApplicationUserData";
ALTER TABLE "new_ApplicationUserData" RENAME TO "ApplicationUserData";
CREATE UNIQUE INDEX "ApplicationUserData_userId_key" ON "ApplicationUserData"("userId");
PRAGMA foreign_key_check;
PRAGMA foreign_keys=ON;

View file

@ -0,0 +1,23 @@
/*
Warnings:
- Added the required column `discordId` to the `ApplicationUserData` table without a default value. This is not possible if the table is not empty.
*/
-- RedefineTables
PRAGMA foreign_keys=OFF;
CREATE TABLE "new_ApplicationUserData" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"userId" TEXT NOT NULL,
"discordId" TEXT NOT NULL,
"borderUrl" TEXT,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" DATETIME NOT NULL
);
INSERT INTO "new_ApplicationUserData" ("borderUrl", "createdAt", "id", "updatedAt", "userId") SELECT "borderUrl", "createdAt", "id", "updatedAt", "userId" FROM "ApplicationUserData";
DROP TABLE "ApplicationUserData";
ALTER TABLE "new_ApplicationUserData" RENAME TO "ApplicationUserData";
CREATE UNIQUE INDEX "ApplicationUserData_userId_key" ON "ApplicationUserData"("userId");
CREATE UNIQUE INDEX "ApplicationUserData_discordId_key" ON "ApplicationUserData"("discordId");
PRAGMA foreign_key_check;
PRAGMA foreign_keys=ON;

View file

@ -0,0 +1,3 @@
# Please do not edit this file manually
# It should be added in your version-control system (i.e. Git)
provider = "sqlite"