sonar数据库project垃圾数据清理
?此时如果把sonar.projectKey属性改一下,也是可以正常运行代码扫描的,不过数据库里面就永久存储了一些垃圾数据,并且计划好的projectKey也要被迫更换,比较别扭。
还有一个方法就是直接修改sonar的数据库,从数据库层面直接清除掉第一次扫描失败时写入的垃圾数据。
假设第一次扫描时,sonar.projectKey属性值为D01:Project1:java,则使用以下sql语句将垃圾数据删除掉:
delete from action_plans_reviews where action_plan_id in (select id from action_plans where project_id in (select id from projects where kee like 'D01:Project1:java%'));delete from action_plans where project_id in (select id from projects where kee like 'D01:Project1:java%');delete from project_links where project_id in (select id from projects where kee like 'D01:Project1:java%');delete from project_measures where project_id in (select id from projects where kee like 'D01:Project1:java%');delete from review_comments where review_id in(select id from reviews where project_id in (select id from projects where kee like 'D01:Project1:java%'));delete from reviews where project_id in (select id from projects where kee like 'D01:Project1:java%');delete from duplications_index where snapshot_id in(select id from snapshots where project_id in (select id from projects where kee like 'D01:Project1:java%'));delete from events where snapshot_id in(select id from snapshots where project_id in (select id from projects where kee like 'D01:Project1:java%'));delete from graphs where snapshot_id in(select id from snapshots where project_id in (select id from projects where kee like 'D01:Project1:java%'));delete from measure_data where snapshot_id in(select id from snapshots where project_id in (select id from projects where kee like 'D01:Project1:java%'));delete from project_measures where snapshot_id in(select id from snapshots where project_id in (select id from projects where kee like 'D01:Project1:java%'));delete from rule_failures where snapshot_id in(select id from snapshots where project_id in (select id from projects where kee like 'D01:Project1:java%'));delete from snapshot_sources where snapshot_id in(select id from snapshots where project_id in (select id from projects where kee like 'D01:Project1:java%'));delete from snapshots where project_id in (select id from projects where kee like 'D01:Project1:java%');delete from projects where kee like 'D01:Project1:java%';
?