From b633e57cbfe1789a2048b3b79702ff84514e8525 Mon Sep 17 00:00:00 2001 From: David Gageot Date: Wed, 7 Nov 2012 17:06:57 +0100 Subject: [PATCH] SONAR-3797 Size of the name column in the groups table is too short --- .../core/persistence/DatabaseVersion.java | 2 +- .../org/sonar/core/persistence/rows-h2.sql | 1 + .../org/sonar/core/persistence/schema-h2.ddl | 2 +- .../migrate/353_increase_group_name_size.rb | 29 +++++++++++++++++++ 4 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 sonar-server/src/main/webapp/WEB-INF/db/migrate/353_increase_group_name_size.rb diff --git a/sonar-core/src/main/java/org/sonar/core/persistence/DatabaseVersion.java b/sonar-core/src/main/java/org/sonar/core/persistence/DatabaseVersion.java index c22f9253ff3..e200d553f7a 100644 --- a/sonar-core/src/main/java/org/sonar/core/persistence/DatabaseVersion.java +++ b/sonar-core/src/main/java/org/sonar/core/persistence/DatabaseVersion.java @@ -32,7 +32,7 @@ import java.util.List; */ public class DatabaseVersion implements BatchComponent, ServerComponent { - public static final int LAST_VERSION = 352; + public static final int LAST_VERSION = 353; public static enum Status { UP_TO_DATE, REQUIRES_UPGRADE, REQUIRES_DOWNGRADE, FRESH_INSTALL diff --git a/sonar-core/src/main/resources/org/sonar/core/persistence/rows-h2.sql b/sonar-core/src/main/resources/org/sonar/core/persistence/rows-h2.sql index 5c27bbed51c..b6abb1db23a 100644 --- a/sonar-core/src/main/resources/org/sonar/core/persistence/rows-h2.sql +++ b/sonar-core/src/main/resources/org/sonar/core/persistence/rows-h2.sql @@ -180,6 +180,7 @@ INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('335'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('350'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('351'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('352'); +INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('353'); 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', '2011-09-26 22:27:48.0', '2011-09-26 22:27:48.0', null, null); ALTER TABLE USERS ALTER COLUMN ID RESTART WITH 2; diff --git a/sonar-core/src/main/resources/org/sonar/core/persistence/schema-h2.ddl b/sonar-core/src/main/resources/org/sonar/core/persistence/schema-h2.ddl index 55d37119219..f4d01e85b6f 100644 --- a/sonar-core/src/main/resources/org/sonar/core/persistence/schema-h2.ddl +++ b/sonar-core/src/main/resources/org/sonar/core/persistence/schema-h2.ddl @@ -106,7 +106,7 @@ CREATE TABLE "MEASURE_DATA" ( CREATE TABLE "GROUPS" ( "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), - "NAME" VARCHAR(40), + "NAME" VARCHAR(255), "DESCRIPTION" VARCHAR(200), "CREATED_AT" TIMESTAMP, "UPDATED_AT" TIMESTAMP diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/353_increase_group_name_size.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/353_increase_group_name_size.rb new file mode 100644 index 00000000000..5aa183970f5 --- /dev/null +++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/353_increase_group_name_size.rb @@ -0,0 +1,29 @@ +# +# Sonar, open source software quality management 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 3.4 +# +class IncreaseGroupNameSize < ActiveRecord::Migration + + def self.up + change_column :groups, :name, :string, :limit => 255, :null => true + end +end -- 2.39.5