):
comparator = _type_comparators.get(conn_type._type_affinity, None)
- return comparator and comparator(metadata_type, conn_type)
+ return comparator and comparator(metadata_impl, conn_type)
else:
return True
.. changelog::
:version: 0.8.9
+ .. change::
+ :tags: bug, autogenerate
+ :tickets: 395
+
+ Fixed bug where usage of a custom TypeDecorator which returns a
+ per-dialect type via :meth:`.TypeDecorator.load_dialect_impl` that differs
+ significantly from the default "impl" for the type decorator would fail
+ to compare correctly during autogenerate.
+
.. change::
:tags: bug, autogenerate, postgresql
:tickets: 392
TypeDecorator, CheckConstraint, text, PrimaryKeyConstraint, \
ForeignKeyConstraint, VARCHAR, DECIMAL, DateTime, BigInteger, BIGINT, \
SmallInteger
-from sqlalchemy.types import NULLTYPE
+from sqlalchemy.dialects import sqlite
+from sqlalchemy.types import NULLTYPE, VARBINARY
from sqlalchemy.engine.reflection import Inspector
from alembic.operations import ops
return impl.DefaultImpl(
default.DefaultDialect(), None, False, True, None, {})
+ def test_typedec_to_nonstandard(self):
+
+ class PasswordType(TypeDecorator):
+ impl = VARBINARY
+
+ def copy(self, **kw):
+ return PasswordType(self.impl.length)
+
+ def load_dialect_impl(self, dialect):
+ if dialect.name == 'default':
+ impl = sqlite.NUMERIC(self.length)
+ else:
+ impl = VARBINARY(self.length)
+ return dialect.type_descriptor(impl)
+
+ impl = self._fixture()
+ impl.compare_type(
+ Column('x', sqlite.NUMERIC(50)),
+ Column('x', PasswordType(50)))
+
def test_string(self):
t1 = String(30)
t2 = String(40)