Skip to content

Instantly share code, notes, and snippets.

@dextorer
Created May 23, 2019 08:05
Show Gist options
  • Save dextorer/a43adb5c49b568d3ca396b9d10b6b5bd to your computer and use it in GitHub Desktop.
Save dextorer/a43adb5c49b568d3ca396b9d10b6b5bd to your computer and use it in GitHub Desktop.
fun getDatabase(context: Context) =
Room
.databaseBuilder(context, RoomDatabase::class.java, DB_NAME)
.openHelperFactory(AssetSQLiteOpenHelperFactory())
.fallbackToDestructiveMigrationFrom(*IntArray(68) { it + 1 }) // destroy everything before version 68 (included)
.addMigrations(
Migration69to70(),
Migration70to71(),
Migration71to72(),
Migration72to73(),
Migration73to74()
)
.build()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment