diff --git a/prisma/migrations/20260217000000_schema_reconciliation/migration.sql b/prisma/migrations/20260217000000_schema_reconciliation/migration.sql new file mode 100644 index 0000000..ba7e68f --- /dev/null +++ b/prisma/migrations/20260217000000_schema_reconciliation/migration.sql @@ -0,0 +1,19 @@ +-- ============================================================================= +-- Schema Reconciliation: Fill remaining gaps between migrations and schema.prisma +-- ============================================================================= +-- All statements are idempotent (safe to re-run on any database state). + +-- 1. ConflictOfInterest: add standalone hasConflict index (schema has @@index([hasConflict])) +-- Migration 20260205223133 only created composite (roundId, hasConflict) index. +CREATE INDEX IF NOT EXISTS "ConflictOfInterest_hasConflict_idx" ON "ConflictOfInterest"("hasConflict"); + +-- 2. Ensure ConflictOfInterest.roundId is nullable (schema says String?) +-- Pipeline migration (20260213) makes it nullable, but guard for safety. +DO $$ BEGIN + ALTER TABLE "ConflictOfInterest" ALTER COLUMN "roundId" DROP NOT NULL; +EXCEPTION WHEN others THEN NULL; +END $$; + +-- 3. Drop stale composite index that no longer matches schema +-- Schema only has @@index([hasConflict]) and @@index([userId]), not (roundId, hasConflict). +DROP INDEX IF EXISTS "ConflictOfInterest_roundId_hasConflict_idx"; diff --git a/src/app/(admin)/admin/projects/bulk-upload/page.tsx b/src/app/(admin)/admin/projects/bulk-upload/page.tsx index b411e8d..e7821a4 100644 --- a/src/app/(admin)/admin/projects/bulk-upload/page.tsx +++ b/src/app/(admin)/admin/projects/bulk-upload/page.tsx @@ -47,6 +47,7 @@ import { FileUp, AlertCircle, ExternalLink, + Trash2, } from 'lucide-react' import { cn, formatFileSize } from '@/lib/utils' import { Pagination } from '@/components/shared/pagination' @@ -155,6 +156,26 @@ export default function BulkUploadPage() { [utils, refetch] ) + // Delete a file + const deleteMutation = trpc.file.delete.useMutation({ + onSuccess: () => { + toast.success('File removed') + refetch() + }, + onError: (err) => { + toast.error(`Failed to remove file: ${err.message}`) + }, + }) + + const handleDeleteFile = useCallback( + (fileId: string) => { + if (confirm('Remove this uploaded file?')) { + deleteMutation.mutate({ id: fileId }) + } + }, + [deleteMutation] + ) + const uploadMutation = trpc.file.adminUploadForRoundRequirement.useMutation() // Upload a single file for a project requirement @@ -513,7 +534,20 @@ export default function BulkUploadPage() { ) : req.file || uploadState?.status === 'complete' ? (
- +
+ + {req.file && ( + + )} +
{req.file?.bucket && req.file?.objectKey ? (