core/migration/README.md

42 lines
697 B
Markdown
Raw Normal View History

2021-08-20 09:27:19 +00:00
# discours-migration
First, put the `data` into this folder.
## Install
```sh
pipenv install -r requirements.txt
```
## Using
2021-08-20 23:17:15 +00:00
Put the unpacked mongodump to the `data` folder and operate with
`pipenv shell && python`
2021-08-20 09:27:19 +00:00
2021-08-20 23:17:15 +00:00
1. get old data jsons
2021-08-20 09:27:19 +00:00
```py
import bson2json
bson2json.json_tables() # creates all the needed data json from bson mongodump
```
2. migrate users
2021-08-20 23:17:15 +00:00
```sh
pipenv run python migrate.py users
```
2021-08-21 00:40:41 +00:00
Note: this will create db entries and it is not tolerant to existed unique
email.
2021-08-20 09:27:19 +00:00
2021-08-20 23:17:15 +00:00
3. then topics and shouts
2021-08-20 09:27:19 +00:00
2021-08-20 23:17:15 +00:00
```sh
pipenv run python migrate.py topics
pipenv run python migrate.py shouts
```
2021-08-20 09:27:19 +00:00
2021-08-21 00:40:41 +00:00
Now you got the \*.dict.json files which contain all the data with old and
new(!) ids.