-- AlterTable ALTER TABLE "agents" ADD COLUMN "userId" TEXT; -- AlterTable ALTER TABLE "users" ADD COLUMN "active" BOOLEAN NOT NULL DEFAULT true, ADD COLUMN "passwordHash" TEXT NOT NULL DEFAULT ''; -- The default above exists only to satisfy the NOT NULL constraint against this (empty) -- table at migration time — application code always provides a real bcryptjs hash on every -- User row it creates (specs/010-identity-auth/data-model.md), so the default itself is -- dropped immediately below to keep schema.prisma and the live database in agreement (no -- default declared in the Prisma schema). ALTER TABLE "users" ALTER COLUMN "passwordHash" DROP DEFAULT; -- CreateIndex CREATE UNIQUE INDEX "agents_userId_key" ON "agents"("userId"); -- AddForeignKey ALTER TABLE "agents" ADD CONSTRAINT "agents_userId_fkey" FOREIGN KEY ("userId") REFERENCES "users"("id") ON DELETE SET NULL ON UPDATE CASCADE;