feat: new importer (#214)

This commit is contained in:
Carl-Gerhard Lindesvärd
2025-11-05 09:49:36 +01:00
committed by GitHub
parent b51bc8f3f6
commit 212254d31a
80 changed files with 4884 additions and 842 deletions

View File

@@ -0,0 +1,22 @@
-- CreateTable
CREATE TABLE "public"."imports" (
"id" UUID NOT NULL DEFAULT gen_random_uuid(),
"projectId" TEXT NOT NULL,
"provider" TEXT NOT NULL,
"sourceType" TEXT NOT NULL,
"sourceLocation" TEXT NOT NULL,
"jobId" TEXT,
"status" TEXT NOT NULL,
"config" JSONB NOT NULL DEFAULT '{}',
"totalEvents" INTEGER NOT NULL DEFAULT 0,
"processedEvents" INTEGER NOT NULL DEFAULT 0,
"errorMessage" TEXT,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"completedAt" TIMESTAMP(3),
"updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT "imports_pkey" PRIMARY KEY ("id")
);
-- AddForeignKey
ALTER TABLE "public"."imports" ADD CONSTRAINT "imports_projectId_fkey" FOREIGN KEY ("projectId") REFERENCES "public"."projects"("id") ON DELETE CASCADE ON UPDATE CASCADE;

View File

@@ -0,0 +1,13 @@
/*
Warnings:
- You are about to drop the column `provider` on the `imports` table. All the data in the column will be lost.
- You are about to drop the column `sourceLocation` on the `imports` table. All the data in the column will be lost.
- You are about to drop the column `sourceType` on the `imports` table. All the data in the column will be lost.
*/
-- AlterTable
ALTER TABLE "public"."imports" DROP COLUMN "provider",
DROP COLUMN "sourceLocation",
DROP COLUMN "sourceType",
ALTER COLUMN "config" DROP DEFAULT;

View File

@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "public"."imports" ADD COLUMN "statusMessage" TEXT;

View File

@@ -0,0 +1,3 @@
-- AlterTable
ALTER TABLE "public"."imports" ADD COLUMN "currentBatch" INTEGER NOT NULL DEFAULT 0,
ADD COLUMN "currentStep" TEXT;

View File

@@ -0,0 +1,14 @@
/*
Warnings:
- Changed the type of `status` on the `imports` table. No cast exists, the column would be dropped and recreated, which cannot be done if there is data, since the column is required.
- Made the column `currentStep` on table `imports` required. This step will fail if there are existing NULL values in that column.
*/
-- CreateEnum
CREATE TYPE "public"."ImportStatus" AS ENUM ('pending', 'processing', 'completed', 'failed');
-- AlterTable
ALTER TABLE "public"."imports" DROP COLUMN "status",
ADD COLUMN "status" "public"."ImportStatus" NOT NULL,
ALTER COLUMN "currentStep" SET NOT NULL;

View File

@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "public"."imports" ALTER COLUMN "currentStep" DROP NOT NULL;

View File

@@ -0,0 +1,4 @@
-- AlterTable
ALTER TABLE "public"."imports" ALTER COLUMN "currentBatch" DROP NOT NULL,
ALTER COLUMN "currentBatch" DROP DEFAULT,
ALTER COLUMN "currentBatch" SET DATA TYPE TEXT;