Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
open-webui
Commits
95426fc6
Commit
95426fc6
authored
Jul 08, 2024
by
Timothy J. Baek
Browse files
refac: do not use subprocess
parent
39d3dcd0
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
7 deletions
+5
-7
backend/main.py
backend/main.py
+5
-7
No files found.
backend/main.py
View file @
95426fc6
...
@@ -173,13 +173,11 @@ https://github.com/open-webui/open-webui
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment