Add unique column ids to every column

These are necessary for gwtorm to map the entity onto either the
Thrift or protobuf encoding schemes, for storage in a system that
uses that style of object data encoding.

Change-Id: I50053fbe9a6d8023a3e0cd0c56ba39b3af0da665
Signed-off-by: Shawn O. Pearce <sop@google.com>
diff --git a/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/Account.java b/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/Account.java
index 7b45eee..3141fff 100644
--- a/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/Account.java
+++ b/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/Account.java
@@ -74,7 +74,7 @@
   public static class Id extends IntKey<com.google.gwtorm.client.Key<?>> {
     private static final long serialVersionUID = 1L;
 
-    @Column
+    @Column(id = 1)
     protected int id;
 
     protected Id() {
@@ -102,31 +102,31 @@
     }
   }
 
-  @Column
+  @Column(id = 1)
   protected Id accountId;
 
   /** Date and time the user registered with the review server. */
-  @Column
+  @Column(id = 2)
   protected Timestamp registeredOn;
 
   /** Full name of the user ("Given-name Surname" style). */
-  @Column(notNull = false)
+  @Column(id = 3, notNull = false)
   protected String fullName;
 
   /** Email address the user prefers to be contacted through. */
-  @Column(notNull = false)
+  @Column(id = 4, notNull = false)
   protected String preferredEmail;
 
   /** Username to authenticate as through SSH connections. */
-  @Column(notNull = false)
+  @Column(id = 5, notNull = false)
   protected String sshUserName;
 
   /** When did the user last give us contact information? Null if never. */
-  @Column(notNull = false)
+  @Column(id = 6, notNull = false)
   protected Timestamp contactFiledOn;
 
   /** This user's preferences */
