From: kasium <15907922+kasium@users.noreply.github.com> Date: Thu, 22 Feb 2024 19:31:30 +0000 (+0100) Subject: Fix type annotations in create_foreign_key (#1430) X-Git-Tag: rel_1_13_2~14 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=88769c545439336bec7379dc77f7e6f70d83d1ea;p=thirdparty%2Fsqlalchemy%2Falembic.git Fix type annotations in create_foreign_key (#1430) The constraint name parameter of create_foreign_key should be optional, but the batch function defined it as str instead of Optional[str]. Closes #1429 --- diff --git a/alembic/operations/base.py b/alembic/operations/base.py index bd1b170d..649e7f2b 100644 --- a/alembic/operations/base.py +++ b/alembic/operations/base.py @@ -1721,7 +1721,7 @@ class BatchOperations(AbstractOperations): def create_foreign_key( self, - constraint_name: str, + constraint_name: Optional[str], referent_table: str, local_cols: List[str], remote_cols: List[str], diff --git a/alembic/operations/ops.py b/alembic/operations/ops.py index 0282d571..3a9c033c 100644 --- a/alembic/operations/ops.py +++ b/alembic/operations/ops.py @@ -681,7 +681,7 @@ class CreateForeignKeyOp(AddConstraintOp): def batch_create_foreign_key( cls, operations: BatchOperations, - constraint_name: str, + constraint_name: Optional[str], referent_table: str, local_cols: List[str], remote_cols: List[str],