Shorten column names that are longer than 30 characters
Some databases can't deal with column names that are longer than 30 characters. Examples are MaxDB and Oracle [1]. Gerrit has two column names in the accounts table that exceed the 30 characters: displayPatchSetsInReverseOrder, displayPersonNameInReviewCategory This change renames these 2 columns so that their names fit within the 30 character range. [1] http://groups.google.com/group/repo-discuss/browse_thread/thread/ecb713d42c04ae8a/cc963525d8247a17?lnk=gst#cc963525d8247a17 Change-Id: Ie58fb57bea5d5ec3634ad2a73241120a0e50a466 Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
This commit is contained in:
@@ -30,8 +30,8 @@ public interface AccountConstants extends Constants {
|
||||
String showSiteHeader();
|
||||
String useFlashClipboard();
|
||||
String copySelfOnEmails();
|
||||
String displayPatchSetsInReverseOrder();
|
||||
String displayPersonNameInReviewCategory();
|
||||
String reversePatchSetOrder();
|
||||
String showUsernameInReviewCategory();
|
||||
String buttonSaveChanges();
|
||||
|
||||
String tabAccountSummary();
|
||||
|
||||
@@ -7,8 +7,8 @@ accountId = Account ID
|
||||
showSiteHeader = Show Site Header
|
||||
useFlashClipboard = Use Flash Clipboard Widget
|
||||
copySelfOnEmails = CC Me On Comments I Write
|
||||
displayPatchSetsInReverseOrder = Display Patch Sets In Reverse Order
|
||||
displayPersonNameInReviewCategory = Display Person Name In Review Category
|
||||
reversePatchSetOrder = Display Patch Sets In Reverse Order
|
||||
showUsernameInReviewCategory = Display Person Name In Review Category
|
||||
defaultContextFieldLabel = Default Context:
|
||||
maximumPageSizeFieldLabel = Maximum Page Size:
|
||||
dateFormatLabel = Date/Time Format:
|
||||
|
||||
@@ -41,8 +41,8 @@ public class MyPreferencesScreen extends SettingsScreen {
|
||||
private CheckBox showSiteHeader;
|
||||
private CheckBox useFlashClipboard;
|
||||
private CheckBox copySelfOnEmails;
|
||||
private CheckBox displayPatchSetsInReverseOrder;
|
||||
private CheckBox displayPersonNameInReviewCategory;
|
||||
private CheckBox reversePatchSetOrder;
|
||||
private CheckBox showUsernameInReviewCategory;
|
||||
private ListBox maximumPageSize;
|
||||
private ListBox dateFormat;
|
||||
private ListBox timeFormat;
|
||||
@@ -74,11 +74,11 @@ public class MyPreferencesScreen extends SettingsScreen {
|
||||
copySelfOnEmails = new CheckBox(Util.C.copySelfOnEmails());
|
||||
copySelfOnEmails.addClickHandler(onClickSave);
|
||||
|
||||
displayPatchSetsInReverseOrder = new CheckBox(Util.C.displayPatchSetsInReverseOrder());
|
||||
displayPatchSetsInReverseOrder.addClickHandler(onClickSave);
|
||||
reversePatchSetOrder = new CheckBox(Util.C.reversePatchSetOrder());
|
||||
reversePatchSetOrder.addClickHandler(onClickSave);
|
||||
|
||||
displayPersonNameInReviewCategory = new CheckBox(Util.C.displayPersonNameInReviewCategory());
|
||||
displayPersonNameInReviewCategory.addClickHandler(onClickSave);
|
||||
showUsernameInReviewCategory = new CheckBox(Util.C.showUsernameInReviewCategory());
|
||||
showUsernameInReviewCategory.addClickHandler(onClickSave);
|
||||
|
||||
maximumPageSize = new ListBox();
|
||||
for (final short v : PAGESIZE_CHOICES) {
|
||||
@@ -137,11 +137,11 @@ public class MyPreferencesScreen extends SettingsScreen {
|
||||
row++;
|
||||
|
||||
formGrid.setText(row, labelIdx, "");
|
||||
formGrid.setWidget(row, fieldIdx, displayPatchSetsInReverseOrder);
|
||||
formGrid.setWidget(row, fieldIdx, reversePatchSetOrder);
|
||||
row++;
|
||||
|
||||
formGrid.setText(row, labelIdx, "");
|
||||
formGrid.setWidget(row, fieldIdx, displayPersonNameInReviewCategory);
|
||||
formGrid.setWidget(row, fieldIdx, showUsernameInReviewCategory);
|
||||
row++;
|
||||
|
||||
formGrid.setText(row, labelIdx, Util.C.maximumPageSizeFieldLabel());
|
||||
@@ -179,8 +179,8 @@ public class MyPreferencesScreen extends SettingsScreen {
|
||||
showSiteHeader.setEnabled(on);
|
||||
useFlashClipboard.setEnabled(on);
|
||||
copySelfOnEmails.setEnabled(on);
|
||||
displayPatchSetsInReverseOrder.setEnabled(on);
|
||||
displayPersonNameInReviewCategory.setEnabled(on);
|
||||
reversePatchSetOrder.setEnabled(on);
|
||||
showUsernameInReviewCategory.setEnabled(on);
|
||||
maximumPageSize.setEnabled(on);
|
||||
dateFormat.setEnabled(on);
|
||||
timeFormat.setEnabled(on);
|
||||
@@ -190,8 +190,8 @@ public class MyPreferencesScreen extends SettingsScreen {
|
||||
showSiteHeader.setValue(p.isShowSiteHeader());
|
||||
useFlashClipboard.setValue(p.isUseFlashClipboard());
|
||||
copySelfOnEmails.setValue(p.isCopySelfOnEmails());
|
||||
displayPatchSetsInReverseOrder.setValue(p.isDisplayPatchSetsInReverseOrder());
|
||||
displayPersonNameInReviewCategory.setValue(p.isDisplayPersonNameInReviewCategory());
|
||||
reversePatchSetOrder.setValue(p.isReversePatchSetOrder());
|
||||
showUsernameInReviewCategory.setValue(p.isShowUsernameInReviewCategory());
|
||||
setListBox(maximumPageSize, DEFAULT_PAGESIZE, p.getMaximumPageSize());
|
||||
setListBox(dateFormat, AccountGeneralPreferences.DateFormat.STD, //
|
||||
p.getDateFormat());
|
||||
@@ -251,8 +251,8 @@ public class MyPreferencesScreen extends SettingsScreen {
|
||||
p.setShowSiteHeader(showSiteHeader.getValue());
|
||||
p.setUseFlashClipboard(useFlashClipboard.getValue());
|
||||
p.setCopySelfOnEmails(copySelfOnEmails.getValue());
|
||||
p.setDisplayPatchSetsInReverseOrder(displayPatchSetsInReverseOrder.getValue());
|
||||
p.setDisplayPersonNameInReviewCategory(displayPersonNameInReviewCategory.getValue());
|
||||
p.setReversePatchSetOrder(reversePatchSetOrder.getValue());
|
||||
p.setShowUsernameInReviewCategory(showUsernameInReviewCategory.getValue());
|
||||
p.setMaximumPageSize(getListBox(maximumPageSize, DEFAULT_PAGESIZE));
|
||||
p.setDateFormat(getListBox(dateFormat,
|
||||
AccountGeneralPreferences.DateFormat.STD,
|
||||
|
||||
@@ -286,13 +286,13 @@ public class ChangeTable extends NavigationTable<ChangeInfo> {
|
||||
int col = BASE_COLUMNS;
|
||||
boolean haveReview = false;
|
||||
|
||||
boolean displayPersonNameInReviewCategory = false;
|
||||
boolean showUsernameInReviewCategory = false;
|
||||
|
||||
if (Gerrit.isSignedIn()) {
|
||||
AccountGeneralPreferences prefs = Gerrit.getUserAccount().getGeneralPreferences();
|
||||
|
||||
if (prefs.isDisplayPersonNameInReviewCategory()) {
|
||||
displayPersonNameInReviewCategory = true;
|
||||
if (prefs.isShowUsernameInReviewCategory()) {
|
||||
showUsernameInReviewCategory = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -314,7 +314,7 @@ public class ChangeTable extends NavigationTable<ChangeInfo> {
|
||||
|
||||
if (type.isMaxNegative(ca)) {
|
||||
|
||||
if (displayPersonNameInReviewCategory) {
|
||||
if (showUsernameInReviewCategory) {
|
||||
FlowPanel fp = new FlowPanel();
|
||||
fp.add(new Image(Gerrit.RESOURCES.redNot()));
|
||||
fp.add(new InlineLabel(FormatUtil.name(ai)));
|
||||
@@ -325,7 +325,7 @@ public class ChangeTable extends NavigationTable<ChangeInfo> {
|
||||
|
||||
} else if (type.isMaxPositive(ca)) {
|
||||
|
||||
if (displayPersonNameInReviewCategory) {
|
||||
if (showUsernameInReviewCategory) {
|
||||
FlowPanel fp = new FlowPanel();
|
||||
fp.add(new Image(Gerrit.RESOURCES.greenCheck()));
|
||||
fp.add(new InlineLabel(FormatUtil.name(ai)));
|
||||
@@ -337,7 +337,7 @@ public class ChangeTable extends NavigationTable<ChangeInfo> {
|
||||
} else {
|
||||
String vstr = String.valueOf(ca.getValue());
|
||||
|
||||
if (displayPersonNameInReviewCategory) {
|
||||
if (showUsernameInReviewCategory) {
|
||||
vstr = vstr + " " + FormatUtil.name(ai);
|
||||
}
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ public class PatchSetsBlock extends Composite {
|
||||
if (Gerrit.isSignedIn()) {
|
||||
final AccountGeneralPreferences p =
|
||||
Gerrit.getUserAccount().getGeneralPreferences();
|
||||
if (p.isDisplayPatchSetsInReverseOrder()) {
|
||||
if (p.isReversePatchSetOrder()) {
|
||||
Collections.reverse(patchSets);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,10 +118,10 @@ public final class AccountGeneralPreferences {
|
||||
* (show latest patch set on top).
|
||||
*/
|
||||
@Column(id = 10)
|
||||
protected boolean displayPatchSetsInReverseOrder;
|
||||
protected boolean reversePatchSetOrder;
|
||||
|
||||
@Column(id = 11)
|
||||
protected boolean displayPersonNameInReviewCategory;
|
||||
protected boolean showUsernameInReviewCategory;
|
||||
|
||||
public AccountGeneralPreferences() {
|
||||
}
|
||||
@@ -188,20 +188,20 @@ public final class AccountGeneralPreferences {
|
||||
copySelfOnEmail = includeSelfOnEmail;
|
||||
}
|
||||
|
||||
public boolean isDisplayPatchSetsInReverseOrder() {
|
||||
return displayPatchSetsInReverseOrder;
|
||||
public boolean isReversePatchSetOrder() {
|
||||
return reversePatchSetOrder;
|
||||
}
|
||||
|
||||
public void setDisplayPatchSetsInReverseOrder(final boolean displayPatchSetsInReverseOrder) {
|
||||
this.displayPatchSetsInReverseOrder = displayPatchSetsInReverseOrder;
|
||||
public void setReversePatchSetOrder(final boolean reversePatchSetOrder) {
|
||||
this.reversePatchSetOrder = reversePatchSetOrder;
|
||||
}
|
||||
|
||||
public boolean isDisplayPersonNameInReviewCategory() {
|
||||
return displayPersonNameInReviewCategory;
|
||||
public boolean isShowUsernameInReviewCategory() {
|
||||
return showUsernameInReviewCategory;
|
||||
}
|
||||
|
||||
public void setDisplayPersonNameInReviewCategory(final boolean displayPersonNameInReviewCategory) {
|
||||
this.displayPersonNameInReviewCategory = displayPersonNameInReviewCategory;
|
||||
public void setShowUsernameInReviewCategory(final boolean showUsernameInReviewCategory) {
|
||||
this.showUsernameInReviewCategory = showUsernameInReviewCategory;
|
||||
}
|
||||
|
||||
public DateFormat getDateFormat() {
|
||||
@@ -231,8 +231,8 @@ public final class AccountGeneralPreferences {
|
||||
showSiteHeader = true;
|
||||
useFlashClipboard = true;
|
||||
copySelfOnEmail = false;
|
||||
displayPatchSetsInReverseOrder = false;
|
||||
displayPersonNameInReviewCategory = false;
|
||||
reversePatchSetOrder = false;
|
||||
showUsernameInReviewCategory = false;
|
||||
downloadUrl = null;
|
||||
downloadCommand = null;
|
||||
dateFormat = null;
|
||||
|
||||
@@ -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_65> C = Schema_65.class;
|
||||
public static final Class<Schema_66> C = Schema_66.class;
|
||||
|
||||
public static class Module extends AbstractModule {
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
// Copyright (C) 2012 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_66 extends SchemaVersion {
|
||||
|
||||
@Inject
|
||||
Schema_66(Provider<Schema_65> prior) {
|
||||
super(prior);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void migrateData(ReviewDb db, UpdateUI ui)
|
||||
throws OrmException, SQLException {
|
||||
final Statement stmt = ((JdbcSchema) db).getConnection().createStatement();
|
||||
try {
|
||||
stmt.executeUpdate("UPDATE accounts SET reverse_patch_set_order = 'Y' "+
|
||||
"WHERE display_patch_sets_in_reverse_order = 'Y'");
|
||||
stmt.executeUpdate("UPDATE accounts SET show_username_in_review_category = 'Y' " +
|
||||
"WHERE display_person_name_in_review_category = 'Y'");
|
||||
} finally {
|
||||
stmt.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user