Protokoll #32266

ID32266
Zeitstempel2026-01-02 03:27:20.113066
Clientroot
IP145.224.72.245
Modellclaude-sonnet-4-20250514
Statuscompleted
Tokens7,129 (Input: 1,534, Output: 5,595)
Dauer94 ms
Request-Zeit2026-01-02 03:27:20.113066
Response-Zeit2026-01-02 03:27:20.207346

Request

{
    "event": "PreToolUse",
    "tool_name": "Edit",
    "tool_input": {
        "file_path": "\/var\/www\/migration\/content-pipeline\/sql\/schema.sql",
        "old_string": "-- Default pipeline steps\nINSERT INTO `pipeline_steps` (`pipeline_id`, `step_type`, `sort_order`, `enabled`) VALUES\n(1, 'detect', 10, 1),\n(1, 'extract', 20, 1),\n(1, 'chunk', 30, 1),\n(1, 'embed', 40, 1),\n(1, 'entity_extract', 50, 1),\n(1, 'semantic_analyze', 60, 1);",
        "new_string": "-- Default pipeline steps\nINSERT INTO `pipeline_steps` (`pipeline_id`, `step_type`, `sort_order`, `enabled`) VALUES\n(1, 'detect', 10, 1),\n(1, 'extract', 20, 1),\n(1, 'chunk', 30, 1),\n(1, 'embed', 40, 1),\n(1, 'entity_extract', 50, 1),\n(1, 'semantic_analyze', 60, 1);\n\n-- =====================================================\n-- ADDITIONAL TABLES (Logging, Content Generation)\n-- =====================================================\n\nCREATE TABLE `pipeline_log` (\n  `id` int(11) NOT NULL AUTO_INCREMENT,\n  `pipeline_id` int(11) DEFAULT NULL,\n  `run_id` int(11) DEFAULT NULL,\n  `level` enum('DEBUG','INFO','WARNING','ERROR') DEFAULT 'INFO',\n  `message` text NOT NULL,\n  `context` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`context`)),\n  `created_at` datetime DEFAULT current_timestamp(),\n  PRIMARY KEY (`id`),\n  KEY `idx_run` (`run_id`),\n  KEY `idx_level` (`level`),\n  KEY `idx_created` (`created_at`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;\n\nCREATE TABLE `protokoll` (\n  `id` int(11) NOT NULL AUTO_INCREMENT,\n  `session_id` varchar(100) DEFAULT NULL,\n  `provider` varchar(50) NOT NULL COMMENT 'ollama, anthropic, openai',\n  `model` varchar(100) NOT NULL,\n  `prompt` longtext DEFAULT NULL,\n  `response` longtext DEFAULT NULL,\n  `tokens_input` int(11) DEFAULT 0,\n  `tokens_output` int(11) DEFAULT 0,\n  `duration_ms` int(11) DEFAULT NULL,\n  `cost_usd` decimal(10,6) DEFAULT NULL,\n  `status` enum('success','error') DEFAULT 'success',\n  `error_message` text DEFAULT NULL,\n  `context` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`context`)),\n  `created_at` datetime DEFAULT current_timestamp(),\n  PRIMARY KEY (`id`),\n  KEY `idx_session` (`session_id`),\n  KEY `idx_provider` (`provider`),\n  KEY `idx_model` (`model`),\n  KEY `idx_created` (`created_at`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='LLM call logging';\n\nCREATE TABLE `document_sections` (\n  `id` int(11) NOT NULL AUTO_INCREMENT,\n  `document_id` int(11) NOT NULL,\n  `parent_section_id` int(11) DEFAULT NULL,\n  `title` varchar(500) DEFAULT NULL,\n  `level` int(11) DEFAULT 1,\n  `start_page` int(11) DEFAULT NULL,\n  `end_page` int(11) DEFAULT NULL,\n  `content` text DEFAULT NULL,\n  `created_at` datetime DEFAULT current_timestamp(),\n  PRIMARY KEY (`id`),\n  KEY `idx_document` (`document_id`),\n  KEY `idx_parent` (`parent_section_id`),\n  CONSTRAINT `document_sections_ibfk_1` FOREIGN KEY (`document_id`) REFERENCES `documents` (`id`),\n  CONSTRAINT `document_sections_ibfk_2` FOREIGN KEY (`parent_section_id`) REFERENCES `document_sections` (`id`) ON DELETE SET NULL\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;\n\nCREATE TABLE `content_config` (\n  `id` int(11) NOT NULL AUTO_INCREMENT,\n  `name` varchar(100) NOT NULL,\n  `type` enum('profile','prompt','critic') NOT NULL,\n  `config` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`config`)),\n  `description` text DEFAULT NULL,\n  `is_active` tinyint(1) DEFAULT 1,\n  `created_at` datetime DEFAULT current_timestamp(),\n  `updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),\n  PRIMARY KEY (`id`),\n  UNIQUE KEY `unique_name_type` (`name`,`type`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Content generation configuration';\n\nCREATE TABLE `content_orders` (\n  `id` int(11) NOT NULL AUTO_INCREMENT,\n  `title` varchar(255) NOT NULL,\n  `briefing` text DEFAULT NULL,\n  `profile_id` int(11) DEFAULT NULL,\n  `status` enum('draft','generating','critique','revision','validate','approved','published') DEFAULT 'draft',\n  `model` varchar(100) DEFAULT NULL,\n  `current_version_id` int(11) DEFAULT NULL,\n  `collections` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`collections`)),\n  `context_limit` int(11) DEFAULT 5,\n  `log` text DEFAULT NULL,\n  `current_step` varchar(50) DEFAULT NULL,\n  `created_at` datetime DEFAULT current_timestamp(),\n  `updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),\n  PRIMARY KEY (`id`),\n  KEY `idx_status` (`status`),\n  KEY `idx_profile` (`profile_id`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Content generation orders';\n\nCREATE TABLE `content_versions` (\n  `id` int(11) NOT NULL AUTO_INCREMENT,\n  `order_id` int(11) NOT NULL,\n  `version_number` int(11) NOT NULL DEFAULT 1,\n  `content` longtext DEFAULT NULL,\n  `model` varchar(100) DEFAULT NULL,\n  `tokens_input` int(11) DEFAULT 0,\n  `tokens_output` int(11) DEFAULT 0,\n  `duration_ms` int(11) DEFAULT NULL,\n  `created_at` datetime DEFAULT current_timestamp(),\n  PRIMARY KEY (`id`),\n  KEY `idx_order` (`order_id`),\n  CONSTRAINT `content_versions_ibfk_1` FOREIGN KEY (`order_id`) REFERENCES `content_orders` (`id`) ON DELETE CASCADE\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;\n\nCREATE TABLE `content_critiques` (\n  `id` int(11) NOT NULL AUTO_INCREMENT,\n  `version_id` int(11) NOT NULL,\n  `critic_config_id` int(11) DEFAULT NULL,\n  `critique` longtext DEFAULT NULL,\n  `score` int(11) DEFAULT NULL,\n  `passed` tinyint(1) DEFAULT 0,\n  `model` varchar(100) DEFAULT NULL,\n  `tokens_input` int(11) DEFAULT 0,\n  `tokens_output` int(11) DEFAULT 0,\n  `created_at` datetime DEFAULT current_timestamp(),\n  PRIMARY KEY (`id`),\n  KEY `idx_version` (`version_id`),\n  CONSTRAINT `content_critiques_ibfk_1` FOREIGN KEY (`version_id`) REFERENCES `content_versions` (`id`) ON DELETE CASCADE\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;"
    }
}

