Skip to content

Commit

Permalink
Merge pull request #20 from ElchinGasymov/Career_Hub_add_database
Browse files Browse the repository at this point in the history
Career hub add database
  • Loading branch information
Logomann authored Aug 3, 2024
2 parents a52f532 + 3bd144b commit 5615f46
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package ru.practicum.android.diploma.data.db

import androidx.room.Database
import androidx.room.RoomDatabase

@Database(
version = 1,
entities = [VacancyEntity::class]
)
abstract class AppDatabase : RoomDatabase()

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package ru.practicum.android.diploma.data.db

import androidx.room.Entity
import androidx.room.PrimaryKey

@Entity(tableName = "vacancy_table")
data class VacancyEntity(
@PrimaryKey(autoGenerate = true)
val vacancyId: Int
)

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package ru.practicum.android.diploma.data.db.dao

import androidx.room.Dao

@Dao
interface VacancyDao

Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
package ru.practicum.android.diploma.di

import androidx.room.Room
import org.koin.android.ext.koin.androidContext
import org.koin.dsl.module
import ru.practicum.android.diploma.data.db.AppDatabase

val dataModule = module {

single {
Room.databaseBuilder(androidContext(), AppDatabase::class.java, "database.db")
.fallbackToDestructiveMigration()
.build()
}

}

0 comments on commit 5615f46

Please sign in to comment.