mirror of
https://github.com/open-webui/open-webui
synced 2024-11-24 21:13:59 +00:00
refac: do not use subprocess
This commit is contained in:
parent
39d3dcd032
commit
95426fc6c9
@ -173,13 +173,11 @@ https://github.com/open-webui/open-webui
|
|||||||
|
|
||||||
|
|
||||||
def run_migrations():
|
def run_migrations():
|
||||||
env = os.environ.copy()
|
from alembic.config import Config
|
||||||
env["DATABASE_URL"] = DATABASE_URL
|
from alembic import command
|
||||||
migration_task = subprocess.run(
|
|
||||||
["alembic", f"-c{BACKEND_DIR}/alembic.ini", "upgrade", "head"], env=env
|
alembic_cfg = Config("alembic.ini")
|
||||||
)
|
command.upgrade(alembic_cfg, "head")
|
||||||
if migration_task.returncode > 0:
|
|
||||||
raise ValueError("Error running migrations")
|
|
||||||
|
|
||||||
|
|
||||||
@asynccontextmanager
|
@asynccontextmanager
|
||||||
|
Loading…
Reference in New Issue
Block a user