title: How do i run migration in Room Database to change primary key?
body: <p>This is my table: the <code>id</code> column is <em>primary key</em>. I want to make <code>Doorway id</code> and <code>id</code> a <em>composite key</em>. Does <code>Room</code> supports that? If it does how can I do that?</p>
  
  <p>New <em>Primary key</em> should be <em>composite</em> and should be like this:</p>
  
  <pre><code>primary key = id+doorway_id
  </code></pre>
  
  <p>My entity: </p>
  
  <pre><code>@Entity(tableName = "hours")
  public class Hour extends EntityModel implements Parcelable {
      @SerializedName("id")
      @ColumnInfo(name = COLUMN_ID)
      @PrimaryKey()
      @Expose()
      private int _id;
  
      // Need to discuss.
      @SerializedName("server_id")
      @ColumnInfo(name = COLUMN_SERVER_ID)
      private int serverId;
  
      @SerializedName("entries")
      @ColumnInfo(name = COLUMN_ENTRIES)
      @Expose()
      private float entries;
  
      @SerializedName("alerts")
      @ColumnInfo(name = COLUMN_ALERTS)
      @Expose()
      private float alerts;
  
      @SerializedName("mag_level")
      @ColumnInfo(name = COLUMN_MAG_LEVEL)
      @Expose()
      private float magLevel;
  
      @SerializedName("door_open")
      @ColumnInfo(name = COLUMN_DOOR_OPEN)
      @Expose()
      private float doorOpen;
  
      @SerializedName("entryway_usage")
      @ColumnInfo(name = COLUMN_ENTRYWAY_USAGE)
      @Expose()
      private float entrywayUsage;
  
      @SerializedName("year")
      @ColumnInfo(name = COLUMN_YEAR)
      @Expose()
      private int year;
  
      @SerializedName("month")
      @ColumnInfo(name = COLUMN_MONTH)
      @Expose()
      private int month;
  
      @SerializedName("day")
      @ColumnInfo(name = COLUMN_DAY)
      @Expose()
      private int day;
  
      @SerializedName("hour")
      @ColumnInfo(name = COLUMN_HOUR)
      @Expose()
      private int hour;
  
      @SerializedName("alert_rate")
      @Expose
      @ColumnInfo(name = COLUMN_ALERT_RATE)
      private double alert_rate;
  
      @SerializedName("recorded_at")
      @Expose
      @ColumnInfo(name = COLUMN_TIME_STAMP)
      private String recorded_at;
  
      @SerializedName("doorway_id")
      @ColumnInfo(name = COLUMN_DOORWAY_ID)
      @Expose()
      private int doorway_id;
  }
  </code></pre>