|
|
@ -25,8 +25,8 @@ abstract class AppDatabase : RoomDatabase() { |
|
|
|
|
|
|
|
|
|
|
|
private const val DATABASE_NAME = "legado.db" |
|
|
|
private const val DATABASE_NAME = "legado.db" |
|
|
|
|
|
|
|
|
|
|
|
fun createDatabase(context: Context): AppDatabase { |
|
|
|
fun createDatabase(context: Context) = |
|
|
|
return Room.databaseBuilder(context, AppDatabase::class.java, DATABASE_NAME) |
|
|
|
Room.databaseBuilder(context, AppDatabase::class.java, DATABASE_NAME) |
|
|
|
.fallbackToDestructiveMigration() |
|
|
|
.fallbackToDestructiveMigration() |
|
|
|
.addMigrations( |
|
|
|
.addMigrations( |
|
|
|
migration_10_11, |
|
|
|
migration_10_11, |
|
|
@ -41,7 +41,6 @@ abstract class AppDatabase : RoomDatabase() { |
|
|
|
) |
|
|
|
) |
|
|
|
.allowMainThreadQueries() |
|
|
|
.allowMainThreadQueries() |
|
|
|
.build() |
|
|
|
.build() |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private val migration_10_11 = object: Migration(10, 11) { |
|
|
|
private val migration_10_11 = object: Migration(10, 11) { |
|
|
|
override fun migrate(database: SupportSQLiteDatabase) { |
|
|
|
override fun migrate(database: SupportSQLiteDatabase) { |
|
|
|