@@ -2,6 +2,7 @@ package com.melonhead.lib_database.di
2
2
3
3
import androidx.room.Room
4
4
import com.melonhead.lib_database.chapter.ChapterDatabase
5
+ import com.melonhead.lib_database.manga.MangaDBMigrations
5
6
import com.melonhead.lib_database.manga.MangaDatabase
6
7
import com.melonhead.lib_database.readmarkers.ReadMarkerDatabase
7
8
import org.koin.dsl.module
@@ -11,21 +12,27 @@ val DBModule = module {
11
12
Room .databaseBuilder(
12
13
get(),
13
14
ChapterDatabase ::class .java, " chapter"
14
- ).fallbackToDestructiveMigration(). build()
15
+ ).build()
15
16
}
16
17
17
18
single(createdAtStart = true ) {
18
19
Room .databaseBuilder(
19
20
get(),
20
21
MangaDatabase ::class .java, " manga"
21
- ).fallbackToDestructiveMigration().build()
22
+ ).addMigrations(
23
+ MangaDBMigrations .MIGRATION_1_2 ,
24
+ MangaDBMigrations .MIGRATION_2_3 ,
25
+ MangaDBMigrations .MIGRATION_3_4 ,
26
+ MangaDBMigrations .MIGRATION_4_5 ,
27
+ MangaDBMigrations .MIGRATION_5_6 ,
28
+ ).build()
22
29
}
23
30
24
31
single(createdAtStart = true ) {
25
32
Room .databaseBuilder(
26
33
get(),
27
34
ReadMarkerDatabase ::class .java, " readmarker"
28
- ).fallbackToDestructiveMigration(). build()
35
+ ).build()
29
36
}
30
37
31
38
single {
0 commit comments