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
1b65df3a
"git@developer.sourcefind.cn:chenpangpang/open-webui.git" did not exist on "d0f34baaa3c9ca899013834cf71cc97ae57c8e75"
Commit
1b65df3a
authored
Jul 03, 2024
by
Timothy J. Baek
Browse files
revert
parent
bfc53b49
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
6 deletions
+11
-6
backend/apps/webui/internal/migrations/016_add_valves_and_is_active.py
...webui/internal/migrations/016_add_valves_and_is_active.py
+11
-6
No files found.
backend/apps/webui/internal/migrations/016_add_valves_and_is_active.py
View file @
1b65df3a
"""Peewee migrations -- 017_add_user_oauth_sub.py.
"""Peewee migrations -- 009_add_models.py.
Some examples (model - class or model name)::
Some examples (model - class or model name)::
> Model = migrator.orm['table_name'] # Return model in current state by name
> Model = migrator.orm['table_name'] # Return model in current state by name
> Model = migrator.ModelClass # Return model in current state by name
> Model = migrator.ModelClass # Return model in current state by name
> migrator.sql(sql) # Run custom SQL
> migrator.sql(sql) # Run custom SQL
> migrator.run(func, *args, **kwargs) # Run python function with the given args
> migrator.run(func, *args, **kwargs) # Run python function with the given args
> migrator.create_model(Model) # Create a model (could be used as decorator)
> migrator.create_model(Model) # Create a model (could be used as decorator)
...
@@ -18,6 +21,7 @@ Some examples (model - class or model name)::
...
@@ -18,6 +21,7 @@ Some examples (model - class or model name)::
> migrator.drop_index(model, *col_names)
> migrator.drop_index(model, *col_names)
> migrator.drop_not_null(model, *field_names)
> migrator.drop_not_null(model, *field_names)
> migrator.drop_constraints(model, *constraints)
> migrator.drop_constraints(model, *constraints)
"""
"""
from
contextlib
import
suppress
from
contextlib
import
suppress
...
@@ -33,13 +37,14 @@ with suppress(ImportError):
...
@@ -33,13 +37,14 @@ with suppress(ImportError):
def
migrate
(
migrator
:
Migrator
,
database
:
pw
.
Database
,
*
,
fake
=
False
):
def
migrate
(
migrator
:
Migrator
,
database
:
pw
.
Database
,
*
,
fake
=
False
):
"""Write your migrations here."""
"""Write your migrations here."""
migrator
.
add_fields
(
migrator
.
add_fields
(
"tool"
,
valves
=
pw
.
TextField
(
null
=
True
))
"user"
,
migrator
.
add_fields
(
"function"
,
valves
=
pw
.
TextField
(
null
=
True
))
oauth_sub
=
pw
.
TextField
(
null
=
True
,
unique
=
True
),
migrator
.
add_fields
(
"function"
,
is_active
=
pw
.
BooleanField
(
default
=
False
))
)
def
rollback
(
migrator
:
Migrator
,
database
:
pw
.
Database
,
*
,
fake
=
False
):
def
rollback
(
migrator
:
Migrator
,
database
:
pw
.
Database
,
*
,
fake
=
False
):
"""Write your rollback migrations here."""
"""Write your rollback migrations here."""
migrator
.
remove_fields
(
"user"
,
"oauth_sub"
)
migrator
.
remove_fields
(
"tool"
,
"valves"
)
migrator
.
remove_fields
(
"function"
,
"valves"
)
migrator
.
remove_fields
(
"function"
,
"is_active"
)
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