package br.com.bloder.migration

import br.com.bloder.migration.internal.InternalMigration
import io.realm.DynamicRealm
import io.realm.RealmMigration

/**
 * Created by bloder on 24/09/16.
 */
class BetterMigration(internalMigration: InternalMigration) : RealmMigration {

    override fun migrate(realm: DynamicRealm?, oldVersion: Long, newVersion: Long) {

    }
}
package br.com.bloder.migration

import br.com.bloder.migration.internal.detail.MigrationDetail
import io.realm.DynamicRealm
import io.realm.RealmMigration

/**
 * Abstract better migration actions to transform in
 * a realm migration
 */
class BetterMigration(private val migration: MigrationDetail) : RealmMigration {

    /**
     * Realm Migration main function
     */
    override fun migrate(realm: DynamicRealm?, oldVersion: Long, newVersion: Long) {
        if (newVersion < oldVersion) {
            migration.migration?.down()
        }
        if (newVersion == migration.version) {
            migration.migration?.up()
        }
    }
}
Create up and down functions logic
Create up and down functions logic

ingresso-rapido-mobile/better-migrations,ingresso-rapido-mobile/better-migrations