mirror of
https://github.com/stonith404/pingvin-share.git
synced 2025-01-15 01:14:27 -05:00
23 lines
1.1 KiB
SQL
23 lines
1.1 KiB
SQL
/*
|
|
Warnings:
|
|
|
|
- The primary key for the `RefreshToken` table will be changed. If it partially fails, the table could be left without primary key constraint.
|
|
- The required column `id` was added to the `RefreshToken` table with a prisma-level default value. This is not possible if the table is not empty. Please add this column as optional, then populate it before making it required.
|
|
|
|
*/
|
|
-- RedefineTables
|
|
PRAGMA foreign_keys=OFF;
|
|
CREATE TABLE "new_RefreshToken" (
|
|
"id" TEXT NOT NULL PRIMARY KEY,
|
|
"token" TEXT NOT NULL,
|
|
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
"expiresAt" DATETIME NOT NULL,
|
|
"userId" TEXT NOT NULL,
|
|
CONSTRAINT "RefreshToken_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE CASCADE ON UPDATE CASCADE
|
|
);
|
|
INSERT INTO "new_RefreshToken" ("createdAt", "expiresAt", "token", "userId") SELECT "createdAt", "expiresAt", "token", "userId" FROM "RefreshToken";
|
|
DROP TABLE "RefreshToken";
|
|
ALTER TABLE "new_RefreshToken" RENAME TO "RefreshToken";
|
|
CREATE UNIQUE INDEX "RefreshToken_token_key" ON "RefreshToken"("token");
|
|
PRAGMA foreign_key_check;
|
|
PRAGMA foreign_keys=ON;
|