]> git.ipfire.org Git - thirdparty/sqlalchemy/alembic.git/commitdiff
Fix type annotations in create_foreign_key (#1430)
authorkasium <15907922+kasium@users.noreply.github.com>
Thu, 22 Feb 2024 19:31:30 +0000 (20:31 +0100)
committerGitHub <noreply@github.com>
Thu, 22 Feb 2024 19:31:30 +0000 (20:31 +0100)
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

alembic/operations/base.py
alembic/operations/ops.py

index bd1b170d3d684de31f4c7e972dfa93c2882d7aa1..649e7f2b0fdd7e9db72caf8bc67031002f2121a9 100644 (file)
@@ -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],
index 0282d5716370c47231883b17140334a450e87560..3a9c033c13392124785d396919eda4d2836b84e8 100644 (file)
@@ -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],