]> git.ipfire.org Git - thirdparty/sqlalchemy/alembic.git/commitdiff
- changelog + support for remove autoinc
authorMike Bayer <mike_mp@zzzcomputing.com>
Thu, 23 Aug 2012 01:43:45 +0000 (21:43 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 23 Aug 2012 01:43:45 +0000 (21:43 -0400)
CHANGES
alembic/ddl/mysql.py
tests/test_mysql.py

diff --git a/CHANGES b/CHANGES
index d22b4f14146523e956f8a01f2d1ee7e0498dd4b6..7f37ef89beda46459b479fb95f9b0224c5961462 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -4,6 +4,10 @@
   didn't work if the server_default was a generated
   SQL expression.  Courtesy Moriyoshi Koizumi.
 
+- [feature] Added support for alteration of MySQL
+  columns that have AUTO_INCREMENT, as well as enabling
+  this flag.  Courtesy Moriyoshi Koizumi.
+
 0.3.6
 =====
 - [feature] Added include_symbol option to
index 012aae34e065a8ee700481bb1a3a287897b90354..1f04f2a5d31beb973a5f3b5a4878abb17bae9781 100644 (file)
@@ -98,7 +98,7 @@ def _mysql_colspec(compiler, name, nullable, server_default, type_,
         compiler.dialect.type_compiler.process(type_),
         "NULL" if nullable else "NOT NULL"
     )
-    if autoincrement is not None:
+    if autoincrement:
         spec += " AUTO_INCREMENT"
     if server_default != False:
         spec += " DEFAULT %s" % _render_value(compiler, server_default)
index 28c1fd6aaf44d0944894ab9b37a3cbb91861d596..456aab7ccb0844bdc11ba9d6d189a0014b1a0696 100644 (file)
@@ -45,6 +45,15 @@ def test_col_add_autoincrement():
         'ALTER TABLE t1 CHANGE c1 c2 INTEGER NULL AUTO_INCREMENT'
     )
 
+def test_col_remove_autoincrement():
+    context = op_fixture('mysql')
+    op.alter_column('t1', 'c1', name="c2", existing_type=Integer,
+                                existing_autoincrement=True,
+                                autoincrement=False)
+    context.assert_(
+        'ALTER TABLE t1 CHANGE c1 c2 INTEGER NULL'
+    )
+
 def test_col_nullable():
     context = op_fixture('mysql')
     op.alter_column('t1', 'c1', nullable=False, existing_type=Integer)