core/migration
2021-08-20 12:27:19 +03:00
..
tables role_id and topic relations fixes 2021-08-20 12:27:19 +03:00
__init__.py role_id and topic relations fixes 2021-08-20 12:27:19 +03:00
bson2json.py role_id and topic relations fixes 2021-08-20 12:27:19 +03:00
html2md.py role_id and topic relations fixes 2021-08-20 12:27:19 +03:00
README.md role_id and topic relations fixes 2021-08-20 12:27:19 +03:00
utils.py role_id and topic relations fixes 2021-08-20 12:27:19 +03:00

discours-migration

First, put the data into this folder.

Install

pipenv install -r requirements.txt

Using

Put the unpacked mongodump to the data folder and operate with pipenv shell && python

  1. get old data jsons
import bson2json

bson2json.json_tables() # creates all the needed data json from bson mongodump
  1. migrate users
import json
from migrations.users import migrate

data = json.loads(open('data/users.json').read())
newdata = {}

for u in data:
    try:
        newdata[u['_id']] = migrate(u)
    except:
        print('FAIL!')
        print(u)