mirror of
https://github.com/stonith404/pingvin-share.git
synced 2024-11-15 20:00:33 +01:00
15 lines
652 B
MySQL
15 lines
652 B
MySQL
|
-- RedefineTables
|
||
|
PRAGMA foreign_keys=OFF;
|
||
|
CREATE TABLE "new_RefreshToken" (
|
||
|
"token" TEXT NOT NULL PRIMARY KEY,
|
||
|
"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";
|
||
|
PRAGMA foreign_key_check;
|
||
|
PRAGMA foreign_keys=ON;
|