1
0
Fork 0
gluestick/prisma/migrations/20230425231459_redo_ticket_.../migration.sql

46 lines
2.2 KiB
SQL

/*
Warnings:
- You are about to drop the column `username` on the `AuthTicket` table. All the data in the column will be lost.
- You are about to drop the column `authTicketId` on the `DiscordAuth` table. All the data in the column will be lost.
- You are about to drop the column `refreshAt` on the `DiscordAuth` table. All the data in the column will be lost.
- Added the required column `expiresAt` to the `AuthTicket` table without a default value. This is not possible if the table is not empty.
- Added the required column `userId` to the `AuthTicket` table without a default value. This is not possible if the table is not empty.
- Added the required column `expiresAt` to the `DiscordAuth` table without a default value. This is not possible if the table is not empty.
- Added the required column `userId` to the `DiscordAuth` table without a default value. This is not possible if the table is not empty.
*/
-- CreateTable
CREATE TABLE "User" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"username" TEXT
);
-- RedefineTables
PRAGMA foreign_keys=OFF;
CREATE TABLE "new_AuthTicket" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"ticket" TEXT NOT NULL,
"expiresAt" DATETIME NOT NULL,
"userId" INTEGER NOT NULL,
CONSTRAINT "AuthTicket_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
);
INSERT INTO "new_AuthTicket" ("id", "ticket") SELECT "id", "ticket" FROM "AuthTicket";
DROP TABLE "AuthTicket";
ALTER TABLE "new_AuthTicket" RENAME TO "AuthTicket";
CREATE UNIQUE INDEX "AuthTicket_userId_key" ON "AuthTicket"("userId");
CREATE TABLE "new_DiscordAuth" (
"id" TEXT NOT NULL PRIMARY KEY,
"userId" INTEGER NOT NULL,
"accessToken" TEXT NOT NULL,
"refreshToken" TEXT NOT NULL,
"expiresAt" DATETIME NOT NULL,
CONSTRAINT "DiscordAuth_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
);
INSERT INTO "new_DiscordAuth" ("accessToken", "id", "refreshToken") SELECT "accessToken", "id", "refreshToken" FROM "DiscordAuth";
DROP TABLE "DiscordAuth";
ALTER TABLE "new_DiscordAuth" RENAME TO "DiscordAuth";
CREATE UNIQUE INDEX "DiscordAuth_userId_key" ON "DiscordAuth"("userId");
PRAGMA foreign_key_check;
PRAGMA foreign_keys=ON;