dev@locazia: migrate to cidv2

This commit is contained in:
user committed 2024-03-08 19:27:51 +03:00
1 parent 3fdc9ada39
commit 606ef553bc
4 files changed
+98 -17

No files matched your search

+2 -1
View File
@@ -14,6 +14,7 @@ class StoredContent(AlchemyBase):
id = Column(Integer, autoincrement=True, primary_key=True)
type = Column(String(32), nullable=False)
hash = Column(String(64), nullable=False, unique=True) # base58
content_id = Column(String(512), nullable=True) # base58
onchain_index = Column(BigInteger, nullable=True, default=None)
status = Column(String(32), nullable=True)
@@ -70,7 +71,7 @@ class StoredContent(AlchemyBase):
return {
**extra_fields,
"hash": self.hash,
"cid": self.cid.serialize_v1(),
"cid": self.cid.serialize_v2(),
"status": self.status,
"updated": self.updated.isoformat() if isinstance(self.updated, datetime) else (make_log("Content.json_format", f"Invalid Content.updated: {self.updated} ({type(self.updated)})", level="error") or None),
"created": self.created.isoformat() if isinstance(self.created, datetime) else (make_log("Content.json_format", f"Invalid Content.created: {self.created} ({type(self.created)})", level="error") or None),