phosphat-report-app/prisma/migrations/20250723204123_add_email_to_employeenpx/migration.sql
2025-07-24 12:39:15 +03:00

25 lines
876 B
SQL

/*
Warnings:
- Added the required column `email` to the `Employee` 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_Employee" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"name" TEXT NOT NULL,
"authLevel" INTEGER NOT NULL,
"username" TEXT NOT NULL,
"email" TEXT NOT NULL,
"password" TEXT NOT NULL
);
INSERT INTO "new_Employee" ("authLevel", "id", "name", "password", "username") SELECT "authLevel", "id", "name", "password", "username" FROM "Employee";
DROP TABLE "Employee";
ALTER TABLE "new_Employee" RENAME TO "Employee";
CREATE UNIQUE INDEX "Employee_username_key" ON "Employee"("username");
CREATE UNIQUE INDEX "Employee_email_key" ON "Employee"("email");
PRAGMA foreign_keys=ON;
PRAGMA defer_foreign_keys=OFF;