PatchSet: Increase size of groups column
Increase the size to prevent running out of space when the number of comma-separated groups is large. This can be the case when there are a large number of merge commits in related changes. The schema migration takes into account that the column might have already been changed, in case anyone decides to do that manually on an existing 2.12.x site. Bug: Issue 4323 Change-Id: Icb3081b11e84f178516f650ff84acc6ee75045d3
This commit is contained in:
@@ -185,7 +185,7 @@ public final class PatchSet {
|
||||
* Changes on the same branch having patch sets with intersecting groups are
|
||||
* considered related, as in the "Related Changes" tab.
|
||||
*/
|
||||
@Column(id = 6, notNull = false)
|
||||
@Column(id = 6, notNull = false, length = Integer.MAX_VALUE)
|
||||
protected String groups;
|
||||
|
||||
//DELETED id = 7 (pushCertficate)
|
||||
|
||||
@@ -33,7 +33,7 @@ import java.util.List;
|
||||
/** A version of the database schema. */
|
||||
public abstract class SchemaVersion {
|
||||
/** The current schema version. */
|
||||
public static final Class<Schema_128> C = Schema_128.class;
|
||||
public static final Class<Schema_129> C = Schema_129.class;
|
||||
|
||||
public static int getBinaryVersion() {
|
||||
return guessVersion(C);
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
// Copyright (C) 2016 The Android Open Source Project
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package com.google.gerrit.server.schema;
|
||||
|
||||
import com.google.gerrit.reviewdb.server.ReviewDb;
|
||||
import com.google.gwtorm.jdbc.JdbcSchema;
|
||||
import com.google.gwtorm.server.OrmException;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Provider;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
|
||||
public class Schema_129 extends SchemaVersion {
|
||||
|
||||
@Inject
|
||||
Schema_129(Provider<Schema_128> prior) {
|
||||
super(prior);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void preUpdateSchema(ReviewDb db) throws OrmException {
|
||||
try (Statement stmt = ((JdbcSchema) db).getConnection().createStatement()) {
|
||||
stmt.execute("ALTER TABLE patch_sets MODIFY groups clob");
|
||||
} catch (SQLException e) {
|
||||
// Ignore. Type may have already been modified manually.
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user