/* Warnings: - You are about to drop the column `twoFactorBackupCodes` on the `user` table. All the data in the column will be lost. - You are about to drop the column `twoFactorSecret` on the `user` table. All the data in the column will be lost. */ -- CreateTable CREATE TABLE "twoFactor" ( "id" TEXT NOT NULL PRIMARY KEY, "secret" TEXT NOT NULL, "backupCodes" TEXT NOT NULL, "userId" TEXT NOT NULL, CONSTRAINT "twoFactor_userId_fkey" FOREIGN KEY ("userId") REFERENCES "user" ("id") ON DELETE CASCADE ON UPDATE CASCADE ); -- RedefineTables PRAGMA defer_foreign_keys=ON; PRAGMA foreign_keys=OFF; CREATE TABLE "new_user" ( "id" TEXT NOT NULL PRIMARY KEY, "name" TEXT NOT NULL, "username" TEXT NOT NULL, "email" TEXT NOT NULL, "emailVerified" BOOLEAN NOT NULL, "image" TEXT, "createdAt" DATETIME NOT NULL, "updatedAt" DATETIME NOT NULL, "displayUsername" TEXT, "role" TEXT DEFAULT 'user', "banned" BOOLEAN DEFAULT false, "banReason" TEXT, "banExpires" DATETIME, "inviteCodeUsed" TEXT, "twoFactorEnabled" BOOLEAN DEFAULT false ); INSERT INTO "new_user" ("banExpires", "banReason", "banned", "createdAt", "displayUsername", "email", "emailVerified", "id", "image", "inviteCodeUsed", "name", "role", "twoFactorEnabled", "updatedAt", "username") SELECT "banExpires", "banReason", "banned", "createdAt", "displayUsername", "email", "emailVerified", "id", "image", "inviteCodeUsed", "name", "role", "twoFactorEnabled", "updatedAt", "username" FROM "user"; DROP TABLE "user"; ALTER TABLE "new_user" RENAME TO "user"; CREATE UNIQUE INDEX "user_username_key" ON "user"("username"); CREATE UNIQUE INDEX "user_email_key" ON "user"("email"); PRAGMA foreign_keys=ON; PRAGMA defer_foreign_keys=OFF;