chore: import upstream snapshot with attribution

This commit is contained in:
wehub-resource-sync
2026-07-13 13:32:57 +08:00
commit cd420f9332
4811 changed files with 884702 additions and 0 deletions
@@ -0,0 +1,8 @@
-- CreateTable
CREATE TABLE "User" (
"id" TEXT NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "User_pkey" PRIMARY KEY ("id")
);
@@ -0,0 +1,74 @@
/*
Warnings:
- A unique constraint covering the columns `[email]` on the table `User` will be added. If there are existing duplicate values, this will fail.
- Added the required column `authenticationMethod` to the `User` table without a default value. This is not possible if the table is not empty.
- Added the required column `email` to the `User` table without a default value. This is not possible if the table is not empty.
*/
-- CreateEnum
CREATE TYPE "AuthenticationMethod" AS ENUM ('GITHUB', 'MAGIC_LINK');
-- AlterTable
ALTER TABLE "User" ADD COLUMN "accessToken" TEXT,
ADD COLUMN "admin" BOOLEAN NOT NULL DEFAULT false,
ADD COLUMN "authenticationExtraParams" JSONB,
ADD COLUMN "authenticationMethod" "AuthenticationMethod" NOT NULL,
ADD COLUMN "authenticationProfile" JSONB,
ADD COLUMN "avatarUrl" TEXT,
ADD COLUMN "displayName" TEXT,
ADD COLUMN "email" TEXT NOT NULL,
ADD COLUMN "name" TEXT;
-- CreateTable
CREATE TABLE "Organization" (
"id" TEXT NOT NULL,
"slug" TEXT NOT NULL,
"title" TEXT NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "Organization_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "Workflow" (
"id" TEXT NOT NULL,
"slug" TEXT NOT NULL,
"title" TEXT NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
"organizationId" TEXT NOT NULL,
CONSTRAINT "Workflow_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "_OrganizationToUser" (
"A" TEXT NOT NULL,
"B" TEXT NOT NULL
);
-- CreateIndex
CREATE UNIQUE INDEX "Organization_slug_key" ON "Organization"("slug");
-- CreateIndex
CREATE UNIQUE INDEX "Workflow_organizationId_slug_key" ON "Workflow"("organizationId", "slug");
-- CreateIndex
CREATE UNIQUE INDEX "_OrganizationToUser_AB_unique" ON "_OrganizationToUser"("A", "B");
-- CreateIndex
CREATE INDEX "_OrganizationToUser_B_index" ON "_OrganizationToUser"("B");
-- CreateIndex
CREATE UNIQUE INDEX "User_email_key" ON "User"("email");
-- AddForeignKey
ALTER TABLE "Workflow" ADD CONSTRAINT "Workflow_organizationId_fkey" FOREIGN KEY ("organizationId") REFERENCES "Organization"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "_OrganizationToUser" ADD CONSTRAINT "_OrganizationToUser_A_fkey" FOREIGN KEY ("A") REFERENCES "Organization"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "_OrganizationToUser" ADD CONSTRAINT "_OrganizationToUser_B_fkey" FOREIGN KEY ("B") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
@@ -0,0 +1,20 @@
-- CreateTable
CREATE TABLE "RuntimeEnvironment" (
"id" TEXT NOT NULL,
"slug" TEXT NOT NULL,
"apiKey" TEXT NOT NULL,
"organizationId" TEXT NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "RuntimeEnvironment_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE UNIQUE INDEX "RuntimeEnvironment_apiKey_key" ON "RuntimeEnvironment"("apiKey");
-- CreateIndex
CREATE UNIQUE INDEX "RuntimeEnvironment_organizationId_slug_key" ON "RuntimeEnvironment"("organizationId", "slug");
-- AddForeignKey
ALTER TABLE "RuntimeEnvironment" ADD CONSTRAINT "RuntimeEnvironment_organizationId_fkey" FOREIGN KEY ("organizationId") REFERENCES "Organization"("id") ON DELETE CASCADE ON UPDATE CASCADE;
@@ -0,0 +1,20 @@
-- CreateEnum
CREATE TYPE "APIConnectionType" AS ENUM ('HTTP', 'GRAPHQL');
-- CreateTable
CREATE TABLE "APIConnection" (
"id" TEXT NOT NULL,
"title" TEXT NOT NULL,
"apiIdentifier" TEXT NOT NULL,
"externalId" TEXT NOT NULL,
"scopes" TEXT[],
"type" "APIConnectionType" NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
"organizationId" TEXT NOT NULL,
CONSTRAINT "APIConnection_pkey" PRIMARY KEY ("id")
);
-- AddForeignKey
ALTER TABLE "APIConnection" ADD CONSTRAINT "APIConnection_organizationId_fkey" FOREIGN KEY ("organizationId") REFERENCES "Organization"("id") ON DELETE CASCADE ON UPDATE CASCADE;
@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "APIConnection" ALTER COLUMN "externalId" DROP NOT NULL;
@@ -0,0 +1,9 @@
/*
Warnings:
- The `externalId` column on the `APIConnection` table would be dropped and recreated. This will lead to data loss if there is data in the column.
*/
-- AlterTable
ALTER TABLE "APIConnection" DROP COLUMN "externalId",
ADD COLUMN "externalId" INTEGER;
@@ -0,0 +1,12 @@
/*
Warnings:
- You are about to drop the column `externalId` on the `APIConnection` table. All the data in the column will be lost.
*/
-- CreateEnum
CREATE TYPE "APIConnectionStatus" AS ENUM ('CREATED', 'CONNECTED');
-- AlterTable
ALTER TABLE "APIConnection" DROP COLUMN "externalId",
ADD COLUMN "status" "APIConnectionStatus" NOT NULL DEFAULT 'CREATED';
@@ -0,0 +1,30 @@
-- CreateEnum
CREATE TYPE "WorkflowTriggerType" AS ENUM ('WEBHOOK', 'SCHEDULE', 'CUSTOM_EVENT', 'HTTP_ENDPOINT');
-- CreateEnum
CREATE TYPE "WorkflowTriggerStatus" AS ENUM ('CREATED', 'CONNECTED');
-- AlterTable
ALTER TABLE "Workflow" ADD COLUMN "packageJson" JSONB;
-- CreateTable
CREATE TABLE "WorkflowTrigger" (
"id" TEXT NOT NULL,
"workflowId" TEXT NOT NULL,
"environmentId" TEXT NOT NULL,
"type" "WorkflowTriggerType" NOT NULL,
"config" JSONB NOT NULL,
"status" "WorkflowTriggerStatus" NOT NULL DEFAULT 'CREATED',
"isDefault" BOOLEAN NOT NULL DEFAULT false,
CONSTRAINT "WorkflowTrigger_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE UNIQUE INDEX "WorkflowTrigger_workflowId_environmentId_key" ON "WorkflowTrigger"("workflowId", "environmentId");
-- AddForeignKey
ALTER TABLE "WorkflowTrigger" ADD CONSTRAINT "WorkflowTrigger_workflowId_fkey" FOREIGN KEY ("workflowId") REFERENCES "Workflow"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "WorkflowTrigger" ADD CONSTRAINT "WorkflowTrigger_environmentId_fkey" FOREIGN KEY ("environmentId") REFERENCES "RuntimeEnvironment"("id") ON DELETE CASCADE ON UPDATE CASCADE;
@@ -0,0 +1,18 @@
-- CreateTable
CREATE TABLE "CustomEvent" (
"id" TEXT NOT NULL,
"name" TEXT NOT NULL,
"timestamp" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"payload" JSONB NOT NULL,
"context" JSONB,
"organizationId" TEXT NOT NULL,
"environmentId" TEXT NOT NULL,
CONSTRAINT "CustomEvent_pkey" PRIMARY KEY ("id")
);
-- AddForeignKey
ALTER TABLE "CustomEvent" ADD CONSTRAINT "CustomEvent_organizationId_fkey" FOREIGN KEY ("organizationId") REFERENCES "Organization"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "CustomEvent" ADD CONSTRAINT "CustomEvent_environmentId_fkey" FOREIGN KEY ("environmentId") REFERENCES "RuntimeEnvironment"("id") ON DELETE CASCADE ON UPDATE CASCADE;
@@ -0,0 +1,5 @@
-- CreateEnum
CREATE TYPE "CustomEventStatus" AS ENUM ('PENDING', 'PROCESSED');
-- AlterTable
ALTER TABLE "CustomEvent" ADD COLUMN "status" "CustomEventStatus" NOT NULL DEFAULT 'PENDING';
@@ -0,0 +1,10 @@
-- AlterTable
ALTER TABLE "RuntimeEnvironment" ADD COLUMN "title" TEXT;
-- If the slug is "dev" set the title to "Development"
UPDATE "RuntimeEnvironment" SET "title" = 'Development' WHERE "slug" = 'dev';
-- If the slug is "prod" set the title to "Production"
UPDATE "RuntimeEnvironment" SET "title" = 'Production' WHERE "slug" = 'prod';
-- Make the title column not null
ALTER TABLE "RuntimeEnvironment" ALTER COLUMN "title" SET NOT NULL;
@@ -0,0 +1,25 @@
-- CreateEnum
CREATE TYPE "WorkflowRunStatus" AS ENUM ('PENDING', 'RUNNING', 'SUCCESS', 'ERROR');
-- CreateTable
CREATE TABLE "WorkflowRun" (
"id" TEXT NOT NULL,
"workflowId" TEXT NOT NULL,
"triggerId" TEXT NOT NULL,
"environmentId" TEXT NOT NULL,
"data" JSONB NOT NULL,
"status" "WorkflowRunStatus" NOT NULL DEFAULT 'PENDING',
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "WorkflowRun_pkey" PRIMARY KEY ("id")
);
-- AddForeignKey
ALTER TABLE "WorkflowRun" ADD CONSTRAINT "WorkflowRun_workflowId_fkey" FOREIGN KEY ("workflowId") REFERENCES "Workflow"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "WorkflowRun" ADD CONSTRAINT "WorkflowRun_triggerId_fkey" FOREIGN KEY ("triggerId") REFERENCES "WorkflowTrigger"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "WorkflowRun" ADD CONSTRAINT "WorkflowRun_environmentId_fkey" FOREIGN KEY ("environmentId") REFERENCES "RuntimeEnvironment"("id") ON DELETE CASCADE ON UPDATE CASCADE;
@@ -0,0 +1,10 @@
/*
Warnings:
- You are about to drop the column `data` on the `WorkflowRun` table. All the data in the column will be lost.
- Added the required column `input` to the `WorkflowRun` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE "WorkflowRun" DROP COLUMN "data",
ADD COLUMN "input" JSONB NOT NULL;
@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "WorkflowRun" ADD COLUMN "context" JSONB;
@@ -0,0 +1,8 @@
/*
Warnings:
- Added the required column `timestamp` to the `WorkflowRun` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE "WorkflowRun" ADD COLUMN "timestamp" TIMESTAMP(3) NOT NULL;
@@ -0,0 +1,8 @@
/*
Warnings:
- You are about to drop the column `title` on the `RuntimeEnvironment` table. All the data in the column will be lost.
*/
-- AlterTable
ALTER TABLE "RuntimeEnvironment" DROP COLUMN "title";
@@ -0,0 +1,19 @@
-- CreateEnum
CREATE TYPE "WorkflowRunStepType" AS ENUM ('LOG_MESSAGE', 'DURABLE_DELAY', 'CUSTOM_EVENT');
-- CreateTable
CREATE TABLE "WorkflowRunStep" (
"id" TEXT NOT NULL,
"runId" TEXT NOT NULL,
"type" "WorkflowRunStepType" NOT NULL,
"input" JSONB NOT NULL,
"output" JSONB,
"context" JSONB NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "WorkflowRunStep_pkey" PRIMARY KEY ("id")
);
-- AddForeignKey
ALTER TABLE "WorkflowRunStep" ADD CONSTRAINT "WorkflowRunStep_runId_fkey" FOREIGN KEY ("runId") REFERENCES "WorkflowRun"("id") ON DELETE CASCADE ON UPDATE CASCADE;
@@ -0,0 +1,5 @@
-- AlterEnum
ALTER TYPE "WorkflowRunStepType" ADD VALUE 'OUTPUT';
-- AlterTable
ALTER TABLE "WorkflowRunStep" ALTER COLUMN "input" DROP NOT NULL;
@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "WorkflowRun" ADD COLUMN "error" JSONB;
@@ -0,0 +1,14 @@
/*
Warnings:
- You are about to drop the column `timestamp` on the `WorkflowRun` table. All the data in the column will be lost.
*/
-- AlterTable
ALTER TABLE "WorkflowRun" DROP COLUMN "timestamp",
ADD COLUMN "finishedAt" TIMESTAMP(3),
ADD COLUMN "startedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP;
-- AlterTable
ALTER TABLE "WorkflowRunStep" ADD COLUMN "finishedAt" TIMESTAMP(3),
ADD COLUMN "startedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP;
@@ -0,0 +1,7 @@
-- AlterTable
ALTER TABLE "WorkflowRun" ALTER COLUMN "startedAt" DROP NOT NULL,
ALTER COLUMN "startedAt" DROP DEFAULT;
-- AlterTable
ALTER TABLE "WorkflowRunStep" ALTER COLUMN "startedAt" DROP NOT NULL,
ALTER COLUMN "startedAt" DROP DEFAULT;
@@ -0,0 +1,27 @@
-- CreateTable
CREATE TABLE "WorkflowConnectionSlot" (
"id" TEXT NOT NULL,
"workflowId" TEXT NOT NULL,
"triggerId" TEXT,
"connectionId" TEXT,
"slotName" TEXT NOT NULL,
"serviceIdentifier" TEXT NOT NULL,
"auth" JSONB,
CONSTRAINT "WorkflowConnectionSlot_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE UNIQUE INDEX "WorkflowConnectionSlot_triggerId_key" ON "WorkflowConnectionSlot"("triggerId");
-- CreateIndex
CREATE UNIQUE INDEX "WorkflowConnectionSlot_workflowId_slotName_key" ON "WorkflowConnectionSlot"("workflowId", "slotName");
-- AddForeignKey
ALTER TABLE "WorkflowConnectionSlot" ADD CONSTRAINT "WorkflowConnectionSlot_workflowId_fkey" FOREIGN KEY ("workflowId") REFERENCES "Workflow"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "WorkflowConnectionSlot" ADD CONSTRAINT "WorkflowConnectionSlot_triggerId_fkey" FOREIGN KEY ("triggerId") REFERENCES "WorkflowTrigger"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "WorkflowConnectionSlot" ADD CONSTRAINT "WorkflowConnectionSlot_connectionId_fkey" FOREIGN KEY ("connectionId") REFERENCES "APIConnection"("id") ON DELETE CASCADE ON UPDATE CASCADE;
@@ -0,0 +1,29 @@
-- CreateTable
CREATE TABLE "RegisteredWebhook" (
"id" TEXT NOT NULL,
"workflowId" TEXT NOT NULL,
"triggerId" TEXT NOT NULL,
"connectionSlotId" TEXT NOT NULL,
"webhookConfig" JSONB NOT NULL,
"isEnabled" BOOLEAN NOT NULL DEFAULT true,
CONSTRAINT "RegisteredWebhook_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE UNIQUE INDEX "RegisteredWebhook_triggerId_key" ON "RegisteredWebhook"("triggerId");
-- CreateIndex
CREATE UNIQUE INDEX "RegisteredWebhook_connectionSlotId_key" ON "RegisteredWebhook"("connectionSlotId");
-- CreateIndex
CREATE UNIQUE INDEX "RegisteredWebhook_workflowId_triggerId_key" ON "RegisteredWebhook"("workflowId", "triggerId");
-- AddForeignKey
ALTER TABLE "RegisteredWebhook" ADD CONSTRAINT "RegisteredWebhook_workflowId_fkey" FOREIGN KEY ("workflowId") REFERENCES "Workflow"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "RegisteredWebhook" ADD CONSTRAINT "RegisteredWebhook_triggerId_fkey" FOREIGN KEY ("triggerId") REFERENCES "WorkflowTrigger"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "RegisteredWebhook" ADD CONSTRAINT "RegisteredWebhook_connectionSlotId_fkey" FOREIGN KEY ("connectionSlotId") REFERENCES "WorkflowConnectionSlot"("id") ON DELETE CASCADE ON UPDATE CASCADE;
@@ -0,0 +1,20 @@
/*
Warnings:
- You are about to drop the column `isEnabled` on the `RegisteredWebhook` table. All the data in the column will be lost.
- Added the required column `updatedAt` to the `RegisteredWebhook` table without a default value. This is not possible if the table is not empty.
*/
-- CreateEnum
CREATE TYPE "RegisteredWebhookStatus" AS ENUM ('CREATED', 'CONNECTED');
-- DropIndex
DROP INDEX "RegisteredWebhook_workflowId_triggerId_key";
-- AlterTable
ALTER TABLE "RegisteredWebhook" DROP COLUMN "isEnabled",
ADD COLUMN "connectedAt" TIMESTAMP(3),
ADD COLUMN "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
ADD COLUMN "status" "RegisteredWebhookStatus" NOT NULL DEFAULT 'CREATED',
ADD COLUMN "updatedAt" TIMESTAMP(3) NOT NULL,
ALTER COLUMN "webhookConfig" DROP NOT NULL;
@@ -0,0 +1,8 @@
/*
Warnings:
- Added the required column `secret` to the `RegisteredWebhook` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE "RegisteredWebhook" ADD COLUMN "secret" TEXT NOT NULL;
@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "WorkflowRun" ADD COLUMN "isTest" BOOLEAN NOT NULL DEFAULT false;
@@ -0,0 +1,96 @@
/*
Warnings:
- You are about to drop the column `triggerId` on the `WorkflowRun` table. All the data in the column will be lost.
- You are about to drop the `RegisteredWebhook` table. If the table is not empty, all the data it contains will be lost.
- You are about to drop the `WorkflowConnectionSlot` table. If the table is not empty, all the data it contains will be lost.
- You are about to drop the `WorkflowTrigger` table. If the table is not empty, all the data it contains will be lost.
- Added the required column `filter` to the `Workflow` table without a default value. This is not possible if the table is not empty.
- Added the required column `subscription` to the `Workflow` table without a default value. This is not possible if the table is not empty.
- Added the required column `type` to the `Workflow` table without a default value. This is not possible if the table is not empty.
*/
-- CreateEnum
CREATE TYPE "SubscriptionType" AS ENUM ('WEBHOOK', 'SCHEDULE', 'CUSTOM_EVENT', 'HTTP_ENDPOINT', 'EVENT_BRIDGE', 'HTTP_POLLING');
-- CreateEnum
CREATE TYPE "SubscriptionStatus" AS ENUM ('CREATED', 'READY');
-- CreateEnum
CREATE TYPE "ExternalSourceStatus" AS ENUM ('CREATED', 'READY');
-- CreateEnum
CREATE TYPE "ExternalSourceType" AS ENUM ('WEBHOOK', 'EVENT_BRIDGE', 'HTTP_POLLING');
-- DropForeignKey
ALTER TABLE "RegisteredWebhook" DROP CONSTRAINT "RegisteredWebhook_connectionSlotId_fkey";
-- DropForeignKey
ALTER TABLE "RegisteredWebhook" DROP CONSTRAINT "RegisteredWebhook_triggerId_fkey";
-- DropForeignKey
ALTER TABLE "RegisteredWebhook" DROP CONSTRAINT "RegisteredWebhook_workflowId_fkey";
-- DropForeignKey
ALTER TABLE "WorkflowConnectionSlot" DROP CONSTRAINT "WorkflowConnectionSlot_connectionId_fkey";
-- DropForeignKey
ALTER TABLE "WorkflowConnectionSlot" DROP CONSTRAINT "WorkflowConnectionSlot_triggerId_fkey";
-- DropForeignKey
ALTER TABLE "WorkflowConnectionSlot" DROP CONSTRAINT "WorkflowConnectionSlot_workflowId_fkey";
-- DropForeignKey
ALTER TABLE "WorkflowRun" DROP CONSTRAINT "WorkflowRun_triggerId_fkey";
-- DropForeignKey
ALTER TABLE "WorkflowTrigger" DROP CONSTRAINT "WorkflowTrigger_environmentId_fkey";
-- DropForeignKey
ALTER TABLE "WorkflowTrigger" DROP CONSTRAINT "WorkflowTrigger_workflowId_fkey";
-- AlterTable
ALTER TABLE "Workflow" ADD COLUMN "externalSourceId" TEXT,
ADD COLUMN "filter" JSONB NOT NULL,
ADD COLUMN "status" "SubscriptionStatus" NOT NULL DEFAULT 'CREATED',
ADD COLUMN "subscription" JSONB NOT NULL,
ADD COLUMN "type" "SubscriptionType" NOT NULL;
-- AlterTable
ALTER TABLE "WorkflowRun" DROP COLUMN "triggerId";
-- DropTable
DROP TABLE "RegisteredWebhook";
-- DropTable
DROP TABLE "WorkflowConnectionSlot";
-- DropTable
DROP TABLE "WorkflowTrigger";
-- DropEnum
DROP TYPE "WorkflowTriggerStatus";
-- DropEnum
DROP TYPE "WorkflowTriggerType";
-- CreateTable
CREATE TABLE "ExternalSource" (
"id" TEXT NOT NULL,
"type" "ExternalSourceType" NOT NULL,
"source" JSONB NOT NULL,
"status" "ExternalSourceStatus" NOT NULL DEFAULT 'CREATED',
"externalData" JSONB,
"readyAt" TIMESTAMP(3),
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
"connectionId" TEXT,
CONSTRAINT "ExternalSource_pkey" PRIMARY KEY ("id")
);
-- AddForeignKey
ALTER TABLE "Workflow" ADD CONSTRAINT "Workflow_externalSourceId_fkey" FOREIGN KEY ("externalSourceId") REFERENCES "ExternalSource"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "ExternalSource" ADD CONSTRAINT "ExternalSource_connectionId_fkey" FOREIGN KEY ("connectionId") REFERENCES "APIConnection"("id") ON DELETE CASCADE ON UPDATE CASCADE;
@@ -0,0 +1,83 @@
/*
Warnings:
- You are about to drop the column `filter` on the `Workflow` table. All the data in the column will be lost.
- You are about to drop the column `subscription` on the `Workflow` table. All the data in the column will be lost.
- The `status` column on the `Workflow` table would be dropped and recreated. This will lead to data loss if there is data in the column.
- You are about to drop the column `context` on the `WorkflowRun` table. All the data in the column will be lost.
- You are about to drop the column `input` on the `WorkflowRun` table. All the data in the column will be lost.
- You are about to drop the `CustomEvent` table. If the table is not empty, all the data it contains will be lost.
- Added the required column `eventRule` to the `Workflow` table without a default value. This is not possible if the table is not empty.
- Added the required column `trigger` to the `Workflow` table without a default value. This is not possible if the table is not empty.
- Changed the type of `type` on the `Workflow` table. No cast exists, the column would be dropped and recreated, which cannot be done if there is data, since the column is required.
- Added the required column `eventId` to the `WorkflowRun` table without a default value. This is not possible if the table is not empty.
*/
-- CreateEnum
CREATE TYPE "TriggerType" AS ENUM ('WEBHOOK', 'SCHEDULE', 'CUSTOM_EVENT', 'HTTP_ENDPOINT', 'EVENT_BRIDGE', 'HTTP_POLLING');
-- CreateEnum
CREATE TYPE "WorkflowStatus" AS ENUM ('CREATED', 'READY');
-- CreateEnum
CREATE TYPE "TriggerEventStatus" AS ENUM ('PENDING', 'PROCESSED');
-- DropForeignKey
ALTER TABLE "CustomEvent" DROP CONSTRAINT "CustomEvent_environmentId_fkey";
-- DropForeignKey
ALTER TABLE "CustomEvent" DROP CONSTRAINT "CustomEvent_organizationId_fkey";
-- AlterTable
ALTER TABLE "Workflow" DROP COLUMN "filter",
DROP COLUMN "subscription",
ADD COLUMN "eventRule" JSONB NOT NULL,
ADD COLUMN "trigger" JSONB NOT NULL,
DROP COLUMN "status",
ADD COLUMN "status" "WorkflowStatus" NOT NULL DEFAULT 'CREATED',
DROP COLUMN "type",
ADD COLUMN "type" "TriggerType" NOT NULL;
-- AlterTable
ALTER TABLE "WorkflowRun" DROP COLUMN "context",
DROP COLUMN "input",
ADD COLUMN "eventId" TEXT NOT NULL;
-- DropTable
DROP TABLE "CustomEvent";
-- DropEnum
DROP TYPE "CustomEventStatus";
-- DropEnum
DROP TYPE "RegisteredWebhookStatus";
-- DropEnum
DROP TYPE "SubscriptionStatus";
-- DropEnum
DROP TYPE "SubscriptionType";
-- CreateTable
CREATE TABLE "TriggerEvent" (
"id" TEXT NOT NULL,
"name" TEXT NOT NULL,
"type" "TriggerType" NOT NULL,
"timestamp" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"payload" JSONB NOT NULL,
"context" JSONB,
"organizationId" TEXT,
"environmentId" TEXT,
"status" "TriggerEventStatus" NOT NULL DEFAULT 'PENDING',
CONSTRAINT "TriggerEvent_pkey" PRIMARY KEY ("id")
);
-- AddForeignKey
ALTER TABLE "TriggerEvent" ADD CONSTRAINT "TriggerEvent_organizationId_fkey" FOREIGN KEY ("organizationId") REFERENCES "Organization"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "TriggerEvent" ADD CONSTRAINT "TriggerEvent_environmentId_fkey" FOREIGN KEY ("environmentId") REFERENCES "RuntimeEnvironment"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "WorkflowRun" ADD CONSTRAINT "WorkflowRun_eventId_fkey" FOREIGN KEY ("eventId") REFERENCES "TriggerEvent"("id") ON DELETE CASCADE ON UPDATE CASCADE;
@@ -0,0 +1,13 @@
/*
Warnings:
- Added the required column `key` to the `ExternalSource` table without a default value. This is not possible if the table is not empty.
- Added the required column `organizationId` to the `ExternalSource` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE "ExternalSource" ADD COLUMN "key" TEXT NOT NULL,
ADD COLUMN "organizationId" TEXT NOT NULL;
-- AddForeignKey
ALTER TABLE "ExternalSource" ADD CONSTRAINT "ExternalSource_organizationId_fkey" FOREIGN KEY ("organizationId") REFERENCES "Organization"("id") ON DELETE CASCADE ON UPDATE CASCADE;
@@ -0,0 +1,8 @@
/*
Warnings:
- A unique constraint covering the columns `[organizationId,key]` on the table `ExternalSource` will be added. If there are existing duplicate values, this will fail.
*/
-- CreateIndex
CREATE UNIQUE INDEX "ExternalSource_organizationId_key_key" ON "ExternalSource"("organizationId", "key");
@@ -0,0 +1,33 @@
/*
Warnings:
- You are about to drop the column `eventRule` on the `Workflow` table. All the data in the column will be lost.
- You are about to drop the column `trigger` on the `Workflow` table. All the data in the column will be lost.
*/
-- AlterTable
ALTER TABLE "Workflow" DROP COLUMN "eventRule",
DROP COLUMN "trigger";
-- CreateTable
CREATE TABLE "EventRule" (
"id" TEXT NOT NULL,
"type" "TriggerType" NOT NULL,
"workflowId" TEXT NOT NULL,
"organizationId" TEXT NOT NULL,
"environmentId" TEXT NOT NULL,
"rule" JSONB NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "EventRule_pkey" PRIMARY KEY ("id")
);
-- AddForeignKey
ALTER TABLE "EventRule" ADD CONSTRAINT "EventRule_workflowId_fkey" FOREIGN KEY ("workflowId") REFERENCES "Workflow"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "EventRule" ADD CONSTRAINT "EventRule_organizationId_fkey" FOREIGN KEY ("organizationId") REFERENCES "Organization"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "EventRule" ADD CONSTRAINT "EventRule_environmentId_fkey" FOREIGN KEY ("environmentId") REFERENCES "RuntimeEnvironment"("id") ON DELETE CASCADE ON UPDATE CASCADE;
@@ -0,0 +1,8 @@
/*
Warnings:
- A unique constraint covering the columns `[workflowId,environmentId]` on the table `EventRule` will be added. If there are existing duplicate values, this will fail.
*/
-- CreateIndex
CREATE UNIQUE INDEX "EventRule_workflowId_environmentId_key" ON "EventRule"("workflowId", "environmentId");
@@ -0,0 +1,11 @@
/*
Warnings:
- Added the required column `eventRuleId` to the `WorkflowRun` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE "WorkflowRun" ADD COLUMN "eventRuleId" TEXT NOT NULL;
-- AddForeignKey
ALTER TABLE "WorkflowRun" ADD CONSTRAINT "WorkflowRun_eventRuleId_fkey" FOREIGN KEY ("eventRuleId") REFERENCES "EventRule"("id") ON DELETE CASCADE ON UPDATE CASCADE;
@@ -0,0 +1,8 @@
/*
Warnings:
- Added the required column `trigger` to the `EventRule` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE "EventRule" ADD COLUMN "trigger" JSONB NOT NULL;
@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "ExternalSource" ADD COLUMN "secret" TEXT;
@@ -0,0 +1,8 @@
/*
Warnings:
- Added the required column `service` to the `TriggerEvent` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE "TriggerEvent" ADD COLUMN "service" TEXT NOT NULL;
@@ -0,0 +1,10 @@
/*
Warnings:
- Added the required column `updatedAt` to the `TriggerEvent` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE "TriggerEvent" ADD COLUMN "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
ADD COLUMN "processedAt" TIMESTAMP(3),
ADD COLUMN "updatedAt" TIMESTAMP(3) NOT NULL;
@@ -0,0 +1,10 @@
/*
Warnings:
- You are about to drop the column `rule` on the `EventRule` table. All the data in the column will be lost.
- Added the required column `filter` to the `EventRule` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE "EventRule" DROP COLUMN "rule",
ADD COLUMN "filter" JSONB NOT NULL;
@@ -0,0 +1,21 @@
/*
Warnings:
- The values [PROCESSED] on the enum `TriggerEventStatus` will be removed. If these variants are still used in the database, this will fail.
- You are about to drop the column `processedAt` on the `TriggerEvent` table. All the data in the column will be lost.
*/
-- AlterEnum
BEGIN;
CREATE TYPE "TriggerEventStatus_new" AS ENUM ('PENDING', 'DISPATCHED');
ALTER TABLE "TriggerEvent" ALTER COLUMN "status" DROP DEFAULT;
ALTER TABLE "TriggerEvent" ALTER COLUMN "status" TYPE "TriggerEventStatus_new" USING ("status"::text::"TriggerEventStatus_new");
ALTER TYPE "TriggerEventStatus" RENAME TO "TriggerEventStatus_old";
ALTER TYPE "TriggerEventStatus_new" RENAME TO "TriggerEventStatus";
DROP TYPE "TriggerEventStatus_old";
ALTER TABLE "TriggerEvent" ALTER COLUMN "status" SET DEFAULT 'PENDING';
COMMIT;
-- AlterTable
ALTER TABLE "TriggerEvent" DROP COLUMN "processedAt",
ADD COLUMN "dispatchedAt" TIMESTAMP(3);
@@ -0,0 +1,14 @@
/*
Warnings:
- Added the required column `service` to the `ExternalSource` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE "ExternalSource" ADD COLUMN "service" TEXT;
UPDATE "ExternalSource" SET service = 'github';
-- AlterTable
ALTER TABLE "ExternalSource" ALTER COLUMN "service" SET NOT NULL;
@@ -0,0 +1,30 @@
-- CreateEnum
CREATE TYPE "ExternalServiceType" AS ENUM ('HTTP_API');
-- CreateEnum
CREATE TYPE "ExternalServiceStatus" AS ENUM ('CREATED', 'READY');
-- CreateTable
CREATE TABLE "ExternalService" (
"id" TEXT NOT NULL,
"slug" TEXT NOT NULL,
"service" TEXT NOT NULL,
"workflowId" TEXT NOT NULL,
"connectionId" TEXT,
"type" "ExternalServiceType" NOT NULL,
"status" "ExternalServiceStatus" NOT NULL DEFAULT 'CREATED',
"readyAt" TIMESTAMP(3),
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "ExternalService_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE UNIQUE INDEX "ExternalService_workflowId_slug_key" ON "ExternalService"("workflowId", "slug");
-- AddForeignKey
ALTER TABLE "ExternalService" ADD CONSTRAINT "ExternalService_workflowId_fkey" FOREIGN KEY ("workflowId") REFERENCES "Workflow"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "ExternalService" ADD CONSTRAINT "ExternalService_connectionId_fkey" FOREIGN KEY ("connectionId") REFERENCES "APIConnection"("id") ON DELETE CASCADE ON UPDATE CASCADE;
@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "TriggerEvent" ADD COLUMN "isTest" BOOLEAN NOT NULL DEFAULT false;
@@ -0,0 +1,41 @@
-- CreateEnum
CREATE TYPE "IntegrationRequestStatus" AS ENUM ('PENDING', 'RETRYING', 'SUCCESS', 'ERROR');
-- CreateEnum
CREATE TYPE "WorkflowRunStepStatus" AS ENUM ('PENDING', 'RUNNING', 'SUCCESS', 'ERROR');
-- AlterEnum
ALTER TYPE "WorkflowRunStepType" ADD VALUE 'INTEGRATION_REQUEST';
-- AlterTable
ALTER TABLE "WorkflowRunStep" ADD COLUMN "status" "WorkflowRunStepStatus" NOT NULL DEFAULT 'PENDING';
-- CreateTable
CREATE TABLE "IntegrationRequest" (
"id" TEXT NOT NULL,
"params" JSONB NOT NULL,
"endpoint" TEXT NOT NULL,
"externalServiceId" TEXT NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
"status" "IntegrationRequestStatus" NOT NULL DEFAULT 'PENDING',
"runId" TEXT NOT NULL,
"stepId" TEXT NOT NULL,
"retryCount" INTEGER NOT NULL DEFAULT 0,
"error" JSONB,
"response" JSONB,
CONSTRAINT "IntegrationRequest_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE UNIQUE INDEX "IntegrationRequest_stepId_key" ON "IntegrationRequest"("stepId");
-- AddForeignKey
ALTER TABLE "IntegrationRequest" ADD CONSTRAINT "IntegrationRequest_externalServiceId_fkey" FOREIGN KEY ("externalServiceId") REFERENCES "ExternalService"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "IntegrationRequest" ADD CONSTRAINT "IntegrationRequest_runId_fkey" FOREIGN KEY ("runId") REFERENCES "WorkflowRun"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "IntegrationRequest" ADD CONSTRAINT "IntegrationRequest_stepId_fkey" FOREIGN KEY ("stepId") REFERENCES "WorkflowRunStep"("id") ON DELETE CASCADE ON UPDATE CASCADE;
@@ -0,0 +1,2 @@
-- AlterEnum
ALTER TYPE "IntegrationRequestStatus" ADD VALUE 'WAITING_FOR_CONNECTION';
@@ -0,0 +1,3 @@
-- AlterTable
ALTER TABLE "Workflow" ADD COLUMN "eventNames" TEXT[],
ADD COLUMN "service" TEXT NOT NULL DEFAULT 'trigger';
@@ -0,0 +1,2 @@
-- AlterEnum
ALTER TYPE "IntegrationRequestStatus" ADD VALUE 'FETCHING';
@@ -0,0 +1,14 @@
-- CreateTable
CREATE TABLE "IntegrationResponse" (
"id" TEXT NOT NULL,
"requestId" TEXT NOT NULL,
"statusCode" INTEGER NOT NULL,
"body" JSONB NOT NULL,
"headers" JSONB NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT "IntegrationResponse_pkey" PRIMARY KEY ("id")
);
-- AddForeignKey
ALTER TABLE "IntegrationResponse" ADD CONSTRAINT "IntegrationResponse_requestId_fkey" FOREIGN KEY ("requestId") REFERENCES "IntegrationRequest"("id") ON DELETE CASCADE ON UPDATE CASCADE;
@@ -0,0 +1,5 @@
-- CreateEnum
CREATE TYPE "APIAuthenticationMethod" AS ENUM ('OAUTH', 'API_KEY');
-- AlterTable
ALTER TABLE "APIConnection" ADD COLUMN "authenticationMethod" "APIAuthenticationMethod" NOT NULL DEFAULT 'OAUTH';
@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "APIConnection" ADD COLUMN "authenticationConfig" JSONB;
@@ -0,0 +1,20 @@
-- CreateTable
CREATE TABLE "DurableDelay" (
"id" TEXT NOT NULL,
"runId" TEXT NOT NULL,
"stepId" TEXT NOT NULL,
"delayUntil" TIMESTAMP(3) NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"resolvedAt" TIMESTAMP(3),
CONSTRAINT "DurableDelay_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE UNIQUE INDEX "DurableDelay_stepId_key" ON "DurableDelay"("stepId");
-- AddForeignKey
ALTER TABLE "DurableDelay" ADD CONSTRAINT "DurableDelay_runId_fkey" FOREIGN KEY ("runId") REFERENCES "WorkflowRun"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "DurableDelay" ADD CONSTRAINT "DurableDelay_stepId_fkey" FOREIGN KEY ("stepId") REFERENCES "WorkflowRunStep"("id") ON DELETE CASCADE ON UPDATE CASCADE;
@@ -0,0 +1,11 @@
-- DropForeignKey
ALTER TABLE "ExternalService" DROP CONSTRAINT "ExternalService_connectionId_fkey";
-- DropForeignKey
ALTER TABLE "ExternalSource" DROP CONSTRAINT "ExternalSource_connectionId_fkey";
-- AddForeignKey
ALTER TABLE "ExternalSource" ADD CONSTRAINT "ExternalSource_connectionId_fkey" FOREIGN KEY ("connectionId") REFERENCES "APIConnection"("id") ON DELETE SET NULL ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "ExternalService" ADD CONSTRAINT "ExternalService_connectionId_fkey" FOREIGN KEY ("connectionId") REFERENCES "APIConnection"("id") ON DELETE SET NULL ON UPDATE CASCADE;
@@ -0,0 +1,18 @@
/*
Warnings:
- A unique constraint covering the columns `[runId,idempotencyKey]` on the table `WorkflowRunStep` will be added. If there are existing duplicate values, this will fail.
- Added the required column `idempotencyKey` to the `WorkflowRunStep` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE "WorkflowRunStep" ADD COLUMN "idempotencyKey" TEXT NULL;
-- Add random idempotency keys to existing rows
UPDATE "WorkflowRunStep" SET "idempotencyKey" = gen_random_uuid();
-- AlterTable
ALTER TABLE "WorkflowRunStep" ALTER COLUMN "idempotencyKey" SET NOT NULL;
-- CreateIndex
CREATE UNIQUE INDEX "WorkflowRunStep_runId_idempotencyKey_key" ON "WorkflowRunStep"("runId", "idempotencyKey");
@@ -0,0 +1,2 @@
-- AlterEnum
ALTER TYPE "WorkflowRunStatus" ADD VALUE 'INTERRUPTED';
@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "WorkflowRun" ADD COLUMN "attemptCount" INTEGER NOT NULL DEFAULT 0;
@@ -0,0 +1,2 @@
-- AlterEnum
ALTER TYPE "WorkflowRunStepType" ADD VALUE 'INTERRUPTION';
@@ -0,0 +1,3 @@
-- AlterEnum
ALTER TYPE "WorkflowRunStepType" ADD VALUE 'DISCONNECTION';
@@ -0,0 +1,17 @@
/*
Warnings:
- The values [INTERRUPTION] on the enum `WorkflowRunStepType` will be removed. If these variants are still used in the database, this will fail.
*/
UPDATE "WorkflowRunStep" SET "type" = 'DISCONNECTION' WHERE "type" = 'INTERRUPTION';
-- AlterEnum
BEGIN;
CREATE TYPE "WorkflowRunStepType_new" AS ENUM ('OUTPUT', 'LOG_MESSAGE', 'DURABLE_DELAY', 'CUSTOM_EVENT', 'INTEGRATION_REQUEST', 'DISCONNECTION');
ALTER TABLE "WorkflowRunStep" ALTER COLUMN "type" TYPE "WorkflowRunStepType_new" USING ("type"::text::"WorkflowRunStepType_new");
ALTER TYPE "WorkflowRunStepType" RENAME TO "WorkflowRunStepType_old";
ALTER TYPE "WorkflowRunStepType_new" RENAME TO "WorkflowRunStepType";
DROP TYPE "WorkflowRunStepType_old";
COMMIT;
@@ -0,0 +1,2 @@
-- AlterEnum
ALTER TYPE "WorkflowRunStatus" ADD VALUE 'DISCONNECTED';
@@ -0,0 +1,19 @@
/*
Warnings:
- The values [INTERRUPTED] on the enum `WorkflowRunStatus` will be removed. If these variants are still used in the database, this will fail.
*/
UPDATE "WorkflowRun" SET "status" = 'DISCONNECTED' WHERE "status" = 'INTERRUPTED';
-- AlterEnum
BEGIN;
CREATE TYPE "WorkflowRunStatus_new" AS ENUM ('PENDING', 'RUNNING', 'DISCONNECTED', 'SUCCESS', 'ERROR');
ALTER TABLE "WorkflowRun" ALTER COLUMN "status" DROP DEFAULT;
ALTER TABLE "WorkflowRun" ALTER COLUMN "status" TYPE "WorkflowRunStatus_new" USING ("status"::text::"WorkflowRunStatus_new");
ALTER TYPE "WorkflowRunStatus" RENAME TO "WorkflowRunStatus_old";
ALTER TYPE "WorkflowRunStatus_new" RENAME TO "WorkflowRunStatus";
DROP TYPE "WorkflowRunStatus_old";
ALTER TABLE "WorkflowRun" ALTER COLUMN "status" SET DEFAULT 'PENDING';
COMMIT;
@@ -0,0 +1,14 @@
/*
Warnings:
- Added the required column `timestamp` to the `WorkflowRunStep` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE "WorkflowRunStep" ADD COLUMN "ts" INTEGER NULL;
-- Add timestamps to existing steps based on the step createdAt (converting to unix timestamp since timestamp is an Integer)
UPDATE "WorkflowRunStep" SET ts = extract(epoch from "createdAt") * 1000;
-- Make timestamp required
ALTER TABLE "WorkflowRunStep" ALTER COLUMN "ts" SET NOT NULL;
@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "WorkflowRunStep" ALTER COLUMN "ts" SET DATA TYPE TEXT;
@@ -0,0 +1,8 @@
-- AlterTable
ALTER TABLE "IntegrationResponse" RENAME COLUMN "body" to "output";
ALTER TABLE "IntegrationResponse" ADD COLUMN "context" JSONB;
UPDATE "IntegrationResponse" SET context = jsonb_build_object('headers', headers, 'statusCode', '200');
ALTER TABLE "IntegrationResponse" ALTER COLUMN "context" SET NOT NULL;
ALTER TABLE "IntegrationResponse" DROP COLUMN "headers", DROP COLUMN "statusCode";
@@ -0,0 +1,2 @@
-- AlterEnum
ALTER TYPE "ExternalSourceType" ADD VALUE 'SCHEDULER';
@@ -0,0 +1,2 @@
-- AlterEnum
ALTER TYPE "ExternalSourceStatus" ADD VALUE 'CANCELLED';
@@ -0,0 +1,41 @@
/*
Warnings:
- The values [SCHEDULER] on the enum `ExternalSourceType` will be removed. If these variants are still used in the database, this will fail.
*/
-- CreateEnum
CREATE TYPE "SchedulerSourceStatus" AS ENUM ('CREATED', 'READY', 'CANCELLED');
-- AlterEnum
BEGIN;
CREATE TYPE "ExternalSourceType_new" AS ENUM ('WEBHOOK', 'EVENT_BRIDGE', 'HTTP_POLLING');
ALTER TABLE "ExternalSource" ALTER COLUMN "type" TYPE "ExternalSourceType_new" USING ("type"::text::"ExternalSourceType_new");
ALTER TYPE "ExternalSourceType" RENAME TO "ExternalSourceType_old";
ALTER TYPE "ExternalSourceType_new" RENAME TO "ExternalSourceType";
DROP TYPE "ExternalSourceType_old";
COMMIT;
-- CreateTable
CREATE TABLE "SchedulerSource" (
"id" TEXT NOT NULL,
"organizationId" TEXT NOT NULL,
"workflowId" TEXT NOT NULL,
"environmentId" TEXT NOT NULL,
"schedule" TEXT NOT NULL,
"status" "SchedulerSourceStatus" NOT NULL DEFAULT 'CREATED',
"readyAt" TIMESTAMP(3),
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "SchedulerSource_pkey" PRIMARY KEY ("id")
);
-- AddForeignKey
ALTER TABLE "SchedulerSource" ADD CONSTRAINT "SchedulerSource_organizationId_fkey" FOREIGN KEY ("organizationId") REFERENCES "Organization"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "SchedulerSource" ADD CONSTRAINT "SchedulerSource_workflowId_fkey" FOREIGN KEY ("workflowId") REFERENCES "Workflow"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "SchedulerSource" ADD CONSTRAINT "SchedulerSource_environmentId_fkey" FOREIGN KEY ("environmentId") REFERENCES "RuntimeEnvironment"("id") ON DELETE CASCADE ON UPDATE CASCADE;
@@ -0,0 +1,8 @@
/*
Warnings:
- A unique constraint covering the columns `[workflowId,environmentId]` on the table `SchedulerSource` will be added. If there are existing duplicate values, this will fail.
*/
-- CreateIndex
CREATE UNIQUE INDEX "SchedulerSource_workflowId_environmentId_key" ON "SchedulerSource"("workflowId", "environmentId");
@@ -0,0 +1,9 @@
/*
Warnings:
- Changed the type of `schedule` on the `SchedulerSource` table. No cast exists, the column would be dropped and recreated, which cannot be done if there is data, since the column is required.
*/
-- AlterTable
ALTER TABLE "SchedulerSource" DROP COLUMN "schedule",
ADD COLUMN "schedule" JSONB NOT NULL;
@@ -0,0 +1,14 @@
-- 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 "WorkflowStatus" ADD VALUE 'DISABLED';
ALTER TYPE "WorkflowStatus" ADD VALUE 'ARCHIVED';
-- AlterTable
ALTER TABLE "EventRule" ADD COLUMN "archivedAt" TIMESTAMP(3),
ADD COLUMN "disabledAt" TIMESTAMP(3);
@@ -0,0 +1,14 @@
/*
Warnings:
- You are about to drop the column `archivedAt` on the `EventRule` table. All the data in the column will be lost.
- You are about to drop the column `disabledAt` on the `EventRule` table. All the data in the column will be lost.
*/
-- AlterTable
ALTER TABLE "EventRule" DROP COLUMN "archivedAt",
DROP COLUMN "disabledAt";
-- AlterTable
ALTER TABLE "Workflow" ADD COLUMN "archivedAt" TIMESTAMP(3),
ADD COLUMN "disabledAt" TIMESTAMP(3);
@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "EventRule" ADD COLUMN "enabled" BOOLEAN NOT NULL DEFAULT true;
@@ -0,0 +1,19 @@
/*
Warnings:
- The values [ARCHIVED] on the enum `WorkflowStatus` will be removed. If these variants are still used in the database, this will fail.
*/
-- AlterEnum
BEGIN;
CREATE TYPE "WorkflowStatus_new" AS ENUM ('CREATED', 'READY', 'DISABLED');
ALTER TABLE "Workflow" ALTER COLUMN "status" DROP DEFAULT;
ALTER TABLE "Workflow" ALTER COLUMN "status" TYPE "WorkflowStatus_new" USING ("status"::text::"WorkflowStatus_new");
ALTER TYPE "WorkflowStatus" RENAME TO "WorkflowStatus_old";
ALTER TYPE "WorkflowStatus_new" RENAME TO "WorkflowStatus";
DROP TYPE "WorkflowStatus_old";
ALTER TABLE "Workflow" ALTER COLUMN "status" SET DEFAULT 'CREATED';
COMMIT;
-- AlterTable
ALTER TABLE "Workflow" ADD COLUMN "isArchived" BOOLEAN NOT NULL DEFAULT false;
@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "Workflow" ADD COLUMN "triggerTtlInSeconds" INTEGER NOT NULL DEFAULT 3600;
@@ -0,0 +1,2 @@
-- AlterEnum
ALTER TYPE "WorkflowRunStatus" ADD VALUE 'TIMED_OUT';
@@ -0,0 +1,3 @@
-- AlterTable
ALTER TABLE "WorkflowRun" ADD COLUMN "timedOutAt" TIMESTAMP(3),
ADD COLUMN "timedOutReason" TEXT;
@@ -0,0 +1,2 @@
-- AlterEnum
ALTER TYPE "WorkflowRunStepType" ADD VALUE 'FETCH_REQUEST';
@@ -0,0 +1,41 @@
-- CreateEnum
CREATE TYPE "FetchRequestStatus" AS ENUM ('PENDING', 'FETCHING', 'RETRYING', 'SUCCESS', 'ERROR');
-- CreateTable
CREATE TABLE "FetchRequest" (
"id" TEXT NOT NULL,
"fetch" JSONB NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
"status" "FetchRequestStatus" NOT NULL DEFAULT 'PENDING',
"runId" TEXT NOT NULL,
"stepId" TEXT NOT NULL,
"retryCount" INTEGER NOT NULL DEFAULT 0,
"error" JSONB,
"response" JSONB,
CONSTRAINT "FetchRequest_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "FetchResponse" (
"id" TEXT NOT NULL,
"requestId" TEXT NOT NULL,
"output" JSONB NOT NULL,
"context" JSONB NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT "FetchResponse_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE UNIQUE INDEX "FetchRequest_stepId_key" ON "FetchRequest"("stepId");
-- AddForeignKey
ALTER TABLE "FetchRequest" ADD CONSTRAINT "FetchRequest_runId_fkey" FOREIGN KEY ("runId") REFERENCES "WorkflowRun"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "FetchRequest" ADD CONSTRAINT "FetchRequest_stepId_fkey" FOREIGN KEY ("stepId") REFERENCES "WorkflowRunStep"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "FetchResponse" ADD CONSTRAINT "FetchResponse_requestId_fkey" FOREIGN KEY ("requestId") REFERENCES "FetchRequest"("id") ON DELETE CASCADE ON UPDATE CASCADE;
@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "FetchRequest" ADD COLUMN "retry" JSONB;
@@ -0,0 +1,8 @@
/*
Warnings:
- You are about to drop the column `retry` on the `FetchRequest` table. All the data in the column will be lost.
*/
-- AlterTable
ALTER TABLE "FetchRequest" DROP COLUMN "retry";
@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "ExternalSource" ADD COLUMN "manualRegistration" BOOLEAN NOT NULL DEFAULT false;
@@ -0,0 +1,2 @@
-- AlterEnum
ALTER TYPE "TriggerType" ADD VALUE 'SLACK_INTERACTION';
@@ -0,0 +1,33 @@
-- CreateEnum
CREATE TYPE "InternalSourceType" AS ENUM ('SLACK');
-- CreateEnum
CREATE TYPE "InternalSourceStatus" AS ENUM ('CREATED', 'READY', 'CANCELLED');
-- CreateTable
CREATE TABLE "InternalSource" (
"id" TEXT NOT NULL,
"organizationId" TEXT NOT NULL,
"workflowId" TEXT NOT NULL,
"environmentId" TEXT NOT NULL,
"type" "InternalSourceType" NOT NULL,
"source" JSONB NOT NULL,
"status" "InternalSourceStatus" NOT NULL DEFAULT 'CREATED',
"readyAt" TIMESTAMP(3),
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "InternalSource_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE UNIQUE INDEX "InternalSource_workflowId_environmentId_key" ON "InternalSource"("workflowId", "environmentId");
-- AddForeignKey
ALTER TABLE "InternalSource" ADD CONSTRAINT "InternalSource_organizationId_fkey" FOREIGN KEY ("organizationId") REFERENCES "Organization"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "InternalSource" ADD CONSTRAINT "InternalSource_workflowId_fkey" FOREIGN KEY ("workflowId") REFERENCES "Workflow"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "InternalSource" ADD CONSTRAINT "InternalSource_environmentId_fkey" FOREIGN KEY ("environmentId") REFERENCES "RuntimeEnvironment"("id") ON DELETE CASCADE ON UPDATE CASCADE;
@@ -0,0 +1,2 @@
-- AlterEnum
ALTER TYPE "WorkflowRunStepType" ADD VALUE 'RUN_ONCE';
@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "Workflow" ADD COLUMN "jsonSchema" JSONB;
@@ -0,0 +1,18 @@
-- CreateTable
CREATE TABLE "GitHubAppAuthorization" (
"id" TEXT NOT NULL,
"userId" TEXT NOT NULL,
"organizationId" TEXT NOT NULL,
"token" TEXT NOT NULL,
"tokenExpiresAt" TIMESTAMP(3) NOT NULL,
"refreshToken" TEXT NOT NULL,
"refreshTokenExpiresAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "GitHubAppAuthorization_pkey" PRIMARY KEY ("id")
);
-- AddForeignKey
ALTER TABLE "GitHubAppAuthorization" ADD CONSTRAINT "GitHubAppAuthorization_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "GitHubAppAuthorization" ADD CONSTRAINT "GitHubAppAuthorization_organizationId_fkey" FOREIGN KEY ("organizationId") REFERENCES "Organization"("id") ON DELETE CASCADE ON UPDATE CASCADE;
@@ -0,0 +1,5 @@
-- CreateEnum
CREATE TYPE "GitHubAppAuthorizationStatus" AS ENUM ('PENDING', 'AUTHORIZED');
-- AlterTable
ALTER TABLE "GitHubAppAuthorization" ADD COLUMN "status" "GitHubAppAuthorizationStatus" NOT NULL DEFAULT 'PENDING';
@@ -0,0 +1,20 @@
/*
Warnings:
- You are about to drop the column `status` on the `GitHubAppAuthorization` table. All the data in the column will be lost.
*/
-- AlterTable
ALTER TABLE "GitHubAppAuthorization" DROP COLUMN "status";
-- DropEnum
DROP TYPE "GitHubAppAuthorizationStatus";
-- CreateTable
CREATE TABLE "GitHubAppAuthorizationAttempt" (
"id" TEXT NOT NULL,
"userId" TEXT NOT NULL,
"organizationId" TEXT NOT NULL,
CONSTRAINT "GitHubAppAuthorizationAttempt_pkey" PRIMARY KEY ("id")
);
@@ -0,0 +1,25 @@
/*
Warnings:
- A unique constraint covering the columns `[installationId]` on the table `GitHubAppAuthorization` will be added. If there are existing duplicate values, this will fail.
- Added the required column `accessTokensUrls` to the `GitHubAppAuthorization` table without a default value. This is not possible if the table is not empty.
- Added the required column `account` to the `GitHubAppAuthorization` table without a default value. This is not possible if the table is not empty.
- Added the required column `htmlUrl` to the `GitHubAppAuthorization` table without a default value. This is not possible if the table is not empty.
- Added the required column `installationId` to the `GitHubAppAuthorization` table without a default value. This is not possible if the table is not empty.
- Added the required column `permissions` to the `GitHubAppAuthorization` table without a default value. This is not possible if the table is not empty.
- Added the required column `repositoriesUrl` to the `GitHubAppAuthorization` table without a default value. This is not possible if the table is not empty.
- Added the required column `repositorySelection` to the `GitHubAppAuthorization` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE "GitHubAppAuthorization" ADD COLUMN "accessTokensUrls" TEXT NOT NULL,
ADD COLUMN "account" JSONB NOT NULL,
ADD COLUMN "events" TEXT[],
ADD COLUMN "htmlUrl" TEXT NOT NULL,
ADD COLUMN "installationId" INTEGER NOT NULL,
ADD COLUMN "permissions" JSONB NOT NULL,
ADD COLUMN "repositoriesUrl" TEXT NOT NULL,
ADD COLUMN "repositorySelection" TEXT NOT NULL;
-- CreateIndex
CREATE UNIQUE INDEX "GitHubAppAuthorization_installationId_key" ON "GitHubAppAuthorization"("installationId");
@@ -0,0 +1,10 @@
/*
Warnings:
- You are about to drop the column `accessTokensUrls` on the `GitHubAppAuthorization` table. All the data in the column will be lost.
- Added the required column `accessTokensUrl` to the `GitHubAppAuthorization` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE "GitHubAppAuthorization" DROP COLUMN "accessTokensUrls",
ADD COLUMN "accessTokensUrl" TEXT NOT NULL;
@@ -0,0 +1,39 @@
-- CreateTable
CREATE TABLE "Template" (
"id" TEXT NOT NULL,
"slug" TEXT NOT NULL,
"name" TEXT NOT NULL,
"repositoryUrl" TEXT NOT NULL,
"priority" INTEGER NOT NULL DEFAULT 0,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "Template_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "OrganizationTemplate" (
"id" TEXT NOT NULL,
"organizationId" TEXT NOT NULL,
"templateId" TEXT NOT NULL,
"authorizationId" TEXT NOT NULL,
"name" TEXT NOT NULL,
"repositoryUrl" TEXT NOT NULL,
"private" BOOLEAN NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "OrganizationTemplate_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE UNIQUE INDEX "Template_slug_key" ON "Template"("slug");
-- AddForeignKey
ALTER TABLE "OrganizationTemplate" ADD CONSTRAINT "OrganizationTemplate_organizationId_fkey" FOREIGN KEY ("organizationId") REFERENCES "Organization"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "OrganizationTemplate" ADD CONSTRAINT "OrganizationTemplate_templateId_fkey" FOREIGN KEY ("templateId") REFERENCES "Template"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "OrganizationTemplate" ADD CONSTRAINT "OrganizationTemplate_authorizationId_fkey" FOREIGN KEY ("authorizationId") REFERENCES "GitHubAppAuthorization"("id") ON DELETE CASCADE ON UPDATE CASCADE;
@@ -0,0 +1,18 @@
/*
Warnings:
- You are about to drop the column `name` on the `Template` table. All the data in the column will be lost.
- Added the required column `description` to the `Template` table without a default value. This is not possible if the table is not empty.
- Added the required column `imageUrl` to the `Template` table without a default value. This is not possible if the table is not empty.
- Added the required column `shortTitle` to the `Template` table without a default value. This is not possible if the table is not empty.
- Added the required column `title` to the `Template` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE "Template" DROP COLUMN "name",
ADD COLUMN "description" TEXT NOT NULL,
ADD COLUMN "imageUrl" TEXT NOT NULL,
ADD COLUMN "services" TEXT[],
ADD COLUMN "shortTitle" TEXT NOT NULL,
ADD COLUMN "title" TEXT NOT NULL,
ADD COLUMN "workflowIds" TEXT[];
@@ -0,0 +1,8 @@
/*
Warnings:
- Added the required column `repositoryData` to the `OrganizationTemplate` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE "OrganizationTemplate" ADD COLUMN "repositoryData" JSONB NOT NULL;
@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "GitHubAppAuthorizationAttempt" ADD COLUMN "templateId" TEXT;
@@ -0,0 +1,12 @@
/*
Warnings:
- A unique constraint covering the columns `[repositoryId]` on the table `OrganizationTemplate` will be added. If there are existing duplicate values, this will fail.
- Added the required column `repositoryId` to the `OrganizationTemplate` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE "OrganizationTemplate" ADD COLUMN "repositoryId" INTEGER NOT NULL;
-- CreateIndex
CREATE UNIQUE INDEX "OrganizationTemplate_repositoryId_key" ON "OrganizationTemplate"("repositoryId");
@@ -0,0 +1,5 @@
-- CreateEnum
CREATE TYPE "OrganizationTemplateStatus" AS ENUM ('PENDING', 'CREATED', 'READY_TO_DEPLOY', 'DEPLOYED', 'READY_TO_TEST', 'READY_TO_RUN');
-- AlterTable
ALTER TABLE "OrganizationTemplate" ADD COLUMN "status" "OrganizationTemplateStatus" NOT NULL DEFAULT 'PENDING';
@@ -0,0 +1,4 @@
-- AlterTable
ALTER TABLE "Template" ADD COLUMN "markdownDocs" TEXT NOT NULL DEFAULT 'Documentation
This template does not have any documentation yet.';
@@ -0,0 +1,16 @@
/*
Warnings:
- The values [READY_TO_TEST,READY_TO_RUN] on the enum `OrganizationTemplateStatus` will be removed. If these variants are still used in the database, this will fail.
*/
-- AlterEnum
BEGIN;
CREATE TYPE "OrganizationTemplateStatus_new" AS ENUM ('PENDING', 'CREATED', 'READY_TO_DEPLOY', 'DEPLOYED');
ALTER TABLE "OrganizationTemplate" ALTER COLUMN "status" DROP DEFAULT;
ALTER TABLE "OrganizationTemplate" ALTER COLUMN "status" TYPE "OrganizationTemplateStatus_new" USING ("status"::text::"OrganizationTemplateStatus_new");
ALTER TYPE "OrganizationTemplateStatus" RENAME TO "OrganizationTemplateStatus_old";
ALTER TYPE "OrganizationTemplateStatus_new" RENAME TO "OrganizationTemplateStatus";
DROP TYPE "OrganizationTemplateStatus_old";
ALTER TABLE "OrganizationTemplate" ALTER COLUMN "status" SET DEFAULT 'PENDING';
COMMIT;
@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "IntegrationRequest" ADD COLUMN "version" TEXT NOT NULL DEFAULT '1';
@@ -0,0 +1,4 @@
-- AlterTable
ALTER TABLE "Template" ADD COLUMN "runLocalDocs" TEXT NOT NULL DEFAULT 'Documentation
This template does not have any documentation yet.';
@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "WorkflowRunStep" ADD COLUMN "displayProperties" JSONB;
@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "User" ADD COLUMN "isOnCloudWaitlist" BOOLEAN NOT NULL DEFAULT false;

Some files were not shown because too many files have changed in this diff Show More