From 00ff1b21dc73f9cbcd1b0ed9273bcfa768eb7ceb Mon Sep 17 00:00:00 2001 From: Matt Aitken Date: Mon, 23 Jun 2025 15:14:11 +0100 Subject: [PATCH] BulkActionGroup changed some columns around --- .../migration.sql | 18 +++++++++++++++ .../database/prisma/schema.prisma | 22 ++++++++++++------- 2 files changed, 32 insertions(+), 8 deletions(-) create mode 100644 internal-packages/database/prisma/migrations/20250623141255_bulk_action_group_counts_completed_at/migration.sql diff --git a/internal-packages/database/prisma/migrations/20250623141255_bulk_action_group_counts_completed_at/migration.sql b/internal-packages/database/prisma/migrations/20250623141255_bulk_action_group_counts_completed_at/migration.sql new file mode 100644 index 000000000..35287c3bf --- /dev/null +++ b/internal-packages/database/prisma/migrations/20250623141255_bulk_action_group_counts_completed_at/migration.sql @@ -0,0 +1,18 @@ +/* +Warnings: + +- You are about to drop the column `processedCount` on the `BulkActionGroup` table. All the data in the column will be lost. +- You are about to drop the column `reason` on the `BulkActionGroup` table. All the data in the column will be lost. + + */ +-- AlterEnum +ALTER TYPE "BulkActionStatus" ADD VALUE 'ABORTED'; + +-- AlterTable +ALTER TABLE "BulkActionGroup" +DROP COLUMN "processedCount", +DROP COLUMN "reason", +ADD COLUMN "completedAt" TIMESTAMP(3), +ADD COLUMN "failureCount" INTEGER NOT NULL DEFAULT 0, +ADD COLUMN "name" TEXT, +ADD COLUMN "successCount" INTEGER NOT NULL DEFAULT 0; \ No newline at end of file diff --git a/internal-packages/database/prisma/schema.prisma b/internal-packages/database/prisma/schema.prisma index bc7f1d1b9..34ef1a500 100644 --- a/internal-packages/database/prisma/schema.prisma +++ b/internal-packages/database/prisma/schema.prisma @@ -1928,22 +1928,27 @@ model BulkActionGroup { status BulkActionStatus @default(PENDING) /// The query that will be executed to get the runs to process (if null, we are passing run ids directly) - queryName String? + queryName String? /// The params that will be passed to the query - params Json? + params Json? /// The cursor that will be passed to the query (null for the first page) - cursor Json? - /// The number of runs that have been processed - processedCount Int @default(0) + cursor Json? + /// The number of runs that have been processed successfully + successCount Int @default(0) + /// The number of runs that have been failed + failureCount Int @default(0) /// The total number of runs that will be processed - totalCount Int @default(0) + totalCount Int @default(0) /// The userId who did the bulk action user User? @relation(fields: [userId], references: [id], onDelete: SetNull, onUpdate: Cascade) userId String? - /// Why the user did the bulk action - reason String? + /// The name of the bulk action + name String? + + /// The time the bulk action was completed + completedAt DateTime? createdAt DateTime @default(now()) updatedAt DateTime @updatedAt @@ -1961,6 +1966,7 @@ enum BulkActionType { enum BulkActionStatus { PENDING COMPLETED + ABORTED } model BulkActionItem {