Add logger import and fix error handling during upgrade in alembic scripts (#1650)

* Add logger import in script.py.mako

* Fix error handling during upgrade in alembic scripts

* Bump version to 0.6.14 in pyproject.toml
This commit is contained in:
Gabriel Luiz Freitas Almeida 2024-04-09 11:08:26 -03:00 • committed by Gabriel Luiz Freitas Almeida
commit 537cf93493
2 changed files with 7 additions and 6 deletions

View file

@ -11,6 +11,7 @@ from typing import Sequence, Union
import sqlalchemy as sa
import sqlmodel
from alembic import op
from loguru import logger # noqa
from sqlalchemy.engine.reflection import Inspector
# revision identifiers, used by Alembic.
@ -46,9 +47,9 @@ def upgrade() -> None:
if "fk_flow_user_id_user" not in indices_names:
batch_op.create_foreign_key("fk_flow_user_id_user", "user", ["user_id"], ["id"])
except Exception:
except Exception as e:
logger.exception(f"Error during upgrade: {e}")
pass
# ### end Alembic commands ###
def downgrade() -> None: