From 51c7f68ceb568bf71b79815253500d6e549698a4 Mon Sep 17 00:00:00 2001 From: tonyrewin Date: Wed, 13 Jul 2022 19:01:48 +0300 Subject: [PATCH] migration update --- migrate.py | 3 +-- migration/README.md | 21 +++++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/migrate.py b/migrate.py index 135d87c4..754c96c0 100644 --- a/migrate.py +++ b/migrate.py @@ -62,7 +62,6 @@ def shouts_handle(storage): discours_author = 0 pub_counter = 0 for entry in storage['shouts']['data']: - oid = entry['_id'] # slug slug = get_shout_slug(entry) @@ -82,7 +81,7 @@ def shouts_handle(storage): # print('[migration] ' + shout['slug'] + ' with author ' + author) if entry.get('published'): - export_mdx(shout) + if 'mdx' in sys.argv: export_mdx(shout) pub_counter += 1 # print main counter diff --git a/migration/README.md b/migration/README.md index 594b6ab4..12e5ee6a 100644 --- a/migration/README.md +++ b/migration/README.md @@ -12,8 +12,7 @@ pipenv install -r requirements.txt Put the unpacked mongodump to the `data` folder and operate with `pipenv shell && python` - -1. get old data jsons +#### get old data jsons ```py import bson2json @@ -21,22 +20,24 @@ import bson2json bson2json.json_tables() # creates all the needed data json from bson mongodump ``` -2. migrate users +#### migrate all ```sh pipenv install -pipenv run python migrate.py users +pipenv run python migrate.py all +``` +#### or migrate all with mdx exports + +```sh +pipenv install +pipenv run python migrate.py all mdx ``` Note: this will create db entries and it is not tolerant to existed unique email. -3. then topics and shouts +#### or one shout by slug ```sh -pipenv run python migrate.py topics -pipenv run python migrate.py shouts +pipenv run python migrate.py - ``` - -Now you got the \*.dict.json files which contain all the data with old and -new(!) ids.