26 lines
865 B
MySQL
26 lines
865 B
MySQL
|
|
/*
|
||
|
|
Warnings:
|
||
|
|
|
||
|
|
- Added the required column `username` to the `user` 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_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
|
||
|
|
);
|
||
|
|
INSERT INTO "new_user" ("createdAt", "email", "emailVerified", "id", "image", "name", "updatedAt") SELECT "createdAt", "email", "emailVerified", "id", "image", "name", "updatedAt" FROM "user";
|
||
|
|
DROP TABLE "user";
|
||
|
|
ALTER TABLE "new_user" RENAME TO "user";
|
||
|
|
CREATE UNIQUE INDEX "user_email_key" ON "user"("email");
|
||
|
|
PRAGMA foreign_keys=ON;
|
||
|
|
PRAGMA defer_foreign_keys=OFF;
|