Files
recipe-app/backend/prisma/migrations/20260521171000_add_ai_trace/migration.sql
T
Nils-Johan Gynther 67a7590525
Test Suite / backend-pr-quick (push) Has been skipped
Test Suite / quick-import-pr-quick (push) Has been skipped
Test Suite / backend-full (push) Successful in 12m45s
Test Suite / flutter-quality (push) Failing after 7m24s
feat(ai): add AI trace tracking and admin panel
- Add AiTrace model to Prisma schema with relations to User
- Implement AiTraceService with CRUD operations for AI traces
- Add new admin panel for AI traces with filtering and detail views
- Integrate trace persistence in receipt import flow
- Add API endpoints for listing and retrieving AI traces
- Update Flutter admin UI with new AI tab and navigation
- Add new domain models for AI traces and details
- Add migration for AiTrace table creation

BREAKING CHANGE: None
2026-05-21 17:33:21 +02:00

25 lines
901 B
SQL

-- CreateTable
CREATE TABLE `AiTrace` (
`id` INTEGER NOT NULL AUTO_INCREMENT,
`source` VARCHAR(191) NOT NULL,
`userId` INTEGER NULL,
`sessionId` INTEGER NULL,
`model` VARCHAR(191) NULL,
`prompt` LONGTEXT NULL,
`rawOutput` LONGTEXT NULL,
`normalizedOutput` JSON NULL,
`status` VARCHAR(191) NOT NULL,
`error` TEXT NULL,
`durationMs` INTEGER NULL,
`createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
`updatedAt` DATETIME(3) NOT NULL,
INDEX `AiTrace_source_createdAt_idx`(`source`, `createdAt`),
INDEX `AiTrace_userId_createdAt_idx`(`userId`, `createdAt`),
INDEX `AiTrace_status_createdAt_idx`(`status`, `createdAt`),
PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- AddForeignKey
ALTER TABLE `AiTrace` ADD CONSTRAINT `AiTrace_userId_fkey` FOREIGN KEY (`userId`) REFERENCES `User`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;