diff options
author | Ann Kamyshnikova <akamyshnikova@mirantis.com> | 2016-04-12 11:19:53 +0300 |
---|---|---|
committer | Ann Kamyshnikova <akamyshnikova@mirantis.com> | 2016-04-15 17:11:42 +0300 |
commit | f5a8fb34d35b0d9daf591155fb7b74ea23fd34b5 (patch) | |
tree | 1b57f464fe555e18e0640ececd7f6bf4311d6a1d /oslo_db | |
parent | 46767e58b909eeb87148e73a2058377568403db3 (diff) | |
download | oslo-db-f5a8fb34d35b0d9daf591155fb7b74ea23fd34b5.tar.gz |
Fix server_default comparison for BigInteger
It is needed to add manual check for server_default parameter for
BigInteger as it is already done for Integer.
Closes-bug: #1569262
Change-Id: I91b5b3516a6ea0674bc31f3d5a91505fcd927b8b
Diffstat (limited to 'oslo_db')
-rw-r--r-- | oslo_db/sqlalchemy/test_migrations.py | 5 | ||||
-rw-r--r-- | oslo_db/tests/sqlalchemy/test_migrations.py | 3 |
2 files changed, 7 insertions, 1 deletions
diff --git a/oslo_db/sqlalchemy/test_migrations.py b/oslo_db/sqlalchemy/test_migrations.py index 4b71048..df53b85 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 3d97976..65ad6f8 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): |