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 && newVersion == migration.version) {
            migration.migration?.down()
        }
        if (newVersion == migration.version) {
            migration.migration?.up()
        }
    }
}
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 (migration.version > newVersion) {
            migration.migration?.down(realm)
        }
        if (newVersion == migration.version) {
            migration.migration?.up(realm)
        }
    }
}
Fix wrong param in better migration class
Fix wrong param in better migration class

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