Handle server default quoting
Alembic was previously modifying the metadata server default when comparing it in the autogenerate process. This was removed in Alembic 1.11. As noted in the commit message [1], we implement our own 'compare_server_default' which means we now need to handle this. [1] https://github.com/sqlalchemy/alembic/commit/230a2932f6 Change-Id: Ib5f8f78b917d79c4c234cc689c13acff011c2403 Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
This commit is contained in:
parent
bbb5fbe47b
commit
c69e5e5f89
@ -18,6 +18,7 @@ import abc
|
|||||||
import functools
|
import functools
|
||||||
import logging
|
import logging
|
||||||
import pprint
|
import pprint
|
||||||
|
import re
|
||||||
|
|
||||||
import alembic
|
import alembic
|
||||||
import alembic.autogenerate
|
import alembic.autogenerate
|
||||||
@ -240,6 +241,12 @@ class ModelsMigrationsSync(object, metaclass=abc.ABCMeta):
|
|||||||
isinstance(meta_def.arg, expr.False_) and insp_def == "0"
|
isinstance(meta_def.arg, expr.False_) and insp_def == "0"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if isinstance(meta_col.type, sqlalchemy.String):
|
||||||
|
if meta_def is None or insp_def is None:
|
||||||
|
return meta_def != insp_def
|
||||||
|
insp_def = re.sub(r"^'|'$", "", insp_def)
|
||||||
|
return meta_def.arg != insp_def
|
||||||
|
|
||||||
def filter_metadata_diff(self, diff):
|
def filter_metadata_diff(self, diff):
|
||||||
"""Filter changes before assert in test_models_sync().
|
"""Filter changes before assert in test_models_sync().
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user