package com.example.prettywallpapers.room;

import androidx.room.Database;
import androidx.room.Room;
import androidx.room.RoomDatabase;

import com.example.prettywallpapers.myvalue.MyValues;


@Database(
        entities = {PrettyPaperEntity.class},
        version = 1,
        exportSchema = false
)
public abstract class PrettyPaperDatabase extends RoomDatabase {

    private static PrettyPaperDatabase prettyPaperDatabase;

    public abstract PrettyPaperDao getPrettyPaperDao();
    public static synchronized PrettyPaperDatabase getPrettyPaperDatabase(){
        if(prettyPaperDatabase == null){
            prettyPaperDatabase = Room.databaseBuilder(MyValues.prettyWallPaper,PrettyPaperDatabase.class,MyValues.DB_NAME).build();
        }
        return prettyPaperDatabase;
    }
}
