This commit is contained in:
tonyrewin 2022-09-05 10:18:56 +03:00
parent 616463e3da
commit 14bbce808a

View File

@ -67,39 +67,22 @@ def export_slug(slug, storage):
def export_email_subscriptions(): def export_email_subscriptions():
email_subscriptions_data = json.loads( email_subscriptions_data = json.loads(open("migration/data/email_subscriptions.json").read())
open("migration/data/email_subscriptions.json").read()
)
for data in email_subscriptions_data: for data in email_subscriptions_data:
# TODO: migrate to mailgun list manually
# migrate_email_subscription(data) # migrate_email_subscription(data)
pass pass
print( print("[migration] " + str(len(email_subscriptions_data)) + " email subscriptions exported")
"[migration] "
+ str(len(email_subscriptions_data))
+ " email subscriptions exported"
)
def export_shouts(storage): def export_shouts(storage):
# update what was just migrated or load json again # update what was just migrated or load json again
if len(storage["users"]["by_slugs"].keys()) == 0: if len(storage["users"]["by_slugs"].keys()) == 0:
storage["users"]["by_slugs"] = json.loads( storage["users"]["by_slugs"] = json.loads(open(EXPORT_DEST + "authors.json").read())
open(EXPORT_DEST + "authors.json").read() print("[migration] " + str(len(storage["users"]["by_slugs"].keys())) + " exported authors ")
)
print(
"[migration] "
+ str(len(storage["users"]["by_slugs"].keys()))
+ " exported authors "
)
if len(storage["shouts"]["by_slugs"].keys()) == 0: if len(storage["shouts"]["by_slugs"].keys()) == 0:
storage["shouts"]["by_slugs"] = json.loads( storage["shouts"]["by_slugs"] = json.loads(open(EXPORT_DEST + "articles.json").read())
open(EXPORT_DEST + "articles.json").read() print("[migration] " + str(len(storage["shouts"]["by_slugs"].keys())) + " exported articles ")
)
print(
"[migration] "
+ str(len(storage["shouts"]["by_slugs"].keys()))
+ " exported articles "
)
for slug in storage["shouts"]["by_slugs"].keys(): for slug in storage["shouts"]["by_slugs"].keys():
export_slug(slug, storage) export_slug(slug, storage)
@ -147,8 +130,4 @@ def export_json(
ensure_ascii=False, ensure_ascii=False,
) )
) )
print( print("[migration] " + str(len(export_comments.items())) + " exported articles with comments")
"[migration] "
+ str(len(export_comments.items()))
+ " exported articles with comments"
)