22 lines
810 B
SQL
22 lines
810 B
SQL
/*
|
|
Warnings:
|
|
|
|
- You are about to drop the column `username` on the `Session` table. All the data in the column will be lost.
|
|
- Added the required column `userId` to the `Session` table without a default value. This is not possible if the table is not empty.
|
|
|
|
*/
|
|
-- RedefineTables
|
|
PRAGMA defer_foreign_keys=ON;
|
|
PRAGMA foreign_keys=OFF;
|
|
CREATE TABLE "new_Session" (
|
|
"id" TEXT NOT NULL PRIMARY KEY,
|
|
"userId" TEXT NOT NULL,
|
|
"expiresAt" DATETIME NOT NULL,
|
|
CONSTRAINT "Session_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("username") ON DELETE CASCADE ON UPDATE CASCADE
|
|
);
|
|
INSERT INTO "new_Session" ("expiresAt", "id") SELECT "expiresAt", "id" FROM "Session";
|
|
DROP TABLE "Session";
|
|
ALTER TABLE "new_Session" RENAME TO "Session";
|
|
PRAGMA foreign_keys=ON;
|
|
PRAGMA defer_foreign_keys=OFF;
|