-- RedefineTables
PRAGMA defer_foreign_keys=ON;
PRAGMA foreign_keys=OFF;
CREATE TABLE "new_User" (
    "id" TEXT NOT NULL PRIMARY KEY,
    "email" TEXT NOT NULL,
    "passwordHash" TEXT NOT NULL,
    "nom" TEXT NOT NULL,
    "prenom" TEXT,
    "telephone" TEXT,
    "fonction" TEXT,
    "notes" TEXT,
    "role" TEXT NOT NULL,
    "actif" BOOLEAN NOT NULL DEFAULT true,
    "doitChangerMdp" BOOLEAN NOT NULL DEFAULT false,
    "horaires" TEXT,
    "heuresHebdo" REAL,
    "createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updatedAt" DATETIME NOT NULL
);
INSERT INTO "new_User" ("actif", "createdAt", "email", "fonction", "heuresHebdo", "horaires", "id", "nom", "notes", "passwordHash", "prenom", "role", "telephone", "updatedAt") SELECT "actif", "createdAt", "email", "fonction", "heuresHebdo", "horaires", "id", "nom", "notes", "passwordHash", "prenom", "role", "telephone", "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;
