15 lines
449 B
MySQL
Raw Normal View History

-- CreateTable
CREATE TABLE "Device" (
"id" TEXT NOT NULL,
"name" TEXT NOT NULL,
"mac" TEXT NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
"userId" TEXT,
CONSTRAINT "Device_pkey" PRIMARY KEY ("id")
);
-- AddForeignKey
ALTER TABLE "Device" ADD CONSTRAINT "Device_userId_fkey" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE SET NULL ON UPDATE CASCADE;