]> git.ipfire.org Git - thirdparty/sqlalchemy/alembic.git/commit
support named CHECK constraints in batch
authorMike Bayer <mike_mp@zzzcomputing.com>
Mon, 23 Aug 2021 17:31:57 +0000 (13:31 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Tue, 24 Aug 2021 14:26:43 +0000 (10:26 -0400)
commite34f6c1fd3299bea108c77bfda09d4e05306bf67
tree1881a88cae139dec06a2fda0b113df0697c58139
parent6aad68605f510e8b51f42efa812e02b3831d6e33
support named CHECK constraints in batch

Named CHECK constraints are now supported by batch mode, and will
automatically be part of the recreated table assuming they are named. They
also can be explicitly dropped using ``op.drop_constraint()``. For
"unnamed" CHECK constraints, these are still skipped as they cannot be
distinguished from the CHECK constraints that are generated by the
``Boolean`` and ``Enum`` datatypes.

Note that this change may require adjustments to migrations that drop or
rename columns which feature an associated named check constraint, such
that an additional ``op.drop_constraint()`` directive should be added for
that named constraint as there will no longer be an associated column
for it; for the ``Boolean`` and ``Enum`` datatypes, an ``existing_type``
keyword may be passed to ``BatchOperations.drop_constraint`` as well.

Fixes: #884
Change-Id: I3694430f7c9735bcc3b0765893b333cc8e0d1cd3
alembic/operations/batch.py
docs/build/batch.rst
docs/build/unreleased/884.rst [new file with mode: 0644]
tests/requirements.py
tests/test_batch.py