Files
sap-intercompany-worker/prisma/migrations/20260818223337_init/migration.sql
T

31 lines
1.0 KiB
SQL
Raw Normal View History

2026-09-16 07:45:57 -05:00
-- CreateEnum
CREATE TYPE "EventStatus" AS ENUM ('pending', 'processing', 'done', 'partial', 'failed');
-- CreateTable
CREATE TABLE "webhook_events" (
"id" TEXT NOT NULL,
"business_object" TEXT NOT NULL,
"operation" TEXT NOT NULL,
"subject" TEXT NOT NULL,
"payload" JSONB NOT NULL,
"received_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"status" "EventStatus" NOT NULL DEFAULT 'pending',
CONSTRAINT "webhook_events_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "replication_attempts" (
"id" SERIAL NOT NULL,
"event_id" TEXT NOT NULL,
"subsidiary" TEXT NOT NULL,
"verb_used" TEXT NOT NULL,
"http_status" INTEGER,
"error_message" TEXT,
"attempted_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT "replication_attempts_pkey" PRIMARY KEY ("id")
);
-- AddForeignKey
ALTER TABLE "replication_attempts" ADD CONSTRAINT "replication_attempts_event_id_fkey" FOREIGN KEY ("event_id") REFERENCES "webhook_events"("id") ON DELETE RESTRICT ON UPDATE CASCADE;