migration-fixes

This commit is contained in:
tonyrewin 2022-06-25 09:31:44 +03:00
parent f92be99bce
commit 8041c02878
8 changed files with 2 additions and 1 deletions

View File

@ -83,6 +83,7 @@ def topics(export_topics, topics_by_slug, topics_by_oid, cats_data, tags_data):
if len(sys.argv) > 2: limit = int(sys.argv[2]) if len(sys.argv) > 2: limit = int(sys.argv[2])
print('migrating %d topics...' % limit) print('migrating %d topics...' % limit)
counter = 0 counter = 0
topics_by_title = {}
for tag in tags_data: for tag in tags_data:
old_id = tag["createdBy"] old_id = tag["createdBy"]
tag["createdBy"] = user_id_map.get(old_id, 0) tag["createdBy"] = user_id_map.get(old_id, 0)

View File

View File

View File

View File

View File

View File

View File

@ -34,7 +34,7 @@ def migrate(entry):
res['old_id'] = entry['_id'] res['old_id'] = entry['_id']
res['password'] = entry['services']['password'].get('bcrypt', '') res['password'] = entry['services']['password'].get('bcrypt', '')
del entry['services'] del entry['services']
del entry['subscribedTo'] if entry.get('subscribedTo', '') != '': del entry['subscribedTo']
res['username'] = entry['emails'][0]['address'] res['username'] = entry['emails'][0]['address']
res['email'] = res['username'] res['email'] = res['username']
res['wasOnlineAt'] = parse(entry.get('loggedInAt', entry['createdAt'])) res['wasOnlineAt'] = parse(entry.get('loggedInAt', entry['createdAt']))