]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Add migration note for ticket #5367
authorMike Bayer <mike_mp@zzzcomputing.com>
Sun, 15 Nov 2020 16:23:10 +0000 (11:23 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sun, 15 Nov 2020 16:24:08 +0000 (11:24 -0500)
Fixes: #5701
Change-Id: Iac5bee4c3ddf25151a695c98e62276525de2b08b

doc/build/changelog/changelog_14.rst
doc/build/changelog/migration_14.rst

index 3a1c5cdbd323f5f45f50fbebe1e5bbfe23b30e5c..053f677d5eea4fa6d5ae7f6935dfa1fd6c86f49f 100644 (file)
@@ -1694,6 +1694,9 @@ This document details individual issue-level changes made throughout
         constraints present schema-management maintenance complexities that should
         be opted in to, rather than being turned on by default.
 
+        .. seealso::
+
+            :ref:`change_5367`
 
     .. change::
         :tags: feature, sql
index 5eac8796457fef2c6da1009a56db4ca2f96690ea..41c91050c0545ebc8f691e139e8aa5379bd4ad44 100644 (file)
@@ -1732,7 +1732,30 @@ on :func:`_sa.create_engine`.
 
 The error message is described in the errors page at :ref:`error_8s2a`.
 
+.. _change_5367:
 
+Enum and Boolean datatypes no longer default to "create constraint"
+-------------------------------------------------------------------
+
+The :paramref:`.Enum.create_constraint` and
+:paramref:`.Boolean.create_constraint` parameters now default to False,
+indicating when a so-called "non-native" version of these two datatypes is
+created, a CHECK constraint will **not** be generated by default.   These
+CHECK constraints present schema-management maintenance complexities that
+should be opted in to, rather than being turned on by default.
+
+
+To ensure that a CREATE CONSTRAINT is emitted for these types, set these
+flags to ``True``::
+
+  class Spam(Base):
+      __tablename__ = "spam"
+      id = Column(Integer, primary_key=True)
+      boolean = Column(Boolean(create_constraint=True))
+      enum = Column(Enum("a", "b", "c", create_constraint=True))
+
+
+:ticket:`5367`
 
 New Features - ORM
 ==================