veops / cmdb

CMDB: configuration and management of IT resources
https://veops.cn/cmdb
GNU Affero General Public License v3.0
1.44k stars 370 forks source link

能否出一期大概代码解析!~ #526

Open wz03140 opened 4 months ago

wz03140 commented 4 months ago

Contact Details

No response

What is your question?

小小白学习中,项目搭建文档中已经很是清晰,但是在系统对照找代码接口中还是有点混乱,大胆希望大佬们能出一期代码讲解以便学习借鉴~期待ing

Version

newest

linxiaobai commented 4 months ago

+1,另外希望表结构有相关的注释解析

CREATE TABLE `c_value_index_texts` (
  `deleted_at` datetime DEFAULT NULL,
  `deleted` tinyint(1) DEFAULT NULL,
  `created_at` datetime DEFAULT NULL,
  `updated_at` datetime DEFAULT NULL,
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `ci_id` int(11) NOT NULL,
  `attr_id` int(11) NOT NULL,
  `value` varchar(128) COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`id`),
  KEY `ci_id` (`ci_id`),
  KEY `ix_c_value_index_texts_deleted` (`deleted`),
  KEY `text_attr_value_index` (`attr_id`,`value`),
  CONSTRAINT `c_value_index_texts_ibfk_1` FOREIGN KEY (`ci_id`) REFERENCES `c_cis` (`id`),
  CONSTRAINT `c_value_index_texts_ibfk_2` FOREIGN KEY (`attr_id`) REFERENCES `c_attributes` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

在进行数据检索时我发现c_ci_types跟c_attributes之间的值存放在c_value_index_texts中的时候,并不是直接关联的,而是通过了c_cis间接关联的,这样设计的目的是啥?求解答。