mirror of
https://github.com/hay-kot/mealie.git
synced 2025-08-21 22:13:31 -07:00
More db compatibility
This commit is contained in:
parent
f65f718333
commit
5c41f5dfd7
2 changed files with 4 additions and 5 deletions
|
@ -7,7 +7,6 @@ import dotenv
|
|||
from pydantic import BaseSettings, Field, validator
|
||||
|
||||
APP_VERSION = "v0.5.0beta"
|
||||
DB_VERSION = "v0.5.0"
|
||||
|
||||
CWD = Path(__file__).parent
|
||||
BASE_DIR = CWD.parent.parent
|
||||
|
@ -83,7 +82,7 @@ app_dirs = AppDirectories(CWD, DATA_DIR)
|
|||
|
||||
|
||||
def determine_sqlite_path() -> str:
|
||||
db_path = app_dirs.DATA_DIR.joinpath("db", "mealie.db")
|
||||
db_path = app_dirs.DATA_DIR.joinpath("mealie.db")
|
||||
return "sqlite:///" + str(db_path.absolute())
|
||||
|
||||
|
||||
|
|
|
@ -3,14 +3,14 @@ from sqlalchemy.orm import sessionmaker
|
|||
|
||||
|
||||
def sql_global_init(db_url: str):
|
||||
thread_safe = True
|
||||
connect_args = {}
|
||||
if "sqlite" in db_url:
|
||||
thread_safe = False
|
||||
connect_args["check_same_thread"] = False
|
||||
|
||||
engine = sa.create_engine(
|
||||
db_url,
|
||||
echo=False,
|
||||
connect_args={"check_same_thread": thread_safe},
|
||||
connect_args=connect_args,
|
||||
)
|
||||
|
||||
return sessionmaker(autocommit=False, autoflush=False, bind=engine)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue