io.realm.RealmMigration Java Examples

The following examples show how to use io.realm.RealmMigration. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MoeQuestApp.java    From MoeQuest with Apache License 2.0 6 votes vote down vote up
@Override
public void onCreate() {

  super.onCreate();
  mAppContext = this;
  // 配置Realm数据库
  RealmConfiguration configuration = new RealmConfiguration
      .Builder(this)
      .deleteRealmIfMigrationNeeded()
      .schemaVersion(6)
      .migration(new RealmMigration() {

        @Override
        public void migrate(DynamicRealm realm, long oldVersion, long newVersion) {

        }
      }).build();

  Realm.setDefaultConfiguration(configuration);

  //配置腾讯bugly
  CrashReport.initCrashReport(getApplicationContext(), ConstantUtil.BUGLY_ID, false);
}
 
Example #2
Source File: DbMigrationManager.java    From AcgClub with MIT License 5 votes vote down vote up
@Override
public void injectDbMigrations(RealmMigration... dbMigrations) {
  int currentHashCode;
  for (RealmMigration migration : dbMigrations) {
    currentHashCode = migration.hashCode();
    if (mMigrattions.containsKey(currentHashCode)) {
      continue;
    }
    mMigrattions.put(currentHashCode, migration);
  }
}
 
Example #3
Source File: DbMigrationManager.java    From AcgClub with MIT License 4 votes vote down vote up
@Override
public void migrate(DynamicRealm realm, long oldVersion, long newVersion) {
  for (Entry<Integer, RealmMigration> migration : mMigrattions.entrySet()) {
    migration.getValue().migrate(realm, oldVersion, newVersion);
  }
}
 
Example #4
Source File: Migration.java    From natrium-android-wallet with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
public boolean equals(Object o) {
    return (o instanceof RealmMigration);
}
 
Example #5
Source File: Migration.java    From nano-wallet-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
public boolean equals(Object o) {
    return (o instanceof RealmMigration);
}
 
Example #6
Source File: IDbMigrationManager.java    From AcgClub with MIT License 2 votes vote down vote up
/**
 * 使用{@link RealmMigration}注入各个组件中编写的迁移
 */
void injectDbMigrations(RealmMigration... dbMigrations);