From: Mike Bayer Date: Mon, 4 Feb 2013 18:42:34 +0000 (-0500) Subject: - get sphinx to render "type_" with the underscore X-Git-Tag: rel_0_5_0~27 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6d29bd47c2fa7a7e00457397e75fbe48ea004980;p=thirdparty%2Fsqlalchemy%2Falembic.git - get sphinx to render "type_" with the underscore - rename "type" to "type_" in drop_constraint for consistency, leave old name for compat --- diff --git a/alembic/operations.py b/alembic/operations.py index 63f50bc6..4dff7baf 100644 --- a/alembic/operations.py +++ b/alembic/operations.py @@ -212,7 +212,7 @@ class Operations(object): Set to ``None`` to have the default removed. :param name: Optional; specify a string name here to indicate the new name within a column rename operation. - :param type_: Optional; a :class:`~sqlalchemy.types.TypeEngine` + :param ``type_``: Optional; a :class:`~sqlalchemy.types.TypeEngine` type object to specify a change to the column's type. For SQLAlchemy types that also indicate a constraint (i.e. :class:`~sqlalchemy.types.Boolean`, :class:`~sqlalchemy.types.Enum`), @@ -638,22 +638,32 @@ class Operations(object): self._index(name, tablename, ['x'], schema=schema) ) - def drop_constraint(self, name, tablename, type=None, schema=None): + def drop_constraint(self, name, tablename, type_=None, schema=None, type=None): """Drop a constraint of the given name, typically via DROP CONSTRAINT. :param name: name of the constraint. :param tablename: tablename. - :param type: optional, required on MySQL. can be + :param ``type_``: optional, required on MySQL. can be 'foreignkey', 'primary', 'unique', or 'check'. + .. versionadded:: 0.4.2 the parameter is now named ``type_``. + ``type`` will remain for backwards compatibility. + .. versionadded:: 0.3.6 'primary' qualfier to enable dropping of MySQL primary key constraints. + :param type: deprecated, use ``type_``. + + .. versionchanged:: 0.4.2 + :param schema: Optional schema name to operate within. .. versionadded:: 0.4.0 """ + if type and type_ is None: + type_ = type + t = self._table(tablename, schema=schema) types = { 'foreignkey':lambda name:sa_schema.ForeignKeyConstraint( @@ -664,7 +674,7 @@ class Operations(object): None:sa_schema.Constraint } try: - const = types[type] + const = types[type_] except KeyError: raise TypeError("'type' can be one of %s" % ", ".join(sorted(repr(x) for x in types))) @@ -734,7 +744,7 @@ class Operations(object): numerics should be supported. Other types like boolean, dates, etc. may or may not be supported yet by various backends. - :param type_: optional - a :class:`sqlalchemy.types.TypeEngine` + :param ``type_``: optional - a :class:`sqlalchemy.types.TypeEngine` subclass stating the type of this value. In SQLAlchemy expressions, this is usually derived automatically from the Python type of the value itself, as well as diff --git a/docs/build/changelog.rst b/docs/build/changelog.rst index 0525597e..69ecbfeb 100644 --- a/docs/build/changelog.rst +++ b/docs/build/changelog.rst @@ -9,6 +9,14 @@ Changelog :version: 0.4.2 :released: Fri Jan 11 2013 + .. change:: + :tags: bug, documentation + + The name of the "type" parameter on :func:`.drop_constraint` + is now officially named ``type_`` for consistency. + ``type`` will remain in at least the near future for + backwards compatibility. + .. change:: :tags: bug, autogenerate :tickets: 99