Skip to content
Permalink
Browse files

Try out Roomigrant for automatic migrations

  • Loading branch information...
chrisbanes committed Aug 25, 2019
1 parent 747cc66 commit 64c5f4cbadc7b07096e5371d065688c854b4fbac
@@ -61,6 +61,7 @@ allprojects {
google()
mavenCentral()
jcenter()
maven { url 'https://jitpack.io' }
mavenLocal()
}
}
@@ -183,4 +183,10 @@ object Libs {
const val annotationDagger2 = "com.squareup.inject:assisted-inject-annotations-dagger2:$version"
const val processorDagger2 = "com.squareup.inject:assisted-inject-processor-dagger2:$version"
}

object Roomigrant {
private const val version = "0.1.7"
const val library = "com.github.MatrixDev.Roomigrant:RoomigrantLib:$version"
const val compiler = "com.github.MatrixDev.Roomigrant:RoomigrantCompiler:$version"
}
}
@@ -70,6 +70,9 @@ dependencies {
implementation Libs.AndroidX.Room.runtime
kapt Libs.AndroidX.Room.compiler

implementation Libs.Roomigrant.library
kapt Libs.Roomigrant.compiler

implementation Libs.AndroidX.Paging.runtime

kapt Libs.Dagger.compiler
@@ -29,6 +29,7 @@ class DatabaseModule {
@Provides
fun provideDatabase(context: Context): TiviRoomDatabase {
val builder = Room.databaseBuilder(context, TiviRoomDatabase::class.java, "shows.db")
.addMigrations(*TiviRoomDatabase_Migrations.build())
.fallbackToDestructiveMigration()
if (Debug.isDebuggerConnected()) {
builder.allowMainThreadQueries()
@@ -36,6 +36,7 @@ import app.tivi.data.entities.WatchedShowEntry
import app.tivi.data.views.FollowedShowsLastWatched
import app.tivi.data.views.FollowedShowsNextToWatch
import app.tivi.data.views.FollowedShowsWatchStats
import dev.matrix.roomigrant.GenerateRoomMigrations

@Database(
entities = [
@@ -62,4 +63,5 @@ import app.tivi.data.views.FollowedShowsWatchStats
version = 25
)
@TypeConverters(TiviTypeConverters::class)
@GenerateRoomMigrations
abstract class TiviRoomDatabase : RoomDatabase(), TiviDatabase

0 comments on commit 64c5f4c

Please sign in to comment.
You can’t perform that action at this time.