67a7590525
- 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
25 lines
901 B
SQL
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;
|