diff --git a/src/backend/base/langflow/alembic/__init__.py b/src/backend/base/langflow/alembic/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/src/backend/base/langflow/alembic/env.py b/src/backend/base/langflow/alembic/env.py index d4e130649..f3e107eee 100644 --- a/src/backend/base/langflow/alembic/env.py +++ b/src/backend/base/langflow/alembic/env.py @@ -1,9 +1,8 @@ from logging.config import fileConfig from alembic import context -from sqlalchemy import engine_from_config, pool +from sqlalchemy import engine_from_config, pool, text -from langflow.services.database.models import * from langflow.services.database.service import SQLModel # this is the Alembic Config object, which provides @@ -69,6 +68,9 @@ def run_migrations_online() -> None: context.configure(connection=connection, target_metadata=target_metadata, render_as_batch=True) with context.begin_transaction(): + if connection.dialect.name == "postgresql": + connection.execute(text("SET LOCAL lock_timeout = '60s';")) + connection.execute(text("SELECT pg_advisory_xact_lock(112233);")) context.run_migrations() diff --git a/src/backend/base/pyproject.toml b/src/backend/base/pyproject.toml index 57bc691e7..e0afec2be 100644 --- a/src/backend/base/pyproject.toml +++ b/src/backend/base/pyproject.toml @@ -24,7 +24,7 @@ ignore_missing_imports = true [tool.ruff] target-version = "py310" -exclude = ["langflow/alembic"] +exclude = ["langflow/alembic/versions"] line-length = 120 [tool.ruff.lint]