migration wip

This commit is contained in:
Untone 2021-08-20 12:30:52 +03:00
parent 3075dbb64b
commit f756cb9fb6
3 changed files with 4 additions and 2 deletions

View File

@ -67,5 +67,8 @@ if __name__ == '__main__':
topics()
users()
shouts()
elif sys.argv[1] == "bson":
import migration.bson2json
bson2json.json_tables()
else:
print('usage: python migrate.py <all|topics|users|shouts|comments>')

View File

@ -75,8 +75,6 @@ def migrate(entry):
r['body'] = '<ShoutVideo src=\"' + entry['media'][0]['youtubeId'] + '\" />'
elif entry.get('type') == 'Music':
r['body'] = '<ShoutMusic media={\"' + json.dumps(entry['media']) +'\"} />'
else entry.get('type') == 'Image':
r['body'] = r['body']
else:
r['body'] = '## ' + r['title']
# TODO: compile md with graymatter

View File

@ -26,3 +26,4 @@ class Topic(Base):
parents = relationship(lambda: Topic, secondary=Connection, primaryjoin=slug==Connection.c.parent, secondaryjoin=slug==Connection.c.child, viewonly=True)
# list of Topics where the current node is the "parent"
children = relationship(lambda: Topic, secondary=Connection, primaryjoin=slug==Connection.c.child, secondaryjoin=slug==Connection.c.parent)