Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions history/history-impl/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ dependencies {

implementation project(path: ':common-utils')
implementation project(path: ':browser-api')
implementation project(path: ':data-store-api')
implementation project(path: ':feature-toggles-api')
implementation project(path: ':privacy-config-api')
implementation project(path: ':app-build-config-api')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@
package com.duckduckgo.history.impl

import android.content.Context
import androidx.room.Room
import com.duckduckgo.app.di.AppCoroutineScope
import com.duckduckgo.common.utils.DispatcherProvider
import com.duckduckgo.data.store.api.DatabaseProvider
import com.duckduckgo.data.store.api.RoomDatabaseConfig
import com.duckduckgo.di.scopes.AppScope
import com.duckduckgo.history.impl.store.ALL_MIGRATIONS
import com.duckduckgo.history.impl.store.HistoryDataStore
Expand Down Expand Up @@ -48,11 +49,15 @@ class HistoryModule {

@SingleInstanceIn(AppScope::class)
@Provides
fun provideDatabase(context: Context): HistoryDatabase {
return Room.databaseBuilder(context, HistoryDatabase::class.java, "history.db")
.fallbackToDestructiveMigration()
.addMigrations(*ALL_MIGRATIONS)
.build()
fun provideDatabase(databaseProvider: DatabaseProvider): HistoryDatabase {
return databaseProvider.buildRoomDatabase(
HistoryDatabase::class.java,
"history.db",
config = RoomDatabaseConfig(
fallbackToDestructiveMigration = true,
migrations = ALL_MIGRATIONS,
),
)
}

@SingleInstanceIn(AppScope::class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ abstract class HistoryDatabase : RoomDatabase() {
abstract fun historyDao(): HistoryDao
}

val ALL_MIGRATIONS = emptyArray<Migration>()
val ALL_MIGRATIONS = emptyList<Migration>()
Loading