-- CreateEnum
CREATE TYPE "DocumentType" AS ENUM ('PASSPORT_WITH_PERSON', 'PASSPORT_IMAGE', 'NDA', 'RESIDENCE', 'DEBIT_CARD');

-- CreateTable
CREATE TABLE "document" (
    "id" SERIAL NOT NULL,
    "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updateDate" TIMESTAMP(3) NOT NULL,
    "type" "DocumentType" NOT NULL,
    "url" TEXT,
    "name" TEXT NOT NULL,
    "userId" INTEGER NOT NULL,

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

-- CreateIndex
CREATE UNIQUE INDEX "document_name_key" ON "document"("name");

-- AddForeignKey
ALTER TABLE "document" ADD CONSTRAINT "document_userId_fkey" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
