{
"event": "PreToolUse",
"tool_name": "Write",
"tool_input": {
"file_path": "\/var\/www\/migration\/content-pipeline\/sql\/schema.sql",
"content": "-- =====================================================\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]"
}
}
{
"tool_response": {
"type": "create",
"filePath": "\/var\/www\/migration\/content-pipeline\/sql\/schema.sql",
"content": "-- =====================================================\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": [],
"originalFile": null
}
}