-- CreateTable
CREATE TABLE "binom_v2_user" (
    "id" SERIAL NOT NULL,
    "externalId" TEXT NOT NULL,
    "name" TEXT NOT NULL,
    "userId" INTEGER,
    "binomV2AccountId" INTEGER NOT NULL,

    CONSTRAINT "binom_v2_user_pkey" PRIMARY KEY ("id")
);

-- AddForeignKey
ALTER TABLE "binom_v2_user" ADD CONSTRAINT "binom_v2_user_userId_fkey" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE SET NULL ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "binom_v2_user" ADD CONSTRAINT "binom_v2_user_binomV2AccountId_fkey" FOREIGN KEY ("binomV2AccountId") REFERENCES "binom_v2_account"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
