Migrate data from Devilry v2 to Devilry v3

Dumping the Devilry v2 data

To dump the Devilry v2 database to JSON, run:

python manage.py devilry_dump_database_for_v3_migration <output_directory>

Running this command will create a the output directory, and dump all entries in the database serialized as JSON. Remember to take a backup of this folder.

Backup/copy files

Once the data is dumped, copy the output directory generated by the script, and copy both directories containing files specified by the MEDIA_ROOT and DEVILRY_FSHIERDELIVERYSTORE_ROOT in the Devilry v2 settings file.

Importing the Devilry v2 data to Devilry v3

To import the data dumped from Devilry v2, we first need to define where files are stored so we’re able to copy them. We need to define the path to the files through a couple of settings you need to define in ~/devilrydeploy/devilry_settings.py. This is the path to the directories you copied as described above.

Set the path to the media root folder, this is the path defined in the MEDIA_ROOT setting in the settings file for the Devilry v2 server:

DEVILRY_V2_MEDIA_ROOT = "path/to/media/root/"

Set path to delivery file hierarchy root folder, this is the path defined in the DEVILRY_FSHIERDELIVERYSTORE_ROOT setting in the settings file for the Devilry v2 server:

DEVILRY_V2_DELIVERY_FILE_ROOT = "path/to/delivery/root"

Now, that the paths to where we can find the files is set up, we’re ready to import the data. This is a pretty simple two-step process, run the command:

$ python manage.py devilry_import_v2_database <path/to/v2/dumped/data/directory>

this might take some time depending on how much data is stored in the v2 database, and how many files that needs to be copied. When this is finished we need to rebuild the database cache, run:

$ ievv customsql -i -r

Additional info about the import script

The devilry_import_v2_database script comes with some arguments that can be helpful, namely –start-at, –stop-at and –fake.

  • start-at
    Which importer you want to start importing from?
  • stop-at
    Which importer do you want to stop at?
  • fake
    Will not import/migrate the v2 data, but simply print it to the console.

For further details(such as importer names), run:

$ python manage.py devilry_import_v2_database -h

Remove old semesters

If you want to, you can remove old semester and all associated data.

See devilry_delete_periods.