-- AlterEnum
-- This migration adds more than one value to an enum.
-- With PostgreSQL versions 11 and earlier, this is not possible
-- in a single migration. This can be worked around by creating
-- multiple migrations, each migration adding only one value to
-- the enum.


ALTER TYPE "ExternalServiceType" ADD VALUE 'Offbo';
ALTER TYPE "ExternalServiceType" ADD VALUE 'Noble';
ALTER TYPE "ExternalServiceType" ADD VALUE 'Humble';

-- AlterTable
ALTER TABLE "TestEntity" ADD COLUMN     "type" TEXT;

-- AlterTable
ALTER TABLE "User" ADD COLUMN     "humbleExternalServiceId" TEXT NOT NULL DEFAULT '',
ADD COLUMN     "nobleExternalServiceId" TEXT NOT NULL DEFAULT '',
ADD COLUMN     "offboExternalServiceId" TEXT NOT NULL DEFAULT '';

-- CreateTable
CREATE TABLE "ExternalServiceMeta" (
    "id" UUID NOT NULL DEFAULT gen_random_uuid(),
    "type" "ExternalServiceType" NOT NULL,
    "data" JSONB NOT NULL,
    "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updatedAt" TIMESTAMP(3) NOT NULL,

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