Magento2 通过日志来分析数据库与相关sql语法

Magento2 通过日志来分析数据库与相关sql语法,之前找了一些朋友谈到Magento数据库时,谈到数据表有3百多个时,大家就晕了,当时要我给一个具体的数据表的说明,必尽不是开发出生,只能找官方的文档交差,但朋友看的还是很头晕,但昨天我想到了Mysql不是可以监控吗?通过操作后台来查看sql日志,接下来就修改了my.ini数据库配置文件
magento-mysql
测试了下,从最简单的添加cms page开始,也相当于举个例:

INSERT INTO `cms_page` (`page_id`, `title`, `page_layout`, `meta_keywords`, `meta_description`, `identifier`, `content_heading`, `content`, `is_active`, `layout_update_xml`, `custom_theme`, `custom_root_template`, `custom_layout_update_xml`, `custom_theme_from`, `custom_theme_to`, `meta_title`) VALUES (NULL, 'serive', '1column', '', '', 'serive', '', 'seriveinfo', '1', '', NULL, NULL, NULL, NULL, NULL, '')

SELECT `cps`.`store_id` FROM `cms_page_store` AS `cps`
INNER JOIN `cms_page` AS `cp` ON cps.page_id = cp.page_id WHERE (cp.page_id = '8')
INSERT INTO `cms_page_store` (`page_id`,`store_id`) VALUES ('8', '0')

INSERT INTO `url_rewrite` (`redirect_type`,`is_autogenerated`,`metadata`,`description`,`store_id`,`entity_type`,`entity_id`,`request_path`,`target_path`) VALUES ('0', '1', NULL, NULL, '1', 'cms-page', '8', 'serive', 'cms/page/view/page_id/8')

这个是用于插入page页,注意ID 与 identifier,名称对应可以了

UPDATE `cms_page` SET `title` = 'about', `page_layout` = '1column', `meta_keywords` = '', `meta_description` = '', `identifier` = 'about', `content_heading` = '', `content` = 'ccccinfo', `is_active` = '1', `sort_order` = '0', `layout_update_xml` = '', `custom_theme` = NULL, `custom_root_template` = NULL, `custom_layout_update_xml` = NULL, `custom_theme_from` = NULL, `custom_theme_to` = NULL, `meta_title` = '' WHERE (page_id = '5')

其它的数据也是同样方式,这个是静态块的sql语句

INNER JOIN `cms_block_store` AS `cbs` ON cb.block_id = cbs.block_id WHERE (cb.identifier = 'tool') AND (cbs.store_id IN (0));
INSERT INTO `cms_block` (`block_id`, `title`, `identifier`, `content`, `is_active`) VALUES (NULL, 'tool', 'footermenu', '

tool

', '1');
SELECT `cbs`.`store_id` FROM `cms_block_store` AS `cbs`
INNER JOIN `cms_block` AS `cb` ON cbs.block_id = cb.block_id WHERE (cb.block_id = '4');
INSERT INTO `cms_block_store` (`block_id`,`store_id`) VALUES ('4', '0');

发表评论
Magento2 技术支持 上门服务

工作时间
周一至周六
9:00-18:00
相关咨询电话
15360669780
侨海科技