This repository has been archived on 2026-05-26. You can view files and clone it. You cannot open issues or pull requests or push a commit.
2023-04-08 17:30:05 +02:00
|
|
|
package com.denizk0461.studip.db
|
|
|
|
|
|
|
|
|
|
import android.content.Context
|
|
|
|
|
import androidx.room.Database
|
|
|
|
|
import androidx.room.Room
|
|
|
|
|
import androidx.room.RoomDatabase
|
2023-04-08 18:53:51 +02:00
|
|
|
import com.denizk0461.studip.model.StudIPEvent
|
2023-04-08 17:30:05 +02:00
|
|
|
|
2023-04-12 18:58:10 +02:00
|
|
|
@Database(entities = [StudIPEvent::class], version = 3)
|
2023-04-08 17:30:05 +02:00
|
|
|
abstract class EventDatabase : RoomDatabase() {
|
|
|
|
|
|
|
|
|
|
abstract fun dao(): EventDAO
|
|
|
|
|
|
|
|
|
|
companion object {
|
|
|
|
|
private var instance: EventDatabase? = null
|
|
|
|
|
|
|
|
|
|
fun getInstance(context: Context): EventDatabase {
|
|
|
|
|
if (instance == null) {
|
|
|
|
|
synchronized(EventDatabase::class) {
|
|
|
|
|
instance = Room.databaseBuilder(
|
|
|
|
|
context.applicationContext,
|
|
|
|
|
EventDatabase::class.java,
|
|
|
|
|
"event_db"
|
2023-04-10 20:54:15 +02:00
|
|
|
).fallbackToDestructiveMigration().build()
|
2023-04-08 17:30:05 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return instance!!
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|