use 4dkankan_v4;
DELETE FROM sys_menu WHERE rec_status = 'I';

DELETE from sys_menu WHERE id = 225;
DELETE from sys_menu WHERE id = 99;
DELETE from sys_menu WHERE id = 104;
DELETE from sys_menu WHERE id = 16;
DELETE from sys_menu WHERE id = 23;
DELETE from sys_menu WHERE id = 21;
DELETE from sys_menu WHERE id = 96;
DELETE from sys_menu WHERE id = 247;
DELETE from sys_menu WHERE id = 18;
DELETE from sys_menu WHERE id = 24;
DELETE from sys_menu WHERE id = 20;

CREATE TEMPORARY TABLE temp_menu AS
SELECT id from sys_menu WHERE rec_status = 'A';
DELETE from sys_menu  WHERE parent_id not in (SELECT id from temp_menu);
DROP TEMPORARY TABLE temp_menu;

CREATE TEMPORARY TABLE temp_menu AS
SELECT id from sys_menu WHERE rec_status = 'A';
DELETE from sys_menu  WHERE parent_id not in (SELECT id from temp_menu);
DROP TEMPORARY TABLE temp_menu;

CREATE TEMPORARY TABLE temp_menu AS
SELECT id from sys_menu WHERE rec_status = 'A';
DELETE from sys_menu  WHERE parent_id not in (SELECT id from temp_menu);
DROP TEMPORARY TABLE temp_menu;


DELETE from sys_role_menu WHERE menu_id not in (SELECT id from sys_menu WHERE rec_status = 'A');


ALTER TABLE `4dkankan_v4`.`jy_scene_auth`
    ADD COLUMN `case_id` int NULL AFTER `update_time`;


ALTER TABLE `4dkankan_v4`.`jy_scene_user_auth`
    ADD COLUMN `case_id` int NULL AFTER `update_time`;
