summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2018-02-19 14:01:06 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2018-02-22 15:54:58 -0500
commit3b260a3bca8c9af6fc81a122e8696e09802a6881 (patch)
treed1ae7fba404938fc1bea36add355acc30b9fcb82
parent006e4da4d4c7cc0d4ffca8a277a437e75412699d (diff)
downloadoslo-db-3b260a3bca8c9af6fc81a122e8696e09802a6881.tar.gz
Conditionally adjust for quoting in comparing MySQL defaults
MariaDB 10.2 appears to not return server defaults with quotes around integer values which breaks the assumption that we have to de-quote server default values. Make the dequoting a regexp that will pass when the quotes are not present. Change-Id: Ie5aeffcc3c550673a7fdd82769a315821cebb272 Closes-bug: #1750414
-rw-r--r--oslo_db/sqlalchemy/test_migrations.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/oslo_db/sqlalchemy/test_migrations.py b/oslo_db/sqlalchemy/test_migrations.py
index d650025..4b8cb12 100644
--- a/oslo_db/sqlalchemy/test_migrations.py
+++ b/oslo_db/sqlalchemy/test_migrations.py
@@ -476,9 +476,10 @@ class ModelsMigrationsSync(object):
if isinstance(meta_col.type, sqlalchemy.Boolean):
if meta_def is None or insp_def is None:
return meta_def != insp_def
+ insp_def = insp_def.strip("'")
return not (
- isinstance(meta_def.arg, expr.True_) and insp_def == "'1'" or
- isinstance(meta_def.arg, expr.False_) and insp_def == "'0'"
+ isinstance(meta_def.arg, expr.True_) and insp_def == "1" or
+ isinstance(meta_def.arg, expr.False_) and insp_def == "0"
)
impl_type = meta_col.type
@@ -487,7 +488,8 @@ class ModelsMigrationsSync(object):
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]
+ insp_def = insp_def.strip("'")
+ return meta_def.arg != insp_def
@_compare_server_default.dispatch_for('postgresql')
def _compare_server_default(bind, meta_col, insp_def, meta_def):