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
39d3dcd0
Commit
39d3dcd0
authored
Jul 08, 2024
by
Timothy J. Baek
Browse files
fix: db
parent
36c0f7f2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
3 deletions
+9
-3
backend/migrations/env.py
backend/migrations/env.py
+9
-3
No files found.
backend/migrations/env.py
View file @
39d3dcd0
...
@@ -18,6 +18,8 @@ from apps.webui.models.users import User
...
@@ -18,6 +18,8 @@ from apps.webui.models.users import User
from
apps.webui.models.files
import
File
from
apps.webui.models.files
import
File
from
apps.webui.models.functions
import
Function
from
apps.webui.models.functions
import
Function
from
config
import
DATABASE_URL
# this is the Alembic Config object, which provides
# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
# access to the values within the .ini file in use.
config
=
context
.
config
config
=
context
.
config
...
@@ -38,9 +40,13 @@ target_metadata = Auth.metadata
...
@@ -38,9 +40,13 @@ target_metadata = Auth.metadata
# my_important_option = config.get_main_option("my_important_option")
# my_important_option = config.get_main_option("my_important_option")
# ... etc.
# ... etc.
database_url
=
os
.
getenv
(
"DATABASE_URL"
,
None
)
DB_URL
=
DATABASE_URL
if
database_url
:
# Replace the postgres:// with postgresql://
config
.
set_main_option
(
"sqlalchemy.url"
,
database_url
)
if
"postgres://"
in
DB_URL
:
DB_URL
=
DB_URL
.
replace
(
"postgres://"
,
"postgresql://"
)
if
DB_URL
:
config
.
set_main_option
(
"sqlalchemy.url"
,
DB_URL
)
def
run_migrations_offline
()
->
None
:
def
run_migrations_offline
()
->
None
:
...
...
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