Remove mergeable bit from Change
Upgrade the schema to remove the field, but do not actually migrate data. This will be backfilled done during the next site reindex. The reason for this suboptimal upgrade process is that it would be nontrivial to copy the data in a schema upgrade, since the key for the cache requires running the entire submit rule evaluator to get the submit type. The dbInjector used to create the chain of SchemaVersions has far too few bindings for this. Getting these at schema upgrade time would require a completely different approach to injecting schema upgrade steps. Change-Id: I6fd6de3d06ed92ee4d2dbea43f3e9974e9491542
This commit is contained in:
@@ -32,7 +32,7 @@ import java.util.List;
|
||||
/** A version of the database schema. */
|
||||
public abstract class SchemaVersion {
|
||||
/** The current schema version. */
|
||||
public static final Class<Schema_99> C = Schema_99.class;
|
||||
public static final Class<Schema_100> C = Schema_100.class;
|
||||
|
||||
public static class Module extends AbstractModule {
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
// Copyright (C) 2014 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.inject.Inject;
|
||||
import com.google.inject.Provider;
|
||||
|
||||
public class Schema_100 extends SchemaVersion {
|
||||
@Inject
|
||||
Schema_100(Provider<Schema_99> prior) {
|
||||
super(prior);
|
||||
}
|
||||
|
||||
// No database migration; merges are rechecked on reindex.
|
||||
}
|
||||
@@ -14,29 +14,14 @@
|
||||
|
||||
package com.google.gerrit.server.schema;
|
||||
|
||||
import com.google.gerrit.reviewdb.client.Change;
|
||||
import com.google.gerrit.reviewdb.server.ReviewDb;
|
||||
import com.google.gwtorm.server.OrmException;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Provider;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
|
||||
public class Schema_59 extends SchemaVersion {
|
||||
@Inject
|
||||
Schema_59(Provider<Schema_58> prior) {
|
||||
super(prior);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void migrateData(ReviewDb db, UpdateUI ui) throws OrmException,
|
||||
SQLException {
|
||||
List<Change> allChanges = db.changes().all().toList();
|
||||
for (Change change : allChanges) {
|
||||
change.setMergeable(true);
|
||||
change.setLastSha1MergeTested(null);
|
||||
}
|
||||
db.changes().update(allChanges);
|
||||
}
|
||||
}
|
||||
// Don't migrate columns; they are removed in Schema_100.
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user