Response

{
    "tool_response": {
        "filePath": "\/var\/www\/migration\/content-pipeline\/sql\/schema.sql",
        "oldString": "-- Default pipeline steps\nINSERT INTO `pipeline_steps` (`pipeline_id`, `step_type`, `sort_order`, `enabled`) VALUES\n(1, 'detect', 10, 1),\n(1, 'extract', 20, 1),\n(1, 'chunk', 30, 1),\n(1, 'embed', 40, 1),\n(1, 'entity_extract', 50, 1),\n(1, 'semantic_analyze', 60, 1);",
        "newString": "-- Default pipeline steps\nINSERT INTO `pipeline_steps` (`pipeline_id`, `step_type`, `sort_order`, `enabled`) VALUES\n(1, 'detect', 10, 1),\n(1, 'extract', 20, 1),\n(1, 'chunk', 30, 1),\n(1, 'embed', 40, 1),\n(1, 'entity_extract', 50, 1),\n(1, 'semantic_analyze', 60, 1);\n\n-- =====================================================\n-- ADDITIONAL TABLES (Logging, Content Generation)\n-- =====================================================\n\nCREATE TABLE `pipeline_log` (\n  `id` int(11) NOT NULL AUTO_INCREMENT,\n  `pipeline_id` int(11) DEFAULT NULL,\n  `run_id` int(11) DEFAULT NULL,\n  `level` enum('DEBUG','INFO','WARNING','ERROR') DEFAULT 'INFO',\n  `message` text NOT NULL,\n  `context` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`context`)),\n  `created_at` datetime DEFAULT current_timestamp(),\n  PRIMARY KEY (`id`),\n  KEY `idx_run` (`run_id`),\n  KEY `idx_level` (`level`),\n  KEY `idx_created` (`created_at`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;\n\nCREATE TABLE `protokoll` (\n  `id` int(11) NOT NULL AUTO_INCREMENT,\n  `session_id` varchar(100) DEFAULT NULL,\n  `provider` varchar(50) NOT NULL COMMENT 'ollama, anthropic, openai',\n  `model` varchar(100) NOT NULL,\n  `prompt` longtext DEFAULT NULL,\n  `response` longtext DEFAULT NULL,\n  `tokens_input` int(11) DEFAULT 0,\n  `tokens_output` int(11) DEFAULT 0,\n  `duration_ms` int(11) DEFAULT NULL,\n  `cost_usd` decimal(10,6) DEFAULT NULL,\n  `status` enum('success','error') DEFAULT 'success',\n  `error_message` text DEFAULT NULL,\n  `context` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`context`)),\n  `created_at` datetime DEFAULT current_timestamp(),\n  PRIMARY KEY (`id`),\n  KEY `idx_session` (`session_id`),\n  KEY `idx_provider` (`provider`),\n  KEY `idx_model` (`model`),\n  KEY `idx_created` (`created_at`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='LLM call logging';\n\nCREATE TABLE `document_sections` (\n  `id` int(11) NOT NULL AUTO_INCREMENT,\n  `document_id` int(11) NOT NULL,\n  `parent_section_id` int(11) DEFAULT NULL,\n  `title` varchar(500) DEFAULT NULL,\n  `level` int(11) DEFAULT 1,\n  `start_page` int(11) DEFAULT NULL,\n  `end_page` int(11) DEFAULT NULL,\n  `content` text DEFAULT NULL,\n  `created_at` datetime DEFAULT current_timestamp(),\n  PRIMARY KEY (`id`),\n  KEY `idx_document` (`document_id`),\n  KEY `idx_parent` (`parent_section_id`),\n  CONSTRAINT `document_sections_ibfk_1` FOREIGN KEY (`document_id`) REFERENCES `documents` (`id`),\n  CONSTRAINT `document_sections_ibfk_2` FOREIGN KEY (`parent_section_id`) REFERENCES `document_sections` (`id`) ON DELETE SET NULL\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;\n\nCREATE TABLE `content_config` (\n  `id` int(11) NOT NULL AUTO_INCREMENT,\n  `name` varchar(100) NOT NULL,\n  `type` enum('profile','prompt','critic') NOT NULL,\n  `config` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`config`)),\n  `description` text DEFAULT NULL,\n  `is_active` tinyint(1) DEFAULT 1,\n  `created_at` datetime DEFAULT current_timestamp(),\n  `updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),\n  PRIMARY KEY (`id`),\n  UNIQUE KEY `unique_name_type` (`name`,`type`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Content generation configuration';\n\nCREATE TABLE `content_orders` (\n  `id` int(11) NOT NULL AUTO_INCREMENT,\n  `title` varchar(255) NOT NULL,\n  `briefing` text DEFAULT NULL,\n  `profile_id` int(11) DEFAULT NULL,\n  `status` enum('draft','generating','critique','revision','validate','approved','published') DEFAULT 'draft',\n  `model` varchar(100) DEFAULT NULL,\n  `current_version_id` int(11) DEFAULT NULL,\n  `collections` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`collections`)),\n  `context_limit` int(11) DEFAULT 5,\n  `log` text DEFAULT NULL,\n  `current_step` varchar(50) DEFAULT NULL,\n  `created_at` datetime DEFAULT current_timestamp(),\n  `updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),\n  PRIMARY KEY (`id`),\n  KEY `idx_status` (`status`),\n  KEY `idx_profile` (`profile_id`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Content generation orders';\n\nCREATE TABLE `content_versions` (\n  `id` int(11) NOT NULL AUTO_INCREMENT,\n  `order_id` int(11) NOT NULL,\n  `version_number` int(11) NOT NULL DEFAULT 1,\n  `content` longtext DEFAULT NULL,\n  `model` varchar(100) DEFAULT NULL,\n  `tokens_input` int(11) DEFAULT 0,\n  `tokens_output` int(11) DEFAULT 0,\n  `duration_ms` int(11) DEFAULT NULL,\n  `created_at` datetime DEFAULT current_timestamp(),\n  PRIMARY KEY (`id`),\n  KEY `idx_order` (`order_id`),\n  CONSTRAINT `content_versions_ibfk_1` FOREIGN KEY (`order_id`) REFERENCES `content_orders` (`id`) ON DELETE CASCADE\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;\n\nCREATE TABLE `content_critiques` (\n  `id` int(11) NOT NULL AUTO_INCREMENT,\n  `version_id` int(11) NOT NULL,\n  `critic_config_id` int(11) DEFAULT NULL,\n  `critique` longtext DEFAULT NULL,\n  `score` int(11) DEFAULT NULL,\n  `passed` tinyint(1) DEFAULT 0,\n  `model` varchar(100) DEFAULT NULL,\n  `tokens_input` int(11) DEFAULT 0,\n  `tokens_output` int(11) DEFAULT 0,\n  `created_at` datetime DEFAULT current_timestamp(),\n  PRIMARY KEY (`id`),\n  KEY `idx_version` (`version_id`),\n  CONSTRAINT `content_critiques_ibfk_1` FOREIGN KEY (`version_id`) REFERENCES `content_versions` (`id`) ON DELETE CASCADE\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;",
        "originalFile": "-- =====================================================\n-- Content Pipeline Database Schema\n-- Generated for migration\/portability\n-- =====================================================\n--\n-- PLACEHOLDER: Replace {{DATABASE_NAME}} with your database name\n-- Default: ki_content\n--\n-- Required: MariaDB 10.5+ or MySQL 8.0+\n-- =====================================================\n\nSET NAMES utf8mb4;\nSET FOREIGN_KEY_CHECKS = 0;\n\n-- =====================================================\n-- CORE DOCUMENT TABLES\n-- =====================================================\n\nCREATE TABLE `documents` (\n  `id` int(11) NOT NULL AUTO_INCREMENT,\n  `source_path` varchar(500) NOT NULL,\n  `folder_path` varchar(500) DEFAULT NULL,\n  `filename` varchar(255) NOT NULL,\n  `mime_type` varchar(100) DEFAULT NULL,\n  `file_hash` varchar(64) DEFAULT NULL,\n  `file_size` int(11) DEFAULT NULL,\n  `language` varchar(10) DEFAULT 'de',\n  `imported_at` datetime DEFAULT current_timestamp(),\n  `processed_at` datetime DEFAULT NULL,\n  `status` enum('pending','importing','imported','chunking','chunked','embedding','embedded','enriching','enriched','processing','done','error') DEFAULT 'pending',\n  `semantic_status` enum('pending','processing','partial','complete','error','skipped') DEFAULT 'pending',\n  `error_message` text DEFAULT NULL,\n  `authority_score` float DEFAULT 0.5,\n  PRIMARY KEY (`id`),\n  UNIQUE KEY `idx_source_path` (`source_path`),\n  KEY `idx_status` (`status`),\n  KEY `idx_hash` (`file_hash`),\n  KEY `idx_folder` (`folder_path`),\n  KEY `idx_semantic_status` (`semantic_status`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;\n\nCREATE TABLE `document_pages` (\n  `id` int(11) NOT NULL AUTO_INCREMENT,\n  `document_id` int(11) NOT NULL,\n  `page_number` int(11) NOT NULL,\n  `image_path` varchar(500) DEFAULT NULL COMMENT 'Path to page image (PNG)',\n  `text_content` text DEFAULT NULL COMMENT 'Extracted text of page',\n  `vision_analysis` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT 'Vision model analysis (images, charts, etc.)' CHECK (json_valid(`vision_analysis`)),\n  `ocr_applied` tinyint(1) DEFAULT 0,\n  `token_count` int(11) DEFAULT NULL,\n  `created_at` datetime DEFAULT current_timestamp(),\n  PRIMARY KEY (`id`),\n  UNIQUE KEY `uk_doc_page` (`document_id`,`page_number`),\n  KEY `idx_document` (`document_id`),\n  CONSTRAINT `document_pages_ibfk_1` FOREIGN KEY (`document_id`) REFERENCES `documents` (`id`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Individual pages of a document';\n\n-- =====================================================\n-- CHUNK TABLES\n-- =====================================================\n\nCREATE TABLE `chunks` (\n  `id` int(11) NOT NULL AUTO_INCREMENT,\n  `document_id` int(11) NOT NULL,\n  `page_id` int(11) DEFAULT NULL,\n  `chunk_index` int(11) NOT NULL,\n  `content` text NOT NULL,\n  `token_count` int(11) DEFAULT NULL,\n  `heading_path` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`heading_path`)),\n  `metadata` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`metadata`)),\n  `qdrant_id` varchar(36) DEFAULT NULL,\n  `status` enum('created','embedding','embedded','error','deprecated') DEFAULT 'created',\n  `created_at` datetime DEFAULT current_timestamp(),\n  `section_id` int(11) DEFAULT NULL,\n  PRIMARY KEY (`id`),\n  KEY `idx_document` (`document_id`),\n  KEY `idx_qdrant` (`qdrant_id`),\n  KEY `idx_status` (`status`),\n  KEY `idx_doc_order` (`document_id`,`chunk_index`),\n  KEY `idx_page` (`page_id`),\n  FULLTEXT KEY `idx_content` (`content`),\n  CONSTRAINT `chunks_ibfk_1` FOREIGN KEY (`document_id`) REFERENCES `documents` (`id`),\n  CONSTRAINT `chunks_page_fk` FOREIGN KEY (`page_id`) REFERENCES `document_pages` (`id`) ON DELETE SET NULL\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;\n\nCREATE TABLE `chunk_semantics` (\n  `id` int(11) NOT NULL AUTO_INCREMENT,\n  `chunk_id` int(11) NOT NULL,\n  `summary` text DEFAULT NULL,\n  `keywords` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`keywords`)),\n  `sentiment` enum('positive','negative','neutral','mixed') DEFAULT 'neutral',\n  `topics` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`topics`)),\n  `language` varchar(10) DEFAULT 'de',\n  `statement_form` enum('assertion','question','command','conditional') DEFAULT NULL,\n  `intent` enum('explain','argue','define','compare','exemplify','warn','instruct') DEFAULT NULL,\n  `frame` enum('theoretical','practical','historical','methodological','critical') DEFAULT NULL,\n  `is_negated` tinyint(1) DEFAULT 0,\n  `discourse_role` enum('thesis','evidence','example','counter','summary','definition') DEFAULT NULL,\n  `analyzed_at` datetime DEFAULT NULL,\n  `analysis_model` varchar(100) DEFAULT NULL,\n  `prompt_id` int(11) DEFAULT NULL,\n  `prompt_version` varchar(20) DEFAULT NULL,\n  PRIMARY KEY (`id`),\n  UNIQUE KEY `chunk_id` (`chunk_id`),\n  CONSTRAINT `chunk_semantics_ibfk_1` FOREIGN KEY (`chunk_id`) REFERENCES `chunks` (`id`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;\n\nCREATE TABLE `chunk_entities` (\n  `id` int(11) NOT NULL AUTO_INCREMENT,\n  `chunk_id` int(11) NOT NULL,\n  `entity_id` int(11) NOT NULL,\n  `relevance_score` float DEFAULT 1,\n  `mention_count` int(11) DEFAULT 1,\n  PRIMARY KEY (`id`),\n  UNIQUE KEY `unique_chunk_entity` (`chunk_id`,`entity_id`),\n  KEY `chunk_entities_ibfk_2` (`entity_id`),\n  CONSTRAINT `chunk_entities_ibfk_1` FOREIGN KEY (`chunk_id`) REFERENCES `chunks` (`id`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;\n\nCREATE TABLE `chunk_taxonomy` (\n  `id` int(11) NOT NULL AUTO_INCREMENT,\n  `chunk_id` int(11) NOT NULL,\n  `taxonomy_id` int(11) NOT NULL,\n  `confidence` float DEFAULT 1,\n  `created_at` datetime DEFAULT current_timestamp(),\n  PRIMARY KEY (`id`),\n  UNIQUE KEY `unique_chunk_taxonomy` (`chunk_id`,`taxonomy_id`),\n  KEY `idx_taxonomy` (`taxonomy_id`),\n  CONSTRAINT `chunk_taxonomy_ibfk_1` FOREIGN KEY (`chunk_id`) REFERENCES `chunks` (`id`),\n  CONSTRAINT `chunk_taxonomy_ibfk_2` FOREIGN KEY (`taxonomy_id`) REFERENCES `taxonomy_terms` (`id`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;\n\n-- =====================================================\n-- ENTITY TABLES\n-- =====================================================\n\nCREATE TABLE `entity_types` (\n  `id` int(11) NOT NULL AUTO_INCREMENT,\n  `code` varchar(50) NOT NULL,\n  `name` varchar(100) NOT NULL,\n  `description` text DEFAULT NULL,\n  `criteria` text DEFAULT NULL,\n  `indicators` text DEFAULT NULL,\n  `examples` text DEFAULT NULL,\n  `parent_type_id` int(11) DEFAULT NULL,\n  `sort_order` int(11) DEFAULT 0,\n  `is_active` tinyint(1) DEFAULT 1,\n  `created_at` datetime DEFAULT current_timestamp(),\n  `updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),\n  PRIMARY KEY (`id`),\n  UNIQUE KEY `code` (`code`),\n  KEY `parent_type_id` (`parent_type_id`),\n  CONSTRAINT `entity_types_ibfk_1` FOREIGN KEY (`parent_type_id`) REFERENCES `entity_types` (`id`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;\n\nCREATE TABLE `entities` (\n  `id` int(11) NOT NULL AUTO_INCREMENT,\n  `name` varchar(255) NOT NULL,\n  `type` enum('PERSON','ORGANIZATION','LOCATION','EVENT','ROLE','TOOL','ARTIFACT','METAPHOR','METHOD','THEORY','MODEL','PRINCIPLE','DATE_TIME','QUANTITY_MEASURE','LAW_REGULATION','DIAGNOSIS_CONDITION','SYMPTOM_SIGN','ASSESSMENT_INSTRUMENT','PUBLICATION_WORK','DEMOGRAPHIC_GROUP','VALUE_NORM_RIGHT_DUTY','CONCEPT','INTERVENTION_EXERCISE','FACILITATION_FORMAT','PROCESS_PHASE_STEP','QUESTION_TYPE','EMOTION_FEELING','NEED_MOTIVE','TRAIT_ATTRIBUTE','RELATIONSHIP_TYPE','SYSTEM_CONTEXT','SYSTEM_TYPE','DIMENSION_AXIS','TYPOLOGY_CLASS','ORGANIZATIONAL_PROPERTY','FRAME_CONDITION_RESOURCE','SOURCE_CITATION_STUDY','QUOTE_STATEMENT','COMMUNICATION_PATTERN','RULE_SET_PROTOCOL','CONTACT_IDENTITY','OTHER') DEFAULT 'OTHER',\n  `description` text DEFAULT NULL,\n  `canonical_name` varchar(255) DEFAULT NULL,\n  `status` enum('extracted','normalized','validated','deprecated','merged') DEFAULT 'extracted',\n  `created_at` datetime DEFAULT current_timestamp(),\n  `updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),\n  `name_lower` varchar(255) GENERATED ALWAYS AS (lcase(`name`)) STORED,\n  PRIMARY KEY (`id`),\n  UNIQUE KEY `unique_name_type` (`name`,`type`),\n  KEY `idx_type` (`type`),\n  KEY `idx_canonical` (`canonical_name`),\n  KEY `idx_name_lower` (`name_lower`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;\n\nCREATE TABLE `entity_relations` (\n  `id` int(11) NOT NULL AUTO_INCREMENT,\n  `source_entity_id` int(11) NOT NULL,\n  `target_entity_id` int(11) NOT NULL,\n  `relation_type` varchar(100) NOT NULL,\n  `strength` float DEFAULT 1,\n  `context` text DEFAULT NULL,\n  `chunk_id` int(11) DEFAULT NULL,\n  `created_at` datetime DEFAULT current_timestamp(),\n  PRIMARY KEY (`id`),\n  KEY `idx_relation_type` (`relation_type`),\n  KEY `idx_source` (`source_entity_id`),\n  KEY `idx_target` (`target_entity_id`),\n  KEY `entity_relations_ibfk_3` (`chunk_id`),\n  KEY `idx_source_target` (`source_entity_id`,`target_entity_id`),\n  KEY `idx_target_source` (`target_entity_id`,`source_entity_id`),\n  CONSTRAINT `entity_relations_ibfk_1` FOREIGN KEY (`source_entity_id`) REFERENCES `entities` (`id`),\n  CONSTRAINT `entity_relations_ibfk_2` FOREIGN KEY (`target_entity_id`) REFERENCES `entities` (`id`),\n  CONSTRAINT `entity_relations_ibfk_3` FOREIGN KEY (`chunk_id`) REFERENCES `chunks` (`id`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;\n\nCREATE TABLE `entity_semantics` (\n  `id` int(11) NOT NULL AUTO_INCREMENT,\n  `entity_id` int(11) NOT NULL,\n  `summary` text DEFAULT NULL,\n  `keywords` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`keywords`)),\n  `analyzed_at` datetime DEFAULT NULL,\n  `analysis_model` varchar(100) DEFAULT NULL,\n  PRIMARY KEY (... [TRUNCATED-c0e64ff8b5efca08]",
        "structuredPatch": [
            {
                "oldStart": 447,
                "oldLines": 3,
                "newStart": 447,
                "newLines": 123,
                "lines": [
                    " (1, 'embed', 40, 1),",
                    " (1, 'entity_extract', 50, 1),",
                    " (1, 'semantic_analyze', 60, 1);",
                    "+",
                    "+-- =====================================================",
                    "+-- ADDITIONAL TABLES (Logging, Content Generation)",
                    "+-- =====================================================",
                    "+",
                    "+CREATE TABLE `pipeline_log` (",
                    "+  `id` int(11) NOT NULL AUTO_INCREMENT,",
                    "+  `pipeline_id` int(11) DEFAULT NULL,",
                    "+  `run_id` int(11) DEFAULT NULL,",
                    "+  `level` enum('DEBUG','INFO','WARNING','ERROR') DEFAULT 'INFO',",
                    "+  `message` text NOT NULL,",
                    "+  `context` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`context`)),",
                    "+  `created_at` datetime DEFAULT current_timestamp(),",
                    "+  PRIMARY KEY (`id`),",
                    "+  KEY `idx_run` (`run_id`),",
                    "+  KEY `idx_level` (`level`),",
                    "+  KEY `idx_created` (`created_at`)",
                    "+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;",
                    "+",
                    "+CREATE TABLE `protokoll` (",
                    "+  `id` int(11) NOT NULL AUTO_INCREMENT,",
                    "+  `session_id` varchar(100) DEFAULT NULL,",
                    "+  `provider` varchar(50) NOT NULL COMMENT 'ollama, anthropic, openai',",
                    "+  `model` varchar(100) NOT NULL,",
                    "+  `prompt` longtext DEFAULT NULL,",
                    "+  `response` longtext DEFAULT NULL,",
                    "+  `tokens_input` int(11) DEFAULT 0,",
                    "+  `tokens_output` int(11) DEFAULT 0,",
                    "+  `duration_ms` int(11) DEFAULT NULL,",
                    "+  `cost_usd` decimal(10,6) DEFAULT NULL,",
                    "+  `status` enum('success','error') DEFAULT 'success',",
                    "+  `error_message` text DEFAULT NULL,",
                    "+  `context` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`context`)),",
                    "+  `created_at` datetime DEFAULT current_timestamp(),",
                    "+  PRIMARY KEY (`id`),",
                    "+  KEY `idx_session` (`session_id`),",
                    "+  KEY `idx_provider` (`provider`),",
                    "+  KEY `idx_model` (`model`),",
                    "+  KEY `idx_created` (`created_at`)",
                    "+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='LLM call logging';",
                    "+",
                    "+CREATE TABLE `document_sections` (",
                    "+  `id` int(11) NOT NULL AUTO_INCREMENT,",
                    "+  `document_id` int(11) NOT NULL,",
                    "+  `parent_section_id` int(11) DEFAULT NULL,",
                    "+  `title` varchar(500) DEFAULT NULL,",
                    "+  `level` int(11) DEFAULT 1,",
                    "+  `start_page` int(11) DEFAULT NULL,",
                    "+  `end_page` int(11) DEFAULT NULL,",
                    "+  `content` text DEFAULT NULL,",
                    "+  `created_at` datetime DEFAULT current_timestamp(),",
                    "+  PRIMARY KEY (`id`),",
                    "+  KEY `idx_document` (`document_id`),",
                    "+  KEY `idx_parent` (`parent_section_id`),",
                    "+  CONSTRAINT `document_sections_ibfk_1` FOREIGN KEY (`document_id`) REFERENCES `documents` (`id`),",
                    "+  CONSTRAINT `document_sections_ibfk_2` FOREIGN KEY (`parent_section_id`) REFERENCES `document_sections` (`id`) ON DELETE SET NULL",
                    "+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;",
                    "+",
                    "+CREATE TABLE `content_config` (",
                    "+  `id` int(11) NOT NULL AUTO_INCREMENT,",
                    "+  `name` varchar(100) NOT NULL,",
                    "+  `type` enum('profile','prompt','critic') NOT NULL,",
                    "+  `config` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`config`)),",
                    "+  `description` text DEFAULT NULL,",
                    "+  `is_active` tinyint(1) DEFAULT 1,",
                    "+  `created_at` datetime DEFAULT current_timestamp(),",
                    "+  `updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),",
                    "+  PRIMARY KEY (`id`),",
                    "+  UNIQUE KEY `unique_name_type` (`name`,`type`)",
                    "+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Content generation configuration';",
                    "+",
                    "+CREATE TABLE `content_orders` (",
                    "+  `id` int(11) NOT NULL AUTO_INCREMENT,",
                    "+  `title` varchar(255) NOT NULL,",
                    "+  `briefing` text DEFAULT NULL,",
                    "+  `profile_id` int(11) DEFAULT NULL,",
                    "+  `status` enum('draft','generating','critique','revision','validate','approved','published') DEFAULT 'draft',",
                    "+  `model` varchar(100) DEFAULT NULL,",
                    "+  `current_version_id` int(11) DEFAULT NULL,",
                    "+  `collections` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`collections`)),",
                    "+  `context_limit` int(11) DEFAULT 5,",
                    "+  `log` text DEFAULT NULL,",
                    "+  `current_step` varchar(50) DEFAULT NULL,",
                    "+  `created_at` datetime DEFAULT current_timestamp(),",
                    "+  `updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),",
                    "+  PRIMARY KEY (`id`),",
                    "+  KEY `idx_status` (`status`),",
                    "+  KEY `idx_profile` (`profile_id`)",
                    "+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Content generation orders';",
                    "+",
                    "+CREATE TABLE `content_versions` (",
                    "+  `id` int(11) NOT NULL AUTO_INCREMENT,",
                    "+  `order_id` int(11) NOT NULL,",
                    "+  `version_number` int(11) NOT NULL DEFAULT 1,",
                    "+  `content` longtext DEFAULT NULL,",
                    "+  `model` varchar(100) DEFAULT NULL,",
                    "+  `tokens_input` int(11) DEFAULT 0,",
                    "+  `tokens_output` int(11) DEFAULT 0,",
                    "+  `duration_ms` int(11) DEFAULT NULL,",
                    "+  `created_at` datetime DEFAULT current_timestamp(),",
                    "+  PRIMARY KEY (`id`),",
                    "+  KEY `idx_order` (`order_id`),",
                    "+  CONSTRAINT `content_versions_ibfk_1` FOREIGN KEY (`order_id`) REFERENCES `content_orders` (`id`) ON DELETE CASCADE",
                    "+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;",
                    "+",
                    "+CREATE TABLE `content_critiques` (",
                    "+  `id` int(11) NOT NULL AUTO_INCREMENT,",
                    "+  `version_id` int(11) NOT NULL,",
                    "+  `critic_config_id` int(11) DEFAULT NULL,",
                    "+  `critique` longtext DEFAULT NULL,",
                    "+  `score` int(11) DEFAULT NULL,",
                    "+  `passed` tinyint(1) DEFAULT 0,",
                    "+  `model` varchar(100) DEFAULT NULL,",
                    "+  `tokens_input` int(11) DEFAULT 0,",
                    "+  `tokens_output` int(11) DEFAULT 0,",
                    "+  `created_at` datetime DEFAULT current_timestamp(),",
                    "+  PRIMARY KEY (`id`),",
                    "+  KEY `idx_version` (`version_id`),",
                    "+  CONSTRAINT `content_critiques_ibfk_1` FOREIGN KEY (`version_id`) REFERENCES `content_versions` (`id`) ON DELETE CASCADE",
                    "+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;"
                ]
            }
        ],
        "userModified": false,
        "replaceAll": false
    }
}
← Vorheriger Zur Liste Nächster →