diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2011-11-28 00:58:00 -0500 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2011-11-28 00:58:00 -0500 |
commit | 760c3e3ae2a97eecd5b41f9e2c97564c38af215f (patch) | |
tree | 85d1d207c20db805bb7d1343e7695dbfbe563c14 /tests/test_mysql.py | |
parent | 39560d41239a9c8b47c99465fa9d2d829bef38e9 (diff) | |
download | alembic-760c3e3ae2a97eecd5b41f9e2c97564c38af215f.tar.gz |
initial MySQL support, good thing we tried
this before releasing
Diffstat (limited to 'tests/test_mysql.py')
-rw-r--r-- | tests/test_mysql.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/test_mysql.py b/tests/test_mysql.py new file mode 100644 index 0000000..8090d8c --- /dev/null +++ b/tests/test_mysql.py @@ -0,0 +1,27 @@ +from tests import _op_fixture +from alembic import op +from sqlalchemy import Integer, Column, ForeignKey, \ + UniqueConstraint, Table, MetaData, String +from sqlalchemy.sql import table + +def test_rename_column(): + context = _op_fixture('mysql') + op.alter_column('t1', 'c1', name="c2", existing_type=Integer) + context.assert_( + 'ALTER TABLE t1 CHANGE c1 c2 INTEGER NULL' + ) + +def test_rename_column_serv_default(): + context = _op_fixture('mysql') + op.alter_column('t1', 'c1', name="c2", existing_type=Integer, existing_server_default="q") + context.assert_( + "ALTER TABLE t1 CHANGE c1 c2 INTEGER NULL DEFAULT 'q'" + ) + +def test_col_nullable(): + context = _op_fixture('mysql') + op.alter_column('t1', 'c1', nullable=False, existing_type=Integer) + context.assert_( + 'ALTER TABLE t1 CHANGE c1 c1 INTEGER NOT NULL' + ) + |