deprecate two columns alter

This commit is contained in:
iElectric 2010-04-30 08:34:30 +02:00
parent a4176bf10e
commit cef2abb30f
4 changed files with 12 additions and 1 deletions

View File

@ -1,5 +1,6 @@
0.6.0
-----
- deprecated `alter_column` comparing of columns. Just use explicit parameter change.
- added option to define custom templates through option ``--templates_path`` and ``--templates_theme``, read more in :ref:`tutorial section <custom-templates>`
- use Python logging for output, can be shut down by passing ``--disable_logging`` to :func:`migrate.versioning.shell.main`
- `url` parameter can also be an :class:`Engine` instance (this usage is discouraged though sometimes necessary)

View File

@ -69,10 +69,12 @@ Given a standard SQLAlchemy table::
assert col.nullable
assert table.c.col3 is col
.. warning::
Since version ``0.6.0`` passing column into alter is deprecated. Pass in explicit parameters instead.
.. note::
Since version ``0.6.0`` you can pass primary_key_name, index_name and unique_name to column.create method to issue ALTER TABLE ADD CONSTRAINT after changing the column. Note for multi columns constraints and other advanced configuration, check :ref:`constraint tutorial <constraint-tutorial>`.
Since version ``0.6.0`` you can pass primary_key_name, index_name and unique_name to column.create method to issue ALTER TABLE ADD CONSTRAINT after changing the column. Note for multi columns constraints and other advanced configuration, check :ref:`constraint tutorial <constraint-tutorial>`.
.. _table-rename:

View File

@ -4,3 +4,6 @@
:mod:`migrate.changeset` that allows to define database schema changes
using Python.
"""
class MigrateDeprecationWarning(DeprecationWarning):
"""Warning for deprecated features in Migrate"""

View File

@ -4,6 +4,7 @@
from UserDict import DictMixin
import sqlalchemy
from migrate import MigrateDeprecationWarning
from migrate.changeset import SQLA_06
from migrate.changeset.exceptions import *
from migrate.changeset.databases.visitor import (get_engine_visitor,
@ -103,6 +104,10 @@ def alter_column(*p, **k):
if 'engine' not in k:
k['engine'] = k['table'].bind
# deprecation
if len(p) >= 2 and isinstance(p[1], sqlalchemy.Column):
raise MigrateDeprecationWarning("Alter column with comparing columns is deprecated. Just pass in parameters instead.")
engine = k['engine']
delta = ColumnDelta(*p, **k)