Usage

Utilities for migrating past Invenio versions to Invenio 3.0.

Invenio-Migrator consists of two parts:

  • Dumpers: Tools for dumping data from an existing Invenio 1.2 or 2.x installation into a JSON file.
  • Loaders: Tools for loading an Invenio legacy dump into an Invenio 3 installation.

Dumping data

First install Invenio-Migrator on your legacy installation (see Installation). You now the invenio-migrator CLI availble to dump your data:

$ inveniomigrator --help
Usage: inveniomigrator [OPTIONS] COMMAND [ARGS]...

  Command for dumping legacy installation into a file JSON.

Options:
  --help  Show this message and exit.

Commands:
  dump  Dump data from Invenio legacy.

Records/files

You can use the CLI to dump e.g. records and files:

$ inveniomigrator dump records --query collection:preprints

This will dump the records and files in chunks of 1000 records into JSON files in the current working directory. For each record Invenio-Migrator will dump:

  • Record revisions in MARCXML and JSON
  • Files for a record.

Loading data

First install Invenio-Migrator on your Invenio 3 installation (see Installation). This adds a dumps command to your instance CLI, which you can use to load the record dumps:

$ <instance cmd> dumps loadrecords /path/to/records_dump_0.json

By default the MARCXML for each record is used to for loading the record. If you wish to use the JSON for each record instead, simply use the --source-type json option to above command.

Customizing loading

In case you need custom loading behavior of your dumps, you can subclass the two classes invenio_migrator.records.RecordDump and invenio_migrator.records.RecordDumpLoader. See API documentation for further details.

Module specific usage

Instructions below describe the dumping/loading of data specific to each module.

Invenio-Communities migration.

Invenio-Communities

Dumping data from Legacy

Dump the models User, Community and FeaturedCommunity:

$ inveniomigrator dump users
$ inveniomigrator dump communities
$ inveniomigrator dump featured

Prepare a tarbar of community logos:

$ cd /(invenio instance path)/static/media
$ tar cvf communities.tar ./communities

This will result in the output files:

  • users_dump_*.json
  • communities_dump_*.json
  • featured_dump_*.json
  • communities.tar

Loading data

Extract the tarball communities.tar to a communities/ directory:

$ tar xvf ./communities.tar

Initialize the communities files bucket:

$ invenio communities init

Load the users, communities and community featurings. Last parameter of invenio dumps loadcommunities should point to the directory containing the community logos.

$ for f in ./users_dump_*.json; do invenio dumps loadusers $f; done
$ for f in ./communities_dump_*.json; do invenio dumps loadcommunities $f \
        ./communities/; done
$ for f in ./featured_dump_*.json; do invenio dumps loadfeatured $f; done