summaryrefslogtreecommitdiffstats
path: root/sonar-server/src/main
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@sonarsource.com>2014-06-22 23:49:46 +0200
committerSimon Brandhof <simon.brandhof@sonarsource.com>2014-06-23 14:58:08 +0200
commitf206ca12ae3b445697e88fea1864c29c791196d0 (patch)
tree2efb635dc0d69ec81008941eae7307031619b0d9 /sonar-server/src/main
parent1baf8cc6bd273cbb2f0fb0f2c6a10f82b6507fec (diff)
downloadsonarqube-f206ca12ae3b445697e88fea1864c29c791196d0.tar.gz
sonarqube-f206ca12ae3b445697e88fea1864c29c791196d0.zip
SONAR-5405 Do not ignore errors on creation of db index
Diffstat (limited to 'sonar-server/src/main')
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/db/migrate/351_add_unique_index_to_authors.rb6
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/db/migrate/387_create_snapshot_data.rb7
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/db/migrate/397_add_index_to_users_login.rb7
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/db/migrate/404_add_index_to_snapshots_root_project_id.rb7
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/db/migrate/405_add_index_to_group_roles_role.rb7
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/db/migrate/419_add_index_to_rules_plugin_rule_key_and_plugin_name.rb6
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/db/migrate/433_add_index_to_characteristics_enabled.rb6
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/db/migrate/532_increase_size_of_user_login.rb4
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/db/migrate/540_create_activities_table.rb2
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/db/migrate/554_add_missing_user_unique_index.rb33
10 files changed, 44 insertions, 41 deletions
diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/351_add_unique_index_to_authors.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/351_add_unique_index_to_authors.rb
index cc998ef24f0..9e98bb2fbde 100644
--- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/351_add_unique_index_to_authors.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/351_add_unique_index_to_authors.rb
@@ -28,11 +28,7 @@ class AddUniqueIndexToAuthors < ActiveRecord::Migration
def self.up
delete_duplicated_authors
- begin
- add_index :authors, :login, :unique => true, :name => 'uniq_author_logins'
- rescue
- # Ignore, already exists
- end
+ add_index :authors, :login, :unique => true, :name => 'uniq_author_logins'
end
private
diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/387_create_snapshot_data.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/387_create_snapshot_data.rb
index cb297818210..f97f16c8ae6 100644
--- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/387_create_snapshot_data.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/387_create_snapshot_data.rb
@@ -33,11 +33,8 @@ class CreateSnapshotData < ActiveRecord::Migration
t.timestamps
end
- begin
- add_index :snapshot_data, :snapshot_id, :name => 'snapshot_data_snapshot_id'
- rescue
- #ignore already existing index
- end
+ add_index :snapshot_data, :snapshot_id, :name => 'snapshot_data_snapshot_id'
+
end
diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/397_add_index_to_users_login.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/397_add_index_to_users_login.rb
index 5cd0e586451..d750fc3487e 100644
--- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/397_add_index_to_users_login.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/397_add_index_to_users_login.rb
@@ -24,12 +24,7 @@
class AddIndexToUsersLogin < ActiveRecord::Migration
def self.up
- begin
- add_index :users, :login, :name => 'users_login', :unique => true
- rescue
- # already exists
- end
-
+ add_index :users, :login, :name => 'users_login', :unique => true
end
end
diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/404_add_index_to_snapshots_root_project_id.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/404_add_index_to_snapshots_root_project_id.rb
index e0ae3c3b3f2..273ad93a642 100644
--- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/404_add_index_to_snapshots_root_project_id.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/404_add_index_to_snapshots_root_project_id.rb
@@ -24,12 +24,7 @@
class AddIndexToSnapshotsRootProjectId < ActiveRecord::Migration
def self.up
- begin
- add_index :snapshots, :root_project_id, :name => 'snapshots_root_project_id'
- rescue
- # already exists
- end
-
+ add_index :snapshots, :root_project_id, :name => 'snapshots_root_project_id'
end
end
diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/405_add_index_to_group_roles_role.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/405_add_index_to_group_roles_role.rb
index 2d74d49659e..33dce069ae2 100644
--- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/405_add_index_to_group_roles_role.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/405_add_index_to_group_roles_role.rb
@@ -24,12 +24,7 @@
class AddIndexToGroupRolesRole < ActiveRecord::Migration
def self.up
- begin
- add_index :group_roles, :role, :name => 'group_roles_role'
- rescue
- # already exists
- end
-
+ add_index :group_roles, :role, :name => 'group_roles_role'
end
end
diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/419_add_index_to_rules_plugin_rule_key_and_plugin_name.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/419_add_index_to_rules_plugin_rule_key_and_plugin_name.rb
index 09e6452751b..5146886b431 100644
--- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/419_add_index_to_rules_plugin_rule_key_and_plugin_name.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/419_add_index_to_rules_plugin_rule_key_and_plugin_name.rb
@@ -24,11 +24,7 @@
class AddIndexToRulesPluginRuleKeyAndPluginName < ActiveRecord::Migration
def self.up
- begin
- add_index :rules, [:plugin_rule_key, :plugin_name], :unique => true, :name => 'rules_plugin_key_and_name'
- rescue
- # already exists
- end
+ add_index :rules, [:plugin_rule_key, :plugin_name], :unique => true, :name => 'rules_plugin_key_and_name'
end
end
diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/433_add_index_to_characteristics_enabled.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/433_add_index_to_characteristics_enabled.rb
index 2f228f3e2ac..ebeb3babbf8 100644
--- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/433_add_index_to_characteristics_enabled.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/433_add_index_to_characteristics_enabled.rb
@@ -25,11 +25,7 @@
class AddIndexToCharacteristicsEnabled < ActiveRecord::Migration
def self.up
- begin
- add_index :characteristics, :enabled, :name => 'characteristics_enabled'
- rescue
- # already exists
- end
+ add_index :characteristics, :enabled, :name => 'characteristics_enabled'
end
end
diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/532_increase_size_of_user_login.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/532_increase_size_of_user_login.rb
index 393c9bf62f1..bf89707c38a 100644
--- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/532_increase_size_of_user_login.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/532_increase_size_of_user_login.rb
@@ -45,8 +45,8 @@ class IncreaseSizeOfUserLogin < ActiveRecord::Migration
change_column :users, :login, :string, :limit => 255, :unique => true
if dialect()=='sqlserver'
- add_index :users, :login, :name => 'users_login'
- add_index :authors, :login, :unique => true, :name => 'uniq_author_logins'
+ add_index :users, :login, :name => 'users_login', :unique => true
+ add_index :authors, :login, :name => 'uniq_author_logins', :unique => true
add_index :issue_filter_favourites, :user_login, :name => 'issue_filter_favs_user'
add_index :issues, :assignee, :name => 'issues_assignee'
end
diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/540_create_activities_table.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/540_create_activities_table.rb
index 207b371b689..590dbac61b1 100644
--- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/540_create_activities_table.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/540_create_activities_table.rb
@@ -33,6 +33,6 @@ class CreateActivitiesTable < ActiveRecord::Migration
t.column 'log_message', :string, :limit => 4000
t.column 'log_key', :string
end
- add_index 'activities', :log_key, :unique => true, :name => 'activities_log_key'
+ add_index 'activities', :log_key, :name => 'activities_log_key', :unique => true
end
end
diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/554_add_missing_user_unique_index.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/554_add_missing_user_unique_index.rb
new file mode 100644
index 00000000000..614cf41825e
--- /dev/null
+++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/554_add_missing_user_unique_index.rb
@@ -0,0 +1,33 @@
+#
+# SonarQube, open source software quality management tool.
+# Copyright (C) 2008-2014 SonarSource
+# mailto:contact AT sonarsource DOT com
+#
+# SonarQube 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.
+#
+# SonarQube 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 this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+
+#
+# SonarQube 4.4
+# See SONAR-5405
+#
+class AddMissingUserUniqueIndex < ActiveRecord::Migration
+
+ def self.up
+ unless index_exists?(:users, :login, nil)
+ add_index :users, :login, :name => 'users_login', :unique => true
+ end
+ end
+
+end