diff options
Diffstat (limited to 'sonar-server')
-rw-r--r-- | sonar-server/src/main/webapp/WEB-INF/db/migrate/285_add_resource_index_primary_key.rb | 8 | ||||
-rw-r--r-- | sonar-server/src/main/webapp/WEB-INF/db/migrate/286_add_indices_to_resource_index.rb | 44 | ||||
-rw-r--r-- | sonar-server/src/main/webapp/WEB-INF/db/migrate/287_index_projects.rb (renamed from sonar-server/src/main/webapp/WEB-INF/db/migrate/286_index_projects.rb) | 0 |
3 files changed, 50 insertions, 2 deletions
diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/285_add_resource_index_primary_key.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/285_add_resource_index_primary_key.rb index 3b0180903c9..aa5ca2f5ae2 100644 --- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/285_add_resource_index_primary_key.rb +++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/285_add_resource_index_primary_key.rb @@ -48,9 +48,9 @@ class AddResourceIndexPrimaryKey < ActiveRecord::Migration t.column 'root_project_id', :integer, :null => false t.column 'qualifier', :string, :limit => 10, :null => false end - add_index 'resource_index', 'kee', :name => 'resource_index_key' - add_index 'resource_index', 'resource_id', :name => 'resource_index_rid' + # for unknown reason, indices can't be created here for Oracle (and as usual for Oracle only). + # These indices are moved to script 286. end end @@ -58,6 +58,10 @@ class AddResourceIndexPrimaryKey < ActiveRecord::Migration def self.remove_indices begin remove_index 'resource_index', :name => 'resource_index_key' + rescue + #ignore + end + begin remove_index 'resource_index', :name => 'resource_index_rid' rescue #ignore diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/286_add_indices_to_resource_index.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/286_add_indices_to_resource_index.rb new file mode 100644 index 00000000000..ad75ab81b83 --- /dev/null +++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/286_add_indices_to_resource_index.rb @@ -0,0 +1,44 @@ +# +# Sonar, entreprise quality control tool. +# Copyright (C) 2008-2012 SonarSource +# mailto:contact AT sonarsource DOT com +# +# Sonar is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# Sonar is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with Sonar; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 +# + +# +# Sonar 2.15 +# +class AddIndicesToResourceIndex < ActiveRecord::Migration + + class ResourceIndex < ActiveRecord::Base + set_table_name 'resource_index' + end + + def self.up + ResourceIndex.reset_column_information + + begin + add_index 'resource_index', 'kee', :name => 'resource_index_key' + rescue + #ignore, already exists + end + begin + add_index 'resource_index', 'resource_id', :name => 'resource_index_rid' + rescue + #ignore, already exists + end + end +end diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/286_index_projects.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/287_index_projects.rb index ad29a9a0de7..ad29a9a0de7 100644 --- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/286_index_projects.rb +++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/287_index_projects.rb |