From da1bc9878b71f6f7b87e2fa7895e1631ae581609 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Mon, 22 May 2017 14:32:06 -0400 Subject: [PATCH] - add a note to versioning that version id col cannot be null, is not supported. Change-Id: I3724fea3f2d508210e35827eb1ea17f5e334da19 Fixes: #3673 (cherry picked from commit fcaf17766fdd22e67407e432f7666d63439d7a39) (cherry picked from commit 8cce3beef729e51eaed2d01a6ba0b0677abc7b36) --- doc/build/orm/versioning.rst | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/doc/build/orm/versioning.rst b/doc/build/orm/versioning.rst index 563185604d..bf25f78c15 100644 --- a/doc/build/orm/versioning.rst +++ b/doc/build/orm/versioning.rst @@ -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__ = { -- 2.39.5