Merge "Fix server_default comparison for BigInteger"

This commit is contained in:
Jenkins 2016-04-16 10:23:07 +00:00 committed by Gerrit Code Review
commit 7fcaf832b6
2 changed files with 7 additions and 1 deletions

View File

@ -481,7 +481,10 @@ class ModelsMigrationsSync(object):
isinstance(meta_def.arg, expr.False_) and insp_def == "'0'"
)
if isinstance(meta_col.type, sqlalchemy.Integer):
impl_type = meta_col.type
if isinstance(impl_type, types.Variant):
impl_type = impl_type.load_dialect_impl(bind.dialect)
if isinstance(impl_type, (sqlalchemy.Integer, sqlalchemy.BigInteger)):
if meta_def is None or insp_def is None:
return meta_def != insp_def
return meta_def.arg != insp_def.split("'")[1]

View File

@ -200,6 +200,7 @@ class ModelsMigrationSyncMixin(test_base.DbTestCase):
name='testenum'),
server_default="first"),
sa.Column('variant', sa.BigInteger()),
sa.Column('variant2', sa.BigInteger(), server_default='0'),
sa.Column('fk_check', sa.String(36), nullable=False),
sa.UniqueConstraint('spam', 'eggs', name='uniq_cons'),
)
@ -230,6 +231,8 @@ class ModelsMigrationSyncMixin(test_base.DbTestCase):
server_default="first")
variant = sa.Column(sa.BigInteger().with_variant(
sa.Integer(), 'sqlite'))
variant2 = sa.Column(sa.BigInteger().with_variant(
sa.Integer(), 'sqlite'), server_default='0')
bar = sa.Column('bar', sa.Numeric(10, 5))
class ModelThatShouldNotBeCompared(BASE):