diff options
-rw-r--r-- | CHANGES | 6 | ||||
-rw-r--r-- | alembic/__init__.py | 2 | ||||
-rw-r--r-- | tests/test_mysql.py | 13 |
3 files changed, 19 insertions, 2 deletions
@@ -1,3 +1,9 @@ +0.3.7 +===== +- [bug] Fixed MySQL rendering for server_default which + didn't work if the server_default was a generated + SQL expression. Courtesy Moriyoshi Koizumi. + 0.3.6 ===== - [feature] Added include_symbol option to diff --git a/alembic/__init__.py b/alembic/__init__.py index 38e8107..36db19f 100644 --- a/alembic/__init__.py +++ b/alembic/__init__.py @@ -1,6 +1,6 @@ from os import path -__version__ = '0.3.6' +__version__ = '0.3.7' package_dir = path.abspath(path.dirname(__file__)) diff --git a/tests/test_mysql.py b/tests/test_mysql.py index a47ef9d..02f0419 100644 --- a/tests/test_mysql.py +++ b/tests/test_mysql.py @@ -1,7 +1,8 @@ from tests import op_fixture, assert_raises_message from alembic import op, util from sqlalchemy import Integer, Column, ForeignKey, \ - UniqueConstraint, Table, MetaData, String + UniqueConstraint, Table, MetaData, String,\ + func from sqlalchemy.sql import table def test_rename_column(): @@ -18,6 +19,16 @@ def test_rename_column_serv_default(): "ALTER TABLE t1 CHANGE c1 c2 INTEGER NULL DEFAULT 'q'" ) +def test_rename_column_serv_compiled_default(): + context = op_fixture('mysql') + op.alter_column('t1', 'c1', name="c2", existing_type=Integer, + existing_server_default=func.utc_thing(func.current_timestamp())) + # this is not a valid MySQL default but the point is to just + # test SQL expression rendering + context.assert_( + "ALTER TABLE t1 CHANGE c1 c2 INTEGER NULL DEFAULT utc_thing(CURRENT_TIMESTAMP)" + ) + def test_col_nullable(): context = op_fixture('mysql') op.alter_column('t1', 'c1', nullable=False, existing_type=Integer) |