]> git.ipfire.org Git - thirdparty/sqlalchemy/alembic.git/commit
Prevent alter_column() from changing nullability
authorGord Thompson <gord@gordthompson.com>
Thu, 13 Jan 2022 18:46:46 +0000 (11:46 -0700)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 4 Feb 2022 21:53:15 +0000 (16:53 -0500)
commitfb8d4502c0a4ad9a68ff1fe15bc4b3a0dfeaaacb
tree1ab2ac2e9f94ec73fc5b96e4e034ce45b4f1ce4f
parent7b942708427f89a277e9e55ac538103717094da3
Prevent alter_column() from changing nullability

Fixed bug where an alter_column() operation would change a "NOT NULL"
column to "NULL" by emitting an ALTER COLUMN statement that did not specify
"NOT NULL". (In the absence of "NOT NULL" T-SQL was implicitly assuming
"NULL"). An alter_column() operation that specifies `type_=` should also
specify either `nullable=` or `existing_nullable=` to inform Alembic as to
whether the emitted DDL should include "NULL" or "NOT NULL"; a warning is
now emitted if this is missing under this scenario.

Fixes: #977
Change-Id: Ifbaa06bf149ba39d1a5deb43a6fd42c9ca118894
alembic/ddl/mssql.py
docs/build/unreleased/977.rst [new file with mode: 0644]
tests/test_mssql.py
tests/test_mysql.py
tests/test_op.py