diff --git a/migration/tables/content_items.py b/migration/tables/content_items.py index 5adae72e..8ce210db 100644 --- a/migration/tables/content_items.py +++ b/migration/tables/content_items.py @@ -1,5 +1,5 @@ from datetime import datetime - +import json from dateutil.parser import parse as date_parse from sqlalchemy.exc import IntegrityError from transliterate import translit @@ -192,7 +192,7 @@ async def migrate(entry, storage): # body r["body"], media = prepare_html_body(entry) if media: - print(media) + r["media"] = json.dumps(media) # save shout to db s = object() shout_dict = r.copy() diff --git a/orm/shout.py b/orm/shout.py index 7828aa62..ec954711 100644 --- a/orm/shout.py +++ b/orm/shout.py @@ -1,6 +1,6 @@ from datetime import datetime -from sqlalchemy import Boolean, Column, DateTime, ForeignKey, Integer, String +from sqlalchemy import Boolean, Column, DateTime, ForeignKey, Integer, String, JSON from sqlalchemy.orm import relationship from base.orm import Base @@ -58,6 +58,7 @@ class Shout(Base): versionOf = Column(ForeignKey("shout.slug"), nullable=True) lang = Column(String, default='ru') oid = Column(String, nullable=True) + media = Column(JSON, nullable=True) createdAt = Column(DateTime, nullable=False, default=datetime.now, comment="Created at") updatedAt = Column(DateTime, nullable=True, comment="Updated at") diff --git a/schema.graphql b/schema.graphql index 14420949..4141ca39 100644 --- a/schema.graphql +++ b/schema.graphql @@ -440,6 +440,7 @@ type Shout { deletedBy: User publishedBy: User publishedAt: DateTime + media: String stat: Stat }