WIP handle unique constraint exception

This commit is contained in:
sbriat
2023-07-04 12:16:34 +02:00
parent 0162066557
commit f33f679e12
29 changed files with 1608 additions and 7657 deletions

View File

@@ -14,7 +14,7 @@ CREATE TABLE "auth" (
-- CreateTable
CREATE TABLE "username" (
"username" TEXT NOT NULL,
"uuid" UUID NOT NULL,
"authUuid" UUID NOT NULL,
"type" "Type" NOT NULL DEFAULT 'EMAIL',
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
@@ -23,4 +23,7 @@ CREATE TABLE "username" (
);
-- CreateIndex
CREATE UNIQUE INDEX "username_uuid_type_key" ON "username"("uuid", "type");
CREATE UNIQUE INDEX "username_authUuid_type_key" ON "username"("authUuid", "type");
-- AddForeignKey
ALTER TABLE "username" ADD CONSTRAINT "username_authUuid_fkey" FOREIGN KEY ("authUuid") REFERENCES "auth"("uuid") ON DELETE CASCADE ON UPDATE CASCADE;