From: Simon Brandhof Date: Wed, 25 Nov 2015 11:07:35 +0000 (+0100) Subject: SONAR-7073 Size of db column SNAPSHOTS.QUALIFIER is not correct X-Git-Tag: 5.3-RC1~179 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=9cfe6672bc793eb5775e8cd137b735837b3a2787;p=sonarqube.git SONAR-7073 Size of db column SNAPSHOTS.QUALIFIER is not correct --- diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/001_initial_schema.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/001_initial_schema.rb index 7ec4c2c5fbe..cef2367771a 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/001_initial_schema.rb +++ b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/001_initial_schema.rb @@ -40,8 +40,8 @@ class InitialSchema < ActiveRecord::Migration t.column :parent_snapshot_id, :integer, :null => true t.column :status, :string, :null => false, :default => 'U', :limit => 4 t.column :islast, :boolean, :null => false, :default => false - t.column 'scope', :string, :limit => 10, :null => true - t.column 'qualifier', :string, :limit => 3 + t.column 'scope', :string, :limit => 3 + t.column 'qualifier', :string, :limit => 10 t.column 'root_snapshot_id', :integer t.column 'version', :string, :limit => 60, :null => true t.column :path, :string, :null => true, :limit => 96 diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/1001_fix_size_of_snapshots_qualifier.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/1001_fix_size_of_snapshots_qualifier.rb new file mode 100644 index 00000000000..3d080387347 --- /dev/null +++ b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/1001_fix_size_of_snapshots_qualifier.rb @@ -0,0 +1,35 @@ +# +# 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 5.3 +# SONAR-7073 +# +class FixSizeOfSnapshotsQualifier < ActiveRecord::Migration + + def self.up + remove_index :snapshots, :name => 'snapshots_qualifier' + change_column('snapshots', 'qualifier', :string, :limit => 10, :null => false) + add_index :snapshots, :qualifier, :name => 'snapshots_qualifier' + end + +end + + diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/1002_fix_size_of_snapshots_scope.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/1002_fix_size_of_snapshots_scope.rb new file mode 100644 index 00000000000..8e769893ff3 --- /dev/null +++ b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/1002_fix_size_of_snapshots_scope.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 5.3 +# SONAR-7073 +# +class FixSizeOfSnapshotsScope < ActiveRecord::Migration + + def self.up + change_column('snapshots', 'scope', :string, :limit => 3, :null => false) + end + +end + + diff --git a/sonar-db/src/main/java/org/sonar/db/version/DatabaseVersion.java b/sonar-db/src/main/java/org/sonar/db/version/DatabaseVersion.java index f8d1d84e9f3..2faa9191b04 100644 --- a/sonar-db/src/main/java/org/sonar/db/version/DatabaseVersion.java +++ b/sonar-db/src/main/java/org/sonar/db/version/DatabaseVersion.java @@ -29,7 +29,7 @@ import org.sonar.db.MyBatis; public class DatabaseVersion { - public static final int LAST_VERSION = 1000; + public static final int LAST_VERSION = 1002; /** * The minimum supported version which can be upgraded. Lower diff --git a/sonar-db/src/main/resources/org/sonar/db/version/rows-h2.sql b/sonar-db/src/main/resources/org/sonar/db/version/rows-h2.sql index 25a9cb3425c..4f97c05b4d5 100644 --- a/sonar-db/src/main/resources/org/sonar/db/version/rows-h2.sql +++ b/sonar-db/src/main/resources/org/sonar/db/version/rows-h2.sql @@ -361,6 +361,8 @@ INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('939'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('940'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('941'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('1000'); +INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('1001'); +INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('1002'); INSERT INTO USERS(ID, LOGIN, NAME, EMAIL, CRYPTED_PASSWORD, SALT, CREATED_AT, UPDATED_AT, REMEMBER_TOKEN, REMEMBER_TOKEN_EXPIRES_AT) VALUES (1, 'admin', 'Administrator', '', 'a373a0e667abb2604c1fd571eb4ad47fe8cc0878', '48bc4b0d93179b5103fd3885ea9119498e9d161b', '1418215735482', '1418215735482', null, null); ALTER TABLE USERS ALTER COLUMN ID RESTART WITH 2;