diff options
author | Julien Lancelot <julien.lancelot@sonarsource.com> | 2014-07-15 18:52:44 +0200 |
---|---|---|
committer | Julien Lancelot <julien.lancelot@sonarsource.com> | 2014-07-15 18:53:05 +0200 |
commit | 7d43b94440c94a6b2675241bff7955d4d1314047 (patch) | |
tree | f57b30469980308db4e157170c581e963e8ede2f /server/sonar-web/src/main | |
parent | c07c8261871d763b9fa51cd79cd177165104e89c (diff) | |
download | sonarqube-7d43b94440c94a6b2675241bff7955d4d1314047.tar.gz sonarqube-7d43b94440c94a6b2675241bff7955d4d1314047.zip |
SONAR-5451 Deletion of project fails on Oracle when this project contains more than 1'000 events
Diffstat (limited to 'server/sonar-web/src/main')
-rw-r--r-- | server/sonar-web/src/main/webapp/WEB-INF/app/controllers/api/events_controller.rb | 7 | ||||
-rw-r--r-- | server/sonar-web/src/main/webapp/WEB-INF/app/controllers/project_controller.rb | 8 |
2 files changed, 12 insertions, 3 deletions
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/api/events_controller.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/api/events_controller.rb index c210a3dd9f1..2fae5c1b769 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/api/events_controller.rb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/api/events_controller.rb @@ -196,7 +196,12 @@ class Api::EventsController < Api::ApiController events << event end end - Event.delete(events.map {|e| e.id}) + + Event.transaction do + events.map { |e| e.id }.each_slice(999) do |safe_for_oracle_ids| + Event.delete(safe_for_oracle_ids) + end + end render_success("Event deleted") diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/project_controller.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/project_controller.rb index c9fe8be76b6..0afc33579e6 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/project_controller.rb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/project_controller.rb @@ -345,7 +345,12 @@ class ProjectController < ApplicationController event = parent_snapshot.event(EventCategory::KEY_VERSION) old_version_name = event.name events = find_events(event) - Event.delete(events.map { |e| e.id }) + + Event.transaction do + events.map { |e| e.id }.each_slice(999) do |safe_for_oracle_ids| + Event.delete(safe_for_oracle_ids) + end + end reportProjectModification(parent_snapshot.root_project_id) @@ -427,7 +432,6 @@ class ProjectController < ApplicationController events = [] name = event.name category = event.category - description = event.description snapshots = find_project_snapshots(event.snapshot_id) snapshots.each do |snapshot| snapshot.events.reject { |e| e.name!=name || e.category!=category }.each do |event| |