]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- add a note to versioning that version id col cannot be null,
authorMike Bayer <mike_mp@zzzcomputing.com>
Mon, 22 May 2017 18:32:06 +0000 (14:32 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Mon, 22 May 2017 18:32:44 +0000 (14:32 -0400)
is not supported.

Change-Id: I3724fea3f2d508210e35827eb1ea17f5e334da19
Fixes: #3673
(cherry picked from commit fcaf17766fdd22e67407e432f7666d63439d7a39)

doc/build/orm/versioning.rst

index 563185604d042b882db62b53b3b809ed74daf8b8..bf25f78c1562117d7abcbcc2a76278f63106bb86 100644 (file)
@@ -65,6 +65,10 @@ mapper options::
             "version_id_col": version_id
         }
 
+.. note::  It is **strongly recommended** that the ``version_id`` column
+   be made NOT NULL.  The versioning feature **does not support** a NULL
+   value in the versioning column.
+
 Above, the ``User`` mapping tracks integer versions using the column
 ``version_id``.   When an object of type ``User`` is first flushed, the
 ``version_id`` column will be given a value of "1".   Then, an UPDATE
@@ -105,7 +109,7 @@ support a native GUID type, but we illustrate here using a simple string)::
         __tablename__ = 'user'
 
         id = Column(Integer, primary_key=True)
-        version_uuid = Column(String(32))
+        version_uuid = Column(String(32), nullable=False)
         name = Column(String(50), nullable=False)
 
         __mapper_args__ = {
@@ -220,7 +224,7 @@ at our choosing::
         __tablename__ = 'user'
 
         id = Column(Integer, primary_key=True)
-        version_uuid = Column(String(32))
+        version_uuid = Column(String(32), nullable=False)
         name = Column(String(50), nullable=False)
 
         __mapper_args__ = {