20 lines
575 B
SQL
20 lines
575 B
SQL
-- CreateTable
|
|
CREATE TABLE "ApiKey" (
|
|
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
"hashedKey" TEXT NOT NULL,
|
|
"id" TEXT NOT NULL,
|
|
"updatedAt" TIMESTAMP(3) NOT NULL,
|
|
"userId" TEXT NOT NULL,
|
|
|
|
CONSTRAINT "ApiKey_pkey" PRIMARY KEY ("id")
|
|
);
|
|
|
|
-- CreateIndex
|
|
CREATE INDEX "ApiKey_hashedKey_idx" ON "ApiKey"("hashedKey");
|
|
|
|
-- CreateIndex
|
|
CREATE INDEX "ApiKey_userId_idx" ON "ApiKey"("userId");
|
|
|
|
-- AddForeignKey
|
|
ALTER TABLE "ApiKey" ADD CONSTRAINT "ApiKey_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|