diff --git a/aerich/ddl/__init__.py b/aerich/ddl/__init__.py index cb57274..6a86982 100644 --- a/aerich/ddl/__init__.py +++ b/aerich/ddl/__init__.py @@ -6,6 +6,7 @@ from aerich.utils import is_default_function +import json class BaseDDL: schema_generator_cls: Type[BaseSchemaGenerator] = BaseSchemaGenerator @@ -89,10 +90,12 @@ def _get_default(self, model: "Type[Model]", field_describe: dict) -> Any: if field_describe.get("field_type") in [ "UUIDField", "TextField", - "JSONField", + # "JSONField", ] or is_default_function(default): default = "" else: + if field_describe.get("field_type") == "JSONField": + default = json.dumps(eval(default), separators=(",", ":")) try: default = self.schema_generator._column_default_generator( db_table,