title: Migration not working in room database
body: <p>Hello friends i m trying to do migration in room database in my application so below is my code</p>
  
  <p>First i have employee table and done with CRUD operation on it. Now i add other table Department so i have to perform migration for that with old data remain as it is so i make classes and interface for Department class as below</p>
  
  <p><strong>Entity class</strong></p>
  
  <pre><code> @Entity
  public class Department implements Serializable {
      @PrimaryKey(autoGenerate = true)
      public long department_id;
  
      @ForeignKey(entity = Employee.class,
      parentColumns = "employee_id",
      childColumns = "eid", onDelete = CASCADE)
      String department_name;
      String eid;
  
      public long getDepartment_id() {
          return department_id;
      }
  
      public void setDepartment_id(long department_id) {
          this.department_id = department_id;
      }
  
      public String getDepartment_name() {
          return department_name;
      }
  
      public void setDepartment_name(String department_name) {
          this.department_name = department_name;
      }
  
      public String getEid() {
          return eid;
      }
  
      public void setEid(String eid) {
          this.eid = eid;
        }
      }
  </code></pre>
  
  <p><strong>DAO class</strong></p>
  
  <p>@Dao
  public interface DepartmentDao {</p>
  
  <pre><code>@Query("SELECT * FROM department")
  List&lt;Department&gt; getAll();
  
  @Insert
  Long[] insertAll(Department... users);
  
  @Update
  int updateDepartment(Department... users);
  
  @Delete
  void delete(Department user);
  </code></pre>
  
  <p>}</p>
  
  <p>Appdatabase.java</p>
  
  <pre><code>@Database(entities = {Employee.class, Department.class}, version = 2)
  public abstract class AppDatabase extends RoomDatabase {
  public abstract EmployeeDao employeeDao();
  public abstract DepartmentDao departmentDao();
  }
  </code></pre>
  
  <p><strong>AppName.java</strong></p>
  
  <pre><code>public class AppName extends Application {
  
  
  // Room persistence API
  AppDatabase db;
  
  @Override
  public void onCreate() {
     // ACRA.init(this);
      super.onCreate();
  
      // Room persistence API
      //this will create and build database and also from here you can control the migration process.
      db = Room.databaseBuilder(getApplicationContext(), AppDatabase.class, "Employee").allowMainThreadQueries().addMigrations(MIGRATION_1_2).build();
  
  }
  
  /**
   * Room persistence API
   * This is migration of database version 1 and 2
   */
  private static final Migration MIGRATION_1_2 = new Migration(1, 2) {
      @Override
      public void migrate(SupportSQLiteDatabase database) {
          //here you can do your migration changes of database
         /* database.execSQL("CREATE TABLE `Department` (`department_id` INTEGER, "
                  + "`eid` INTEGER, 'department_name' TEXT, PRIMARY KEY(`department_id`))");*/
          database.execSQL(
                  "CREATE TABLE Department (department_id INTEGER NOT NULL,"
                          + "department_name,"
                          + "eid INTEGER,"
                          + "PRIMARY KEY(department_id))");
      }
  
  };
  
  /**
   * Room persistence API
   */
  public AppDatabase getDatabase() {
      return db;
  }
  
  @Override
  public void onConfigurationChanged(Configuration newConfig) {
      super.onConfigurationChanged(newConfig);
  }
  
  @Override
  public void onLowMemory() {
      super.onLowMemory();
  }
  
  @Override
  public void onTerminate() {
      super.onTerminate();
  }
  
  @Override
  public void onTrimMemory(int p_level) {
      super.onTrimMemory(p_level);
     }
   }
  </code></pre>
  
  <p>When i run above code i get error like below</p>
  
  <pre><code>Caused by: java.lang.IllegalStateException: Migration didn't properly
  handle Department(entity.Department). Expected:                       
  TableInfo{name='Department',
  columns={department_id=Column{name='department_id', type='INTEGER',
  notNull=true, primaryKeyPosition=1}, eid=Column{name='eid',
  type='TEXT', notNull=false, primaryKeyPosition=0},
  department_name=Column{name='department_name', type='TEXT',
  notNull=false, primaryKeyPosition=0}}, foreignKeys=[], indices=[]}
  </code></pre>
  
  <p>Ant idea how can i solve this ?</p>