Fix exception on op.alter_column(..., server_default=None) in mysql
Jeff Dairiki
Branch: dairiki/alembic:bug.mysql-server_default
Branch: zzzeek/alembic:master
Declined
Declined pull request
OK take a look at what I did in b61eccce5e45651ccdb25. im not sure about the existing_server_default=None thing, if there's some problem there that would be a separate issue, I added a9426a4ec4f14aa12c17f to test that also.
Closed by: Mike Bayer·2014-03-16
Attempting to remove an server_default from a column in mysql, e.g.
op.alter_column('MyTable', 'mycol', server_default=None, existing_type=sa.Integer(), existing_nullable=False, existing_server_default='42')
leads to an
AttributeError: 'NoneType' object has no attribute '_compiler_dispatch'
exception.As a work-around, specifying
server_default=False
works (but I suspect this only works under mysql sinceFalse
is really supposed to mean "no change to the server_default".)This PR includes a new test in test_mysql.py which exercises the problem.