diff --git a/oslo_db/sqlalchemy/test_migrations.py b/oslo_db/sqlalchemy/test_migrations.py index 4b710488..df53b855 100644 --- a/oslo_db/sqlalchemy/test_migrations.py +++ b/oslo_db/sqlalchemy/test_migrations.py @@ -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] diff --git a/oslo_db/tests/sqlalchemy/test_migrations.py b/oslo_db/tests/sqlalchemy/test_migrations.py index 3d97976d..65ad6f81 100644 --- a/oslo_db/tests/sqlalchemy/test_migrations.py +++ b/oslo_db/tests/sqlalchemy/test_migrations.py @@ -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):