Data migration system from Version 3 to Version 4

This document describes the data migration process for the Pod application from version 3.8.x to version 4.0.x. The system is based on two main scripts:

Prerequisites


Exporting data from Pod v3

Export Description

This first script exports data from the Pod v3.8.x database into a JSON file. It supports both MariaDB/MySQL and PostgreSQL and adapts SQL queries accordingly.

Note: This script must be run from a Pod v3 server.

The latest version of this script export_data_from_v3_to_v4.py is available here: https://github.com/EsupPortail/Esup-Pod/tree/main/pod/video/management/commands

You need to retrieve this script and place it in the pod/video/management/commands directory with the correct permissions.

Export Key features

Important notes before Export

Check your custom/settings_local.py to find the configured BASE_DIR directory.

Data Consolidation

Before attempting an export, it may be useful to ensure data consolidation. A dedicated script, check_database_problems.py, is available here: https://github.com/EsupPortail/Esup-Pod/tree/main/pod/video/management/commands

You need to retrieve this script and place it in the pod/video/management/commands directory with the correct permissions.

python manage.py check_database_problems

The script will detect and fix inconsistencies.

Export

Run the script from a Pod v3 server using the following command:

python manage.py export_data_from_v3_to_v4

Importing data into Pod v4

Import Description

This script imports data from the previously generated JSON file into a Pod v4 database. It supports MariaDB/MySQL and PostgreSQL, reads data from the specified JSON file, processes it, and inserts it into the appropriate tables in the Pod v4 database.

Import Key features

Important notes before import

Check your custom/settings_local.py to find the configured BASE_DIR directory.

python manage.py index_videos --all

Import

Run the script using the management command:

python manage.py import_data_from_v3_to_v4

Arguments

Examples

Dry run:

python manage.py import_data_from_v3_to_v4 --dry

If the database is completely empty (no tables), you can run this command which will perform a make createDB before importing data:

python manage.py import_data_from_v3_to_v4 --createDB

If you encountered a “Too many connections” error while importing tags, feel free to increase the time_sleep value (e.g., 0.4 or 0.5 seconds) and re-run the process, but only for tags:

python manage.py import_data_from_v3_to_v4 --onlytags

Of course, it is possible to mix the different arguments.


By following these instructions, you should be able to successfully migrate your Pod 3.8.x database to Pod 4.0.x.