diff --git a/tildes/tildes/models/log/log.py b/tildes/tildes/models/log/log.py index e8f9eaa..f466857 100644 --- a/tildes/tildes/models/log/log.py +++ b/tildes/tildes/models/log/log.py @@ -57,7 +57,7 @@ class BaseLog: @declared_attr def info(self) -> Column: """Return the info column.""" - return Column(MutableDict.as_mutable(JSONB)) + return Column(MutableDict.as_mutable(JSONB(none_as_null=True))) @declared_attr def user(self) -> Any: diff --git a/tildes/tildes/models/scraper/scraper_result.py b/tildes/tildes/models/scraper/scraper_result.py index 9d13ea2..4eb5dcd 100644 --- a/tildes/tildes/models/scraper/scraper_result.py +++ b/tildes/tildes/models/scraper/scraper_result.py @@ -28,7 +28,7 @@ class ScraperResult(DatabaseModel): index=True, server_default=text("NOW()"), ) - data: Any = Column(JSONB) + data: Any = Column(JSONB(none_as_null=True)) def __init__(self, url: str, scraper_type: ScraperType, data: Any) -> None: """Create a new ScraperResult.""" diff --git a/tildes/tildes/models/topic/topic.py b/tildes/tildes/models/topic/topic.py index 523f586..8632384 100644 --- a/tildes/tildes/models/topic/topic.py +++ b/tildes/tildes/models/topic/topic.py @@ -106,7 +106,9 @@ class Topic(DatabaseModel): _markdown: Optional[str] = deferred(Column("markdown", Text)) rendered_html: Optional[str] = Column(Text) link: Optional[str] = Column(Text) - content_metadata: Dict[str, Any] = Column(MutableDict.as_mutable(JSONB)) + content_metadata: Dict[str, Any] = Column( + MutableDict.as_mutable(JSONB(none_as_null=True)) + ) num_comments: int = Column(Integer, nullable=False, server_default="0", index=True) num_votes: int = Column(Integer, nullable=False, server_default="0", index=True) _tags: List[Ltree] = Column( diff --git a/tildes/tildes/models/user/user.py b/tildes/tildes/models/user/user.py index 243c859..929835e 100644 --- a/tildes/tildes/models/user/user.py +++ b/tildes/tildes/models/user/user.py @@ -94,7 +94,7 @@ class User(DatabaseModel): open_new_tab_text: bool = Column(Boolean, nullable=False, server_default="false") theme_default: str = Column(Text) is_banned: bool = Column(Boolean, nullable=False, server_default="false") - permissions: Any = Column(JSONB) + permissions: Any = Column(JSONB(none_as_null=True)) home_default_order: Optional[TopicSortOption] = Column(ENUM(TopicSortOption)) home_default_period: Optional[str] = Column(Text) _filtered_topic_tags: List[Ltree] = Column(