Skip to content

Testing migrations #1

Open
Open
@reixa00

Description

@reixa00

This should be more a question than an issue, don't know if theres a StackOverflow tag to ask them there, feel free to close if so.

At the moment I'm testing the migrations that I use like this:

@SmallTest
class MigrationTest {

    private val TEST_DB = "migration-test"

    @get:Rule
    var helper: MigrationTestHelper? = null

    init {
        helper = MigrationTestHelper(InstrumentationRegistry.getInstrumentation(),
                AnomalyDatabase::class.java.canonicalName, FrameworkSQLiteOpenHelperFactory())
    }

    @Test
    fun migrate57To58() {
        val db = helper?.createDatabase(TEST_DB, 57)
        db?.close()
        helper?.runMigrationsAndValidate(TEST_DB, 58, true, DBMigrations.MIGRATION_57_58)
    }
}

Is there a way to test the migrations created by the library? Maybe being created at compile time makes this task difficult.

Thanks in advance. I really think this could be a powerful tool.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions