From 44a656a24242e160d5da3b45f4f65d2b2471912a Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Sun, 15 Nov 2020 11:23:10 -0500 Subject: [PATCH] Add migration note for ticket #5367 Fixes: #5701 Change-Id: Iac5bee4c3ddf25151a695c98e62276525de2b08b --- doc/build/changelog/changelog_14.rst | 3 +++ doc/build/changelog/migration_14.rst | 23 +++++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/doc/build/changelog/changelog_14.rst b/doc/build/changelog/changelog_14.rst index 3a1c5cdbd3..053f677d5e 100644 --- a/doc/build/changelog/changelog_14.rst +++ b/doc/build/changelog/changelog_14.rst @@ -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 diff --git a/doc/build/changelog/migration_14.rst b/doc/build/changelog/migration_14.rst index 5eac879645..41c91050c0 100644 --- a/doc/build/changelog/migration_14.rst +++ b/doc/build/changelog/migration_14.rst @@ -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 ================== -- 2.47.3