-- RedefineTables
PRAGMA defer_foreign_keys=ON;
PRAGMA foreign_keys=OFF;
CREATE TABLE "new_User" (
    "id" TEXT NOT NULL PRIMARY KEY,
    "email" TEXT NOT NULL,
    "name" TEXT,
    "image" TEXT,
    "emailVerified" DATETIME,
    "slackUserId" TEXT,
    "role" TEXT NOT NULL DEFAULT 'USER',
    "isActive" BOOLEAN NOT NULL DEFAULT true,
    "systemPromptAddition" TEXT,
    "githubToken" TEXT,
    "createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updatedAt" DATETIME NOT NULL,
    "lastActiveAt" DATETIME
);
INSERT INTO "new_User" ("createdAt", "email", "githubToken", "id", "isActive", "lastActiveAt", "name", "role", "slackUserId", "systemPromptAddition", "updatedAt") SELECT "createdAt", "email", "githubToken", "id", "isActive", "lastActiveAt", "name", "role", "slackUserId", "systemPromptAddition", "updatedAt" FROM "User";
DROP TABLE "User";
ALTER TABLE "new_User" RENAME TO "User";
CREATE UNIQUE INDEX "User_email_key" ON "User"("email");
CREATE UNIQUE INDEX "User_slackUserId_key" ON "User"("slackUserId");
PRAGMA foreign_keys=ON;
PRAGMA defer_foreign_keys=OFF;
