mirror of
https://github.com/hay-kot/mealie.git
synced 2025-08-22 06:23:34 -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
|
from pydantic import BaseSettings, Field, validator
|
||||||
|
|
||||||
APP_VERSION = "v0.5.0beta"
|
APP_VERSION = "v0.5.0beta"
|
||||||
DB_VERSION = "v0.5.0"
|
|
||||||
|
|
||||||
CWD = Path(__file__).parent
|
CWD = Path(__file__).parent
|
||||||
BASE_DIR = CWD.parent.parent
|
BASE_DIR = CWD.parent.parent
|
||||||
|
@ -83,7 +82,7 @@ app_dirs = AppDirectories(CWD, DATA_DIR)
|
||||||
|
|
||||||
|
|
||||||
def determine_sqlite_path() -> str:
|
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())
|
return "sqlite:///" + str(db_path.absolute())
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,14 +3,14 @@ from sqlalchemy.orm import sessionmaker
|
||||||
|
|
||||||
|
|
||||||
def sql_global_init(db_url: str):
|
def sql_global_init(db_url: str):
|
||||||
thread_safe = True
|
connect_args = {}
|
||||||
if "sqlite" in db_url:
|
if "sqlite" in db_url:
|
||||||
thread_safe = False
|
connect_args["check_same_thread"] = False
|
||||||
|
|
||||||
engine = sa.create_engine(
|
engine = sa.create_engine(
|
||||||
db_url,
|
db_url,
|
||||||
echo=False,
|
echo=False,
|
||||||
connect_args={"check_same_thread": thread_safe},
|
connect_args=connect_args,
|
||||||
)
|
)
|
||||||
|
|
||||||
return sessionmaker(autocommit=False, autoflush=False, bind=engine)
|
return sessionmaker(autocommit=False, autoflush=False, bind=engine)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue