ohmydengzi
9/18/2018 - 2:36 AM

ibos_api_center_test_db.sql

// 为所有表增加一个字段
SELECT CONCAT("ALTER TABLE ", TABLE_NAME," ADD testcase VARCHAR (100);")
  FROM INFORMATION_SCHEMA.TABLES
 WHERE TABLE_SCHEMA="master"  
   AND TABLE_TYPE="BASE TABLE"
  INTO OUTFILE 'D:\\add-column.sql'
  
  
// 复制一张表到另一张表,要求是完全相同字段
INSERT INTO newTable
SELECT * FROM oldTable

// 删除日志
	USE mysql;
	TRUNCATE table general_log;

// 开启日志并保存为表
set GLOBAL general_log='ON';
set global log_output='table';

// 日志中的增删改
USE mysql;

SELECT
	*
FROM
	`general_log`
WHERE
	(`argument` LIKE '%INSERT%'
OR `argument` LIKE '%UPDATE%'
OR `argument` LIKE '%DELETE%')
AND `argument` NOT LIKE '%SELECT%'
AND `argument` NOT LIKE '%`general_log` %'
AND `argument` NOT LIKE '%`deng_log_2018` %'
AND `argument` NOT LIKE '%`deng_module_guide` %'
AND `argument` NOT LIKE '%`deng_cron` %'
AND `argument` NOT LIKE '%`deng_syscache` %'
AND `argument` NOT LIKE '%`deng_user_status` %'
AND `argument` NOT LIKE '%`deng_session` %'
AND `argument` NOT LIKE '%`deng_cache_user_detail` %'
ORDER BY event_time desc