]> git.ipfire.org Git - thirdparty/sqlalchemy/alembic.git/commitdiff
Remove reference to "exclude" from ops.py
authord3 <david.hills@florincourt.com>
Thu, 24 Aug 2023 08:09:34 +0000 (09:09 +0100)
committerd3 <david.hills@florincourt.com>
Thu, 24 Aug 2023 08:09:34 +0000 (09:09 +0100)
Per review comments - the concept of an exclusion constraint is specific to Postgres
so we want to avoid any reference to that in ops.py.  New implementation uses string
"generic" instead in order to avoid that.

alembic/operations/ops.py
tests/test_postgresql.py

index 2bd4a094e275e8ec587544bea4ff1d4427087ce2..5c28e935fbe55fb8ad53b5fe1c2e4cff0642d6ee 100644 (file)
@@ -164,7 +164,6 @@ class DropConstraintOp(MigrateOperation):
             "check_constraint": "check",
             "column_check_constraint": "check",
             "table_or_column_check_constraint": "check",
-            "exclude_constraint": "exclude",
         }
 
         constraint_table = sqla_compat._table_for_constraint(constraint)
@@ -172,7 +171,7 @@ class DropConstraintOp(MigrateOperation):
             sqla_compat.constraint_name_or_none(constraint.name),
             constraint_table.name,
             schema=constraint_table.schema,
-            type_=types[constraint.__visit_name__],
+            type_=types.get(constraint.__visit_name__, "generic"),
             _reverse=AddConstraintOp.from_constraint(constraint),
         )
 
index af278dab39617b1e39e471da956aa47594174f9f..e9242cbaf64ebb45be5b656e37acf66aac4b9e40 100644 (file)
@@ -1279,7 +1279,7 @@ class PostgresqlAutogenRenderTest(TestBase):
 
         eq_ignore_whitespace(
             autogenerate.render_op_text(autogen_context, op_obj),
-            "op.drop_constraint('t_excl_x', 'TTable',  type_='exclude')",
+            "op.drop_constraint('t_excl_x', 'TTable',  type_='generic')",
         )
 
     def test_json_type(self):