Fix migration and add confirmation prompt
This commit is contained in:
parent
ab212a046f
commit
8f04139ddd
1 changed files with 12 additions and 3 deletions
|
|
@ -12,7 +12,8 @@ from dotenv import load_dotenv
|
|||
from langflow.main import setup_app
|
||||
from langflow.services.database.utils import session_getter
|
||||
from langflow.services.deps import get_db_service, get_settings_service
|
||||
from langflow.services.utils import initialize_services, initialize_settings_service
|
||||
from langflow.services.utils import (initialize_services,
|
||||
initialize_settings_service)
|
||||
from langflow.utils.logger import configure, logger
|
||||
from multiprocess import Process, cpu_count # type: ignore
|
||||
from rich import box
|
||||
|
|
@ -327,11 +328,19 @@ def superuser(
|
|||
|
||||
|
||||
@app.command()
|
||||
def migration(test: bool = typer.Option(True, help="Run migrations in test mode.")):
|
||||
def migration(test: bool = typer.Option(True, help="Run migrations in test mode."),
|
||||
fix: bool = typer.Option(False, help="Fix migrations. This is a destructive operation, and should only be used if you know what you are doing.")
|
||||
):
|
||||
"""
|
||||
Run or test migrations.
|
||||
"""
|
||||
initialize_services()
|
||||
if fix:
|
||||
if not typer.confirm("This will delete all data necessary to fix migrations. Are you sure you want to continue?"):
|
||||
raise typer.Abort()
|
||||
|
||||
|
||||
|
||||
initialize_services(fix_migration=fix)
|
||||
db_service = get_db_service()
|
||||
if not test:
|
||||
db_service.run_migrations()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue