From: Mike Bayer Date: Thu, 23 Aug 2012 01:14:46 +0000 (-0400) Subject: Merged in moriyoshi/alembic/bugfix/autoincrement_for_mysql_alter_column (pull request... X-Git-Tag: rel_0_4_0~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=07b673dd6ebba11e1dc8a54fba48b344f5920f2c;p=thirdparty%2Fsqlalchemy%2Falembic.git Merged in moriyoshi/alembic/bugfix/autoincrement_for_mysql_alter_column (pull request #21) --- 07b673dd6ebba11e1dc8a54fba48b344f5920f2c diff --cc alembic/ddl/impl.py index 8bfdf555,32e15e66..220fbef0 --- a/alembic/ddl/impl.py +++ b/alembic/ddl/impl.py @@@ -83,13 -83,16 +83,16 @@@ class DefaultImpl(object) name=None, type_=None, schema=None, + autoincrement=None, existing_type=None, existing_server_default=None, - existing_nullable=None + existing_nullable=None, + existing_autoincrement=None ): - + if autoincrement is not None or existing_autoincrement is not None: + util.warn("nautoincrement and existing_autoincrement only make sense for MySQL") if nullable is not None: - self._exec(base.ColumnNullable(table_name, column_name, + self._exec(base.ColumnNullable(table_name, column_name, nullable, schema=schema, existing_type=existing_type, existing_server_default=existing_server_default, diff --cc alembic/operations.py index d1f7835a,beb0f9fb..f6997689 --- a/alembic/operations.py +++ b/alembic/operations.py @@@ -223,18 -220,10 +225,19 @@@ class Operations(object) :param existing_nullable: Optional; the existing nullability of the column. Required on MySQL if the existing nullability is not being changed; else MySQL sets this to NULL. + :param existing_autoincrement: Optional; the """ - if existing_type: + compiler = self.impl.dialect.statement_compiler( + self.impl.dialect, + None + ) + def _count_constraint(constraint): + return not isinstance(constraint, schema.PrimaryKeyConstraint) and \ + (not constraint._create_rule or + constraint._create_rule(compiler)) + + if existing_type and type_: t = self._table(table_name, schema.Column(column_name, existing_type) )