魔镜7.3版本清理脏数据

魔镜使用 yangchenhui 3638℃ 0评论
功能描述
  1. 主要解决彻底删除某个账号下的数据。
  2. 清理系统中的脏数据(可能是因为逻辑不严谨导致的,个别数据可能会影响功能)
-- 删除某个用户下的所有数据信息
delete from mj_object where owner = 1;
delete from mj_folder_info where owner = 1;
-- 删除脏数据,可能由于代码bug导致脏数据,也可能是由于上面的脚本删除基础信息之后遗留的脏数据信息。
delete from mj_script_info where id not in (select id from mj_object);
delete from mj_datasource where id not in(select id from mj_object);
delete from mj_table where id not in(select id from mj_object);
delete from mj_column where table_id not in(select id from mj_object);
delete from mj_board where id not in (select id from mj_object);
delete from mj_chart where id not in (select id from mj_object) or board_id not in(select id from mj_object);
delete from mj_table_mapping where ds_id not in (select id from mj_object) or table_id not in (select id from mj_object) or depend_table not in (select id from mj_object);
delete from mj_board_controllers where board_id not in (select id from mj_object);
delete from mj_business_group where id not in (select id from mj_object);
delete from mj_chart_update_history where board_id not in (select id from mj_object);
delete from mj_custom_group where id not in(select id from mj_object);
delete from mj_custom_group_rule where custom_group_id not in (select id from mj_custom_group);
delete from mj_db_update_history where ds_id not in (select id from mj_object);
delete from mj_db_update_details where history_id not in(select id from mj_db_update_history);
delete from mj_dim_attribute where dim_id not in (select id from mj_object);
delete from mj_dim_attribute_expr where dim_id not in(select id from mj_object) or src_table_id not in (select id from mj_object);
delete from mj_fact_expr where project_id not in (select id from mj_object) or src_table_id not in (select id from mj_object);
delete from mj_measure_expr where measure_id not in(select id from mj_object);
delete from mj_hierarchy where project_id not in (select id from mj_object);
delete from mj_parameter where project_id not in (select id from mj_object) or object_id not in (select id from mj_object);
delete from mj_obj_caculate where project_id not in (select id from mj_object) ;
delete from mj_folder_relation_info where relation_id not in(select id from mj_object) or parent_id not in (select id from mj_folder_info);
delete from mj_db_project where datasource_id not in (select id from mj_object) or project_id not in(select id from mj_object);
delete from mj_genealogy where object_id not in(select id from mj_object);
delete from mj_depend where project_id not in (select id from mj_object) and project_id <> -100;
delete from mj_depend where object_id not in(select id from mj_object) and (type = 100 or type = 5);

本文固定链接:杨晨辉的个人博客 » 魔镜7.3版本清理脏数据
本站内容除特别标注外均为原创,欢迎转载,但请保留出处!

喜欢 (2)
发表我的评论
取消评论
表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址