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
This commit is contained in:
parent
006e4da4d4
commit
3b260a3bca
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue