36 lines
1.7 KiB
SQL
36 lines
1.7 KiB
SQL
/*
|
|
Warnings:
|
|
|
|
- The primary key for the `GitHubAuth` table will be changed. If it partially fails, the table could be left without primary key constraint.
|
|
- Added the required column `invalid` to the `DiscordAuth` table without a default value. This is not possible if the table is not empty.
|
|
- Added the required column `invalid` to the `GitHubAuth` table without a default value. This is not possible if the table is not empty.
|
|
|
|
*/
|
|
-- RedefineTables
|
|
PRAGMA foreign_keys=OFF;
|
|
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,
|
|
"invalid" BOOLEAN NOT NULL,
|
|
CONSTRAINT "DiscordAuth_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
|
|
);
|
|
INSERT INTO "new_DiscordAuth" ("accessToken", "expiresAt", "id", "refreshToken", "userId") SELECT "accessToken", "expiresAt", "id", "refreshToken", "userId" FROM "DiscordAuth";
|
|
DROP TABLE "DiscordAuth";
|
|
ALTER TABLE "new_DiscordAuth" RENAME TO "DiscordAuth";
|
|
CREATE UNIQUE INDEX "DiscordAuth_userId_key" ON "DiscordAuth"("userId");
|
|
CREATE TABLE "new_GitHubAuth" (
|
|
"id" TEXT NOT NULL PRIMARY KEY,
|
|
"userId" INTEGER NOT NULL,
|
|
"accessToken" TEXT NOT NULL,
|
|
"invalid" BOOLEAN NOT NULL,
|
|
CONSTRAINT "GitHubAuth_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
|
|
);
|
|
INSERT INTO "new_GitHubAuth" ("accessToken", "id", "userId") SELECT "accessToken", "id", "userId" FROM "GitHubAuth";
|
|
DROP TABLE "GitHubAuth";
|
|
ALTER TABLE "new_GitHubAuth" RENAME TO "GitHubAuth";
|
|
CREATE UNIQUE INDEX "GitHubAuth_userId_key" ON "GitHubAuth"("userId");
|
|
PRAGMA foreign_key_check;
|
|
PRAGMA foreign_keys=ON;
|