package com.baoshi.swms.room;

import android.content.Context;

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

/**
 * ROOM数据库构建器
 *
 * @author Zhendong Zhou
 * @date 2021/12/29 15:47
 */
/*@Database(entities = {}, version = 1,exportSchema = false)*/
public abstract class AppDatabase extends RoomDatabase{
    private static final String DB_NAME = "swmsApplication.db";
    private static volatile AppDatabase instance;

    public static synchronized AppDatabase getInstance(Context context){
        if (instance==null){
            instance = Room.databaseBuilder(context.getApplicationContext(), AppDatabase.class, DB_NAME).build();
        }
        return instance;
    }
}
