Change db to use /data if it exists

This commit is contained in:
Nexus 2023-03-20 15:41:20 +00:00
parent 3dd316c796
commit 16dd661d48
Signed by: nex
GPG key ID: 0FA334385D0B689F

View file

@ -36,8 +36,10 @@ __all__ = [
T = TypeVar("T") T = TypeVar("T")
T_co = TypeVar("T_co", covariant=True) T_co = TypeVar("T_co", covariant=True)
_pth = "/main.db"
registry = orm.ModelRegistry(Database("sqlite:///main.db")) if Path("/data").exists():
_pth = "/data/main.db"
registry = orm.ModelRegistry(Database("sqlite://" + _pth))
async def get_or_none(model: T, **kw) -> Optional[T_co]: async def get_or_none(model: T, **kw) -> Optional[T_co]: