content: package com.aaron.yespdf.common.greendao;
  
  import android.content.Context;
  import android.database.sqlite.SQLiteDatabase;
  import android.os.SystemClock;
  import android.util.Log;
  
  import com.aaron.yespdf.common.App;
  import com.aaron.yespdf.common.AppConfig;
  import com.aaron.yespdf.common.DBHelper;
  
  import org.greenrobot.greendao.database.Database;
  
  /**
   * @author Aaron aaronzzxup@gmail.com
   */
  public class UpdateOpenHelper extends DaoMaster.OpenHelper {
  
      public UpdateOpenHelper(Context context, String name) {
          super(context, name);
      }
  
      public UpdateOpenHelper(Context context, String name, SQLiteDatabase.CursorFactory factory) {
          super(context, name, factory);
      }
  
  
      @Override
      public void onUpgrade(Database db, int oldVersion, int newVersion) {
          super.onUpgrade(db, oldVersion, newVersion);
          Log.i("version", oldVersion + "---先前和更新之后的版本---" + newVersion);
          if (oldVersion < newVersion) {
              MigrationHelper.migrate(db, new MigrationHelper.ReCreateAllTableListener() {
                  @Override
                  public void onCreateAllTables(Database db, boolean ifNotExists) {
                      DaoMaster.createAllTables(db, ifNotExists);
                  }
  
                  @Override
                  public void onDropAllTables(Database db, boolean ifExists) {
                      DaoMaster.dropAllTables(db, ifExists);
                  }
              }, PDFDao.class, CollectionDao.class);
          }
      }
  }
  