cal.pub0.org/packages/prisma/migrations/20220502154345_adds_apps/migration.sql

27 lines
794 B
MySQL
Raw Normal View History

-- CreateEnum
CREATE TYPE "AppCategories" AS ENUM ('calendar', 'messaging', 'other', 'payment', 'video', 'web3');
-- AlterTable
ALTER TABLE "Credential" ADD COLUMN "appId" TEXT;
-- CreateTable
CREATE TABLE "App" (
"slug" TEXT NOT NULL,
"dirName" TEXT NOT NULL,
"keys" JSONB,
"categories" "AppCategories"[],
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "App_pkey" PRIMARY KEY ("slug")
);
-- CreateIndex
CREATE UNIQUE INDEX "App_slug_key" ON "App"("slug");
-- CreateIndex
CREATE UNIQUE INDEX "App_dirName_key" ON "App"("dirName");
-- AddForeignKey
ALTER TABLE "Credential" ADD CONSTRAINT "Credential_appId_fkey" FOREIGN KEY ("appId") REFERENCES "App"("slug") ON DELETE CASCADE ON UPDATE CASCADE;