-  @Column(name = Column.NONE)
+  @Column(id = 7, name = Column.NONE)
   protected AccountGeneralPreferences generalPreferences;
 
   protected Account() {
diff --git a/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/AccountAgreement.java b/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/AccountAgreement.java
index 8de6180..39ed66d 100644
--- a/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/AccountAgreement.java
+++ b/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/AccountAgreement.java
@@ -24,10 +24,10 @@
   public static class Key extends CompoundKey<Account.Id> {
     private static final long serialVersionUID = 1L;
 
-    @Column
+    @Column(id = 1)
     protected Account.Id accountId;
 
-    @Column
+    @Column(id = 2)
     protected ContributorAgreement.Id claId;
 
     protected Key() {
@@ -51,22 +51,22 @@
     }
   }
 
-  @Column(name = Column.NONE)
+  @Column(id = 1, name = Column.NONE)
   protected Key key;
 
-  @Column
+  @Column(id = 2)
   protected Timestamp acceptedOn;
 
-  @Column
+  @Column(id = 3)
   protected char status;
 
-  @Column(notNull = false)
+  @Column(id = 4, notNull = false)
   protected Account.Id reviewedBy;
 
-  @Column(notNull = false)
+  @Column(id = 5, notNull = false)
   protected Timestamp reviewedOn;
 
-  @Column(notNull = false, length = Integer.MAX_VALUE)
+  @Column(id = 6, notNull = false, length = Integer.MAX_VALUE)
   protected String reviewComments;
 
   protected AccountAgreement() {
diff --git a/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/AccountExternalId.java b/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/AccountExternalId.java
index 3b1896e..4c7cebc 100644
--- a/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/AccountExternalId.java
+++ b/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/AccountExternalId.java
@@ -27,7 +27,7 @@
   public static class Key extends StringKey<com.google.gwtorm.client.Key<?>> {
     private static final long serialVersionUID = 1L;
 
-    @Column
+    @Column(id = 1)
     protected String externalId;
 
     protected Key() {
@@ -48,13 +48,13 @@
     }
   }
 
-  @Column(name = Column.NONE)
+  @Column(id = 1, name = Column.NONE)
   protected Key key;
 
-  @Column
+  @Column(id = 2)
   protected Account.Id accountId;
 
-  @Column(notNull = false)
+  @Column(id = 3, notNull = false)
   protected String emailAddress;
 
   /** <i>computed value</i> is this identity trusted by the site administrator? */
diff --git a/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/AccountGeneralPreferences.java b/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/AccountGeneralPreferences.java
index cea77a0..6af89ce 100644
--- a/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/AccountGeneralPreferences.java
+++ b/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/AccountGeneralPreferences.java
@@ -35,19 +35,19 @@
   public static final short[] PAGESIZE_CHOICES = {10, 25, 50, 100};
 
   /** Default number of lines of context when viewing a patch. */
-  @Column
+  @Column(id = 1)
   protected short defaultContext;
 
   /** Number of changes to show in a screen. */
-  @Column
+  @Column(id = 2)
   protected short maximumPageSize;
 
   /** Should the site header be displayed when logged in ? */
-  @Column
+  @Column(id = 3)
   protected boolean showSiteHeader;
 
   /** Should the Flash helper movie be used to copy text to the clipboard? */
-  @Column
+  @Column(id = 4)
   protected boolean useFlashClipboard;
 
   public AccountGeneralPreferences() {
diff --git a/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/AccountGroup.java b/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/AccountGroup.java
index ea16d91..a02a958 100644
--- a/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/AccountGroup.java
+++ b/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/AccountGroup.java
@@ -25,7 +25,7 @@
       StringKey<com.google.gwtorm.client.Key<?>> {
     private static final long serialVersionUID = 1L;
 
-    @Column(length = 40)
+    @Column(id = 1, length = 40)
     protected String name;
 
     protected NameKey() {
@@ -51,7 +51,7 @@
       StringKey<com.google.gwtorm.client.Key<?>> {
     private static final long serialVersionUID = 1L;
 
-    @Column
+    @Column(id = 1)
     protected String name;
 
     protected ExternalNameKey() {
@@ -76,7 +76,7 @@
   public static class Id extends IntKey<com.google.gwtorm.client.Key<?>> {
     private static final long serialVersionUID = 1L;
 
-    @Column
+    @Column(id = 1)
     protected int id;
 
     protected Id() {
@@ -141,11 +141,11 @@
   }
 
   /** Unique name of this group within the system. */
-  @Column
+  @Column(id = 1)
   protected NameKey name;
 
   /** Unique identity, to link entities as {@link #name} can change. */
-  @Column
+  @Column(id = 2)
   protected Id groupId;
 
   /**
@@ -153,19 +153,19 @@
    * <p>
    * This can be a self-reference to indicate the group's members manage itself.
    */
-  @Column
+  @Column(id = 3)
   protected Id ownerGroupId;
 
   /** A textual description of the group's purpose. */
-  @Column(length = Integer.MAX_VALUE, notNull = false)
+  @Column(id = 4, length = Integer.MAX_VALUE, notNull = false)
   protected String description;
 
   /** Is the membership managed by some external means? */
-  @Column(length = 8)
+  @Column(id = 5, length = 8)
   protected String groupType;
 
   /** Distinguished name in the directory server. */
-  @Column(notNull = false)
+  @Column(id = 6, notNull = false)
   protected ExternalNameKey externalName;
 
   protected AccountGroup() {
diff --git a/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/AccountGroupAgreement.java b/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/AccountGroupAgreement.java
index 30c5421..e7c4ad0 100644
--- a/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/AccountGroupAgreement.java
+++ b/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/AccountGroupAgreement.java
@@ -26,10 +26,10 @@
   public static class Key extends CompoundKey<AccountGroup.Id> {
     private static final long serialVersionUID = 1L;
 
-    @Column
+    @Column(id = 1)
     protected AccountGroup.Id groupId;
 
-    @Column
+    @Column(id = 2)
     protected ContributorAgreement.Id claId;
 
     protected Key() {
@@ -53,22 +53,22 @@
     }
   }
 
-  @Column(name = Column.NONE)
+  @Column(id = 1, name = Column.NONE)
   protected Key key;
 
-  @Column
+  @Column(id = 2)
   protected Timestamp acceptedOn;
 
-  @Column
+  @Column(id = 3)
   protected char status;
 
-  @Column(notNull = false)
+  @Column(id = 4, notNull = false)
   protected Account.Id reviewedBy;
 
-  @Column(notNull = false)
+  @Column(id = 5, notNull = false)
   protected Timestamp reviewedOn;
 
-  @Column(notNull = false, length = Integer.MAX_VALUE)
+  @Column(id = 6, notNull = false, length = Integer.MAX_VALUE)
   protected String reviewComments;
 
   protected AccountGroupAgreement() {
diff --git a/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/AccountGroupMember.java b/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/AccountGroupMember.java
index 47d7e44..1ca9123 100644
--- a/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/AccountGroupMember.java
+++ b/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/AccountGroupMember.java
@@ -22,10 +22,10 @@
   public static class Key extends CompoundKey<Account.Id> {
     private static final long serialVersionUID = 1L;
 
-    @Column
+    @Column(id = 1)
     protected Account.Id accountId;
 
-    @Column
+    @Column(id = 2)
     protected AccountGroup.Id groupId;
 
     protected Key() {
@@ -53,7 +53,7 @@
     }
   }
 
-  @Column(name = Column.NONE)
+  @Column(id = 1, name = Column.NONE)
   protected Key key;
 
   protected AccountGroupMember() {
diff --git a/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/AccountGroupMemberAudit.java b/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/AccountGroupMemberAudit.java
index 75d2c13..e2ce939 100644
--- a/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/AccountGroupMemberAudit.java
+++ b/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/AccountGroupMemberAudit.java
@@ -24,13 +24,13 @@
   public static class Key extends CompoundKey<Account.Id> {
     private static final long serialVersionUID = 1L;
 
-    @Column
+    @Column(id = 1)
     protected Account.Id accountId;
 
-    @Column
+    @Column(id = 2)
     protected AccountGroup.Id groupId;
 
-    @Column
+    @Column(id = 3)
     protected Timestamp addedOn;
 
     protected Key() {
@@ -55,16 +55,16 @@
     }
   }
 
-  @Column(name = Column.NONE)
+  @Column(id = 1, name = Column.NONE)
   protected Key key;
 
-  @Column
+  @Column(id = 2)
   protected Account.Id addedBy;
 
-  @Column(notNull = false)
+  @Column(id = 3, notNull = false)
   protected Account.Id removedBy;
 
-  @Column(notNull = false)
+  @Column(id = 4, notNull = false)
   protected Timestamp removedOn;
 
   protected AccountGroupMemberAudit() {
diff --git a/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/AccountPatchReview.java b/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/AccountPatchReview.java
index 5a3ebee..4d16bb6 100644
--- a/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/AccountPatchReview.java
+++ b/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/AccountPatchReview.java
@@ -25,10 +25,10 @@
   public static class Key extends CompoundKey<Account.Id> {
     private static final long serialVersionUID = 1L;
 
-    @Column
+    @Column(id = 1)
     protected Account.Id accountId;
 
-    @Column(name = Column.NONE)
+    @Column(id = 2, name = Column.NONE)
     protected Patch.Key patchKey;
 
     protected Key() {
@@ -56,7 +56,7 @@
     }
   }
 
-  @Column(name = Column.NONE)
+  @Column(id = 1, name = Column.NONE)
   protected AccountPatchReview.Key key;
 
   protected AccountPatchReview() {
diff --git a/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/AccountProjectWatch.java b/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/AccountProjectWatch.java
index 3217186..5d1565b 100644
--- a/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/AccountProjectWatch.java
+++ b/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/AccountProjectWatch.java
@@ -22,10 +22,10 @@
   public static class Key extends CompoundKey<Account.Id> {
     private static final long serialVersionUID = 1L;
 
-    @Column
+    @Column(id = 1)
     protected Account.Id accountId;
 
-    @Column
+    @Column(id = 2)
     protected Project.NameKey projectName;
 
     protected Key() {
@@ -49,19 +49,19 @@
     }
   }
 
-  @Column(name = Column.NONE)
+  @Column(id = 1, name = Column.NONE)
   protected Key key;
 
   /** Automatically send email notifications of new changes? */
-  @Column
+  @Column(id = 2)
   protected boolean notifyNewChanges;
 
   /** Automatically receive comments published to this project */
-  @Column
+  @Column(id = 3)
   protected boolean notifyAllComments;
 
   /** Automatically receive changes submitted to this project */
-  @Column
+  @Column(id = 4)
   protected boolean notifySubmittedChanges;
 
   protected AccountProjectWatch() {
diff --git a/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/AccountSshKey.java b/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/AccountSshKey.java
index 3b021ac..7a79980 100644
--- a/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/AccountSshKey.java
+++ b/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/AccountSshKey.java
@@ -22,10 +22,10 @@
   public static class Id extends IntKey<Account.Id> {
     private static final long serialVersionUID = 1L;
 
-    @Column
+    @Column(id = 1)
     protected Account.Id accountId;
 
-    @Column
+    @Column(id = 2)
     protected int seq;
 
     protected Id() {
@@ -53,13 +53,13 @@
     }
   }
 
-  @Column(name = Column.NONE)
+  @Column(id = 1, name = Column.NONE)
   protected AccountSshKey.Id id;
 
-  @Column(length = Integer.MAX_VALUE)
+  @Column(id = 2, length = Integer.MAX_VALUE)
   protected String sshPublicKey;
 
-  @Column
+  @Column(id = 3)
   protected boolean valid;
 
   protected AccountSshKey() {
diff --git a/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/ApprovalCategory.java b/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/ApprovalCategory.java
index 789c2de..5a9a0be 100644
--- a/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/ApprovalCategory.java
+++ b/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/ApprovalCategory.java
@@ -48,7 +48,7 @@
   public static class Id extends StringKey<Key<?>> {
     private static final long serialVersionUID = 1L;
 
-    @Column(length = 4)
+    @Column(id = 1, length = 4)
     protected String id;
 
     protected Id() {
@@ -78,15 +78,15 @@
   }
 
   /** Internal short unique identifier for this category. */
-  @Column
+  @Column(id = 1)
   protected Id categoryId;
 
   /** Unique name for this category, shown in the web interface to users. */
-  @Column(length = 20)
+  @Column(id = 2, length = 20)
   protected String name;
 
   /** Abbreviated form of {@link #name} for display in very wide tables. */
-  @Column(length = 4, notNull = false)
+  @Column(id = 3, length = 4, notNull = false)
   protected String abbreviatedName;
 
   /**
@@ -99,15 +99,15 @@
    * If >= 0 this category is shown in the Approvals table, sorted along with
    * its siblings by <code>position, name</code>.
    */
-  @Column
+  @Column(id = 4)
   protected short position;
 
   /** Identity of the function used to aggregate the category's value. */
-  @Column
+  @Column(id = 5)
   protected String functionName;
 
   /** If set, the minimum score is copied during patch set replacement. */
-  @Column
+  @Column(id = 6)
   protected boolean copyMinScore;
 
   protected ApprovalCategory() {
diff --git a/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/ApprovalCategoryValue.java b/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/ApprovalCategoryValue.java
index c91dacb..84f0a17 100644
--- a/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/ApprovalCategoryValue.java
+++ b/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/ApprovalCategoryValue.java
@@ -22,10 +22,10 @@
   public static class Id extends ShortKey<ApprovalCategory.Id> {
     private static final long serialVersionUID = 1L;
 
-    @Column
+    @Column(id = 1)
     protected ApprovalCategory.Id categoryId;
 
-    @Column
+    @Column(id = 2)
     protected short value;
 
     protected Id() {
@@ -53,10 +53,10 @@
     }
   }
 
-  @Column(name = Column.NONE)
+  @Column(id = 1, name = Column.NONE)
   protected Id key;
 
-  @Column(length = 50)
+  @Column(id = 2, length = 50)
   protected String name;
 
   protected ApprovalCategoryValue() {
diff --git a/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/Branch.java b/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/Branch.java
index 0a3b392..2bacc63 100644
--- a/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/Branch.java
+++ b/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/Branch.java
@@ -26,10 +26,10 @@
   public static class NameKey extends StringKey<Project.NameKey> {
     private static final long serialVersionUID = 1L;
 
-    @Column
+    @Column(id = 1)
     protected Project.NameKey projectName;
 
-    @Column
+    @Column(id = 2)
     protected String branchName;
 
     protected NameKey() {
diff --git a/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/Change.java b/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/Change.java
index 86104eb..db0889b 100644
--- a/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/Change.java
+++ b/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/Change.java
@@ -101,7 +101,7 @@
   public static class Id extends IntKey<com.google.gwtorm.client.Key<?>> {
     private static final long serialVersionUID = 1L;
 
-    @Column
+    @Column(id = 1)
     protected int id;
 
     protected Id() {
@@ -133,7 +133,7 @@
   public static class Key extends StringKey<com.google.gwtorm.client.Key<?>> {
     private static final long serialVersionUID = 1L;
 
-    @Column(length = 60)
+    @Column(id = 1, length = 60)
     protected String id;
 
     protected Key() {
@@ -292,20 +292,20 @@
   }
 
   /** Locally assigned unique identifier of the change */
-  @Column
+  @Column(id = 1)
   protected Id changeId;
 
   /** Globally assigned unique identifier of the change */
-  @Column
+  @Column(id = 2)
   protected Key changeKey;
 
   /** optimistic locking */
-  @Column
+  @Column(id = 3)
   @RowVersion
   protected int rowVersion;
 
   /** When this change was first introduced into the database. */
-  @Column
+  @Column(id = 4)
   protected Timestamp createdOn;
 
   /**
@@ -313,38 +313,38 @@
    * <p>
    * Note, this update timestamp includes its children.
    */
-  @Column
+  @Column(id = 5)
   protected Timestamp lastUpdatedOn;
 
   /** A {@link #lastUpdatedOn} ASC,{@link #changeId} ASC for sorting. */
-  @Column(length = 16)
+  @Column(id = 6, length = 16)
   protected String sortKey;
 
-  @Column(name = "owner_account_id")
+  @Column(id = 7, name = "owner_account_id")
   protected Account.Id owner;
 
   /** The branch (and project) this change merges into. */
-  @Column
+  @Column(id = 8)
   protected Branch.NameKey dest;
 
   /** Is the change currently open? Set to {@link #status}.isOpen(). */
-  @Column
+  @Column(id = 9)
   protected boolean open;
 
   /** Current state code; see {@link Status}. */
-  @Column
+  @Column(id = 10)
   protected char status;
 
   /** The total number of {@link PatchSet} children in this Change. */
-  @Column
+  @Column(id = 11)
   protected int nbrPatchSets;
 
   /** The current patch set. */
-  @Column
+  @Column(id = 12)
   protected int currentPatchSetId;
 
   /** Subject from the current patch set. */
-  @Column
+  @Column(id = 13)
   protected String subject;
 
   protected Change() {
diff --git a/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/ChangeMessage.java b/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/ChangeMessage.java
index 5b27aed..56c36c8 100644
--- a/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/ChangeMessage.java
+++ b/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/ChangeMessage.java
@@ -24,10 +24,10 @@
   public static class Key extends StringKey<Change.Id> {
     private static final long serialVersionUID = 1L;
 
-    @Column
+    @Column(id = 1)
     protected Change.Id changeId;
 
-    @Column(length = 40)
+    @Column(id = 2, length = 40)
     protected String uuid;
 
     protected Key() {
@@ -55,19 +55,19 @@
     }
   }
 
-  @Column(name = Column.NONE)
+  @Column(id = 1, name = Column.NONE)
   protected Key key;
 
   /** Who wrote this comment; null if it was written by the Gerrit system. */
-  @Column(name = "author_id", notNull = false)
+  @Column(id = 2, name = "author_id", notNull = false)
   protected Account.Id author;
 
   /** When this comment was drafted. */
-  @Column
+  @Column(id = 3)
   protected Timestamp writtenOn;
 
   /** The text left by the user. */
-  @Column(notNull = false, length = Integer.MAX_VALUE)
+  @Column(id = 4, notNull = false, length = Integer.MAX_VALUE)
   protected String message;
 
   protected ChangeMessage() {
diff --git a/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/ContactInformation.java b/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/ContactInformation.java
index b8af779..d28467c 100644
--- a/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/ContactInformation.java
+++ b/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/ContactInformation.java
@@ -18,16 +18,16 @@
 
 /** Non-Internet contact details, such as a postal address and telephone. */
 public final class ContactInformation {
-  @Column(length = Integer.MAX_VALUE, notNull = false)
+  @Column(id = 1, length = Integer.MAX_VALUE, notNull = false)
   protected String address;
 
-  @Column(notNull = false, length = 40)
+  @Column(id = 2, notNull = false, length = 40)
   protected String country;
 
-  @Column(notNull = false, length = 30)
+  @Column(id = 3, notNull = false, length = 30)
   protected String phoneNbr;
 
-  @Column(notNull = false, length = 30)
+  @Column(id = 4, notNull = false, length = 30)
   protected String faxNbr;
 
   public ContactInformation() {
diff --git a/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/ContributorAgreement.java b/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/ContributorAgreement.java
index ba22ffb..9e285b8 100644
--- a/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/ContributorAgreement.java
+++ b/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/ContributorAgreement.java
@@ -26,7 +26,7 @@
   public static class Id extends IntKey<com.google.gwtorm.client.Key<?>> {
     private static final long serialVersionUID = 1L;
 
-    @Column(name = "cla_id")
+    @Column(id = 1, name = "cla_id")
     protected int id;
 
     protected Id() {
@@ -47,31 +47,31 @@
     }
   }
 
-  @Column
+  @Column(id = 1)
   protected Id id;
 
   /** Is this an active agreement contributors can use. */
-  @Column
+  @Column(id = 2)
   protected boolean active;
 
   /** Does this agreement require the {@link Account} to have contact details? */
-  @Column
+  @Column(id = 3)
   protected boolean requireContactInformation;
 
   /** Does this agreement automatically verify new accounts? */
-  @Column
+  @Column(id = 4)
   protected boolean autoVerify;
 
   /** A short name for the agreement. */
-  @Column(length = 40)
+  @Column(id = 5, length = 40)
   protected String shortName;
 
   /** A short one-line description text to appear next to the name. */
-  @Column(notNull = false)
+  @Column(id = 6, notNull = false)
   protected String shortDescription;
 
   /** Web address of the agreement documentation. */
-  @Column
+  @Column(id = 7)
   protected String agreementUrl;
 
   protected ContributorAgreement() {
diff --git a/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/CurrentSchemaVersion.java b/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/CurrentSchemaVersion.java
index 2a6e980..8878225 100644
--- a/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/CurrentSchemaVersion.java
+++ b/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/CurrentSchemaVersion.java
@@ -25,7 +25,7 @@
 
     private static final String VALUE = "X";
 
-    @Column(length = 1)
+    @Column(id = 1, length = 1)
     protected String one = VALUE;
 
     public Key() {
@@ -49,11 +49,11 @@
     return r;
   }
 
-  @Column
+  @Column(id = 1)
   protected Key singleton;
 
   /** Current version number of the schema. */
-  @Column
+  @Column(id = 2)
   public transient int versionNbr;
 
   protected CurrentSchemaVersion() {
diff --git a/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/Patch.java b/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/Patch.java
index 8f05379..22ec747 100644
--- a/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/Patch.java
+++ b/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/Patch.java
@@ -22,10 +22,10 @@
   public static class Key extends StringKey<PatchSet.Id> {
     private static final long serialVersionUID = 1L;
 
-    @Column(name = Column.NONE)
+    @Column(id = 1, name = Column.NONE)
     protected PatchSet.Id patchSetId;
 
-    @Column
+    @Column(id = 2)
     protected String fileName;
 
     protected Key() {
diff --git a/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/PatchLineComment.java b/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/PatchLineComment.java
index a9c419c..0828c95 100644
--- a/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/PatchLineComment.java
+++ b/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/PatchLineComment.java
@@ -24,10 +24,10 @@
   public static class Key extends StringKey<Patch.Key> {
     private static final long serialVersionUID = 1L;
 
-    @Column(name = Column.NONE)
+    @Column(id = 1, name = Column.NONE)
     protected Patch.Key patchKey;
 
-    @Column(length = 40)
+    @Column(id = 2, length = 40)
     protected String uuid;
 
     protected Key() {
@@ -83,35 +83,38 @@
     }
   }
 
-  @Column(name = Column.NONE)
+  @Column(id = 1, name = Column.NONE)
   protected Key key;
 
   /** Line number this comment applies to; it should display after the line. */
-  @Column
+  @Column(id = 2)
   protected int lineNbr;
 
   /** Who wrote this comment. */
-  @Column(name = "author_id")
+  @Column(id = 3, name = "author_id")
   protected Account.Id author;
 
   /** When this comment was drafted. */
-  @Column
+  @Column(id = 4)
   protected Timestamp writtenOn;
 
   /** Current publication state of the comment; see {@link Status}. */
-  @Column
+  @Column(id = 5)
   protected char status;
 
   /** Which file is this comment; 0 is ancestor, 1 is new version. */
-  @Column
+  @Column(id = 6)
   protected short side;
 
   /** The text left by the user. */
-  @Column(notNull = false, length = Integer.MAX_VALUE)
+  @Column(id = 7, notNull = false, length = Integer.MAX_VALUE)
   protected String message;
 
-  /** The parent of this comment, or null if this is the first comment on this line */
-  @Column(length = 40, notNull = false)
+  /**
+   * The parent of this comment, or null if this is the first comment on this
+   * line
+   */
+  @Column(id = 8, length = 40, notNull = false)
   protected String parentUuid;
 
   protected PatchLineComment() {
diff --git a/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/PatchSet.java b/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/PatchSet.java
index 771981c..c46a849 100644
--- a/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/PatchSet.java
+++ b/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/PatchSet.java
@@ -31,10 +31,10 @@
   public static class Id extends IntKey<Change.Id> {
     private static final long serialVersionUID = 1L;
 
-    @Column
+    @Column(id = 1)
     protected Change.Id changeId;
 
-    @Column
+    @Column(id = 2)
     protected int patchSetId;
 
     protected Id() {
@@ -84,17 +84,17 @@
     }
   }
 
-  @Column(name = Column.NONE)
+  @Column(id = 1, name = Column.NONE)
   protected Id id;
 
-  @Column(notNull = false)
+  @Column(id = 2, notNull = false)
   protected RevId revision;
 
-  @Column(name = "uploader_account_id")
+  @Column(id = 3, name = "uploader_account_id")
   protected Account.Id uploader;
 
   /** When this patch set was first introduced onto the change. */
-  @Column
+  @Column(id = 4)
   protected Timestamp createdOn;
 
   protected PatchSet() {
diff --git a/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/PatchSetAncestor.java b/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/PatchSetAncestor.java
index f22d3f7..8310e4d 100644
--- a/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/PatchSetAncestor.java
+++ b/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/PatchSetAncestor.java
@@ -22,10 +22,10 @@
   public static class Id extends IntKey<PatchSet.Id> {
     private static final long serialVersionUID = 1L;
 
-    @Column(name = Column.NONE)
+    @Column(id = 1, name = Column.NONE)
     protected PatchSet.Id patchSetId;
 
-    @Column
+    @Column(id = 2)
     protected int position;
 
     protected Id() {
@@ -53,10 +53,10 @@
     }
   }
 
-  @Column(name = Column.NONE)
+  @Column(id = 1, name = Column.NONE)
   protected Id key;
 
-  @Column
+  @Column(id = 2)
   protected RevId ancestorRevision;
 
   protected PatchSetAncestor() {
diff --git a/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/PatchSetApproval.java b/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/PatchSetApproval.java
index b3a58df..341d085 100644
--- a/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/PatchSetApproval.java
+++ b/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/PatchSetApproval.java
@@ -24,13 +24,13 @@
   public static class Key extends CompoundKey<PatchSet.Id> {
     private static final long serialVersionUID = 1L;
 
-    @Column(name = Column.NONE)
+    @Column(id = 1, name = Column.NONE)
     protected PatchSet.Id patchSetId;
 
-    @Column
+    @Column(id = 2)
     protected Account.Id accountId;
 
-    @Column
+    @Column(id = 3)
     protected ApprovalCategory.Id categoryId;
 
     protected Key() {
@@ -57,7 +57,7 @@
     }
   }
 
-  @Column(name = Column.NONE)
+  @Column(id = 1, name = Column.NONE)
   protected Key key;
 
   /**
@@ -74,18 +74,18 @@
    * and in the negative and positive direction a magnitude can be assumed.The
    * further from 0 the more assertive the approval.
    */
-  @Column
+  @Column(id = 2)
   protected short value;
 
-  @Column
+  @Column(id = 3)
   protected Timestamp granted;
 
   /** <i>Cached copy of Change.open.</i> */
-  @Column
+  @Column(id = 4)
   protected boolean changeOpen;
 
   /** <i>Cached copy of Change.sortKey</i>; only if {@link #changeOpen} = false */
-  @Column(length = 16, notNull = false)
+  @Column(id = 5, length = 16, notNull = false)
   protected String changeSortKey;
 
   protected PatchSetApproval() {
diff --git a/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/Project.java b/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/Project.java
index ae79919..d640c37 100644
--- a/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/Project.java
+++ b/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/Project.java
@@ -25,7 +25,7 @@
       StringKey<com.google.gwtorm.client.Key<?>> {
     private static final long serialVersionUID = 1L;
 
-    @Column
+    @Column(id = 1)
     protected String name;
 
     protected NameKey() {
@@ -57,7 +57,7 @@
   public static class Id extends IntKey<com.google.gwtorm.client.Key<?>> {
     private static final long serialVersionUID = 1L;
 
-    @Column
+    @Column(id = 1)
     protected int id;
 
     protected Id() {
@@ -107,22 +107,22 @@
     }
   }
 
-  @Column
+  @Column(id = 1)
   protected NameKey name;
 
-  @Column
+  @Column(id = 2)
   protected Id projectId;
 
-  @Column(length = Integer.MAX_VALUE, notNull = false)
+  @Column(id = 3, length = Integer.MAX_VALUE, notNull = false)
   protected String description;
 
-  @Column
+  @Column(id = 4)
   protected boolean useContributorAgreements;
 
-  @Column
+  @Column(id = 5)
   protected boolean useSignedOffBy;
 
-  @Column
+  @Column(id = 6)
   protected char submitType;
 
   protected Project() {
diff --git a/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/ProjectRight.java b/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/ProjectRight.java
index 7dddc28..af78d4c 100644
--- a/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/ProjectRight.java
+++ b/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/ProjectRight.java
@@ -22,13 +22,13 @@
   public static class Key extends CompoundKey<Project.NameKey> {
     private static final long serialVersionUID = 1L;
 
-    @Column
+    @Column(id = 1)
     protected Project.NameKey projectName;
 
-    @Column
+    @Column(id = 2)
     protected ApprovalCategory.Id categoryId;
 
-    @Column
+    @Column(id = 3)
     protected AccountGroup.Id groupId;
 
     protected Key() {
@@ -59,13 +59,13 @@
     }
   }
 
-  @Column(name = Column.NONE)
+  @Column(id = 1, name = Column.NONE)
   protected Key key;
 
-  @Column
+  @Column(id = 2)
   protected short minValue;
 
-  @Column
+  @Column(id = 3)
   protected short maxValue;
 
   protected ProjectRight() {
diff --git a/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/RevId.java b/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/RevId.java
index bea6fb8..7077312 100644
--- a/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/RevId.java
+++ b/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/RevId.java
@@ -20,7 +20,7 @@
 public final class RevId {
   public static final int LEN = 40;
 
-  @Column(length = LEN)
+  @Column(id = 1, length = LEN)
   protected String id;
 
   protected RevId() {
diff --git a/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/StarredChange.java b/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/StarredChange.java
index 2f63079..7e4359b 100644
--- a/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/StarredChange.java
+++ b/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/StarredChange.java
@@ -22,10 +22,10 @@
   public static class Key extends CompoundKey<Account.Id> {
     private static final long serialVersionUID = 1L;
 
-    @Column
+    @Column(id = 1)
     protected Account.Id accountId;
 
-    @Column
+    @Column(id = 2)
     protected Change.Id changeId;
 
     protected Key() {
@@ -49,7 +49,7 @@
     }
   }
 
-  @Column(name = Column.NONE)
+  @Column(id = 1, name = Column.NONE)
   protected Key key;
 
   protected StarredChange() {
diff --git a/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/SystemConfig.java b/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/SystemConfig.java
index 3238bb0..a94244c 100644
--- a/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/SystemConfig.java
+++ b/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/SystemConfig.java
@@ -25,7 +25,7 @@
 
     private static final String VALUE = "X";
 
-    @Column(length = 1)
+    @Column(id = 1, length = 1)
     protected String one = VALUE;
 
     public Key() {
@@ -49,29 +49,29 @@
     return r;
   }
 
-  @Column
+  @Column(id = 1)
   protected Key singleton;
 
   /** Private key to sign account identification cookies. */
-  @Column(length = 36)
+  @Column(id = 2, length = 36)
   public transient String registerEmailPrivateKey;
 
   /**
    * Local filesystem location of header/footer/CSS configuration files
    */
-  @Column(notNull = false)
+  @Column(id = 3, notNull = false)
   public transient String sitePath;
 
   /** Identity of the administration group; those with full access. */
-  @Column
+  @Column(id = 4)
   public AccountGroup.Id adminGroupId;
 
   /** Identity of the anonymous group, which permits anyone. */
-  @Column
+  @Column(id = 5)
   public AccountGroup.Id anonymousGroupId;
 
   /** Identity of the registered users group, which permits anyone. */
-  @Column
+  @Column(id = 6)
   public AccountGroup.Id registeredGroupId;
 
   protected SystemConfig() {