-- CreateTable
CREATE TABLE "Tooth" (
    "id" TEXT NOT NULL,
    "babyId" TEXT NOT NULL,
    "code" TEXT NOT NULL,
    "appearedAt" TIMESTAMP(3) NOT NULL,
    "notes" TEXT,
    "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updatedAt" TIMESTAMP(3) NOT NULL,

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

-- CreateIndex
CREATE UNIQUE INDEX "Tooth_babyId_code_key" ON "Tooth"("babyId", "code");

-- AddForeignKey
ALTER TABLE "Tooth" ADD CONSTRAINT "Tooth_babyId_fkey" FOREIGN KEY ("babyId") REFERENCES "Baby"("id") ON DELETE CASCADE ON UPDATE CASCADE;
