This is a one-time migration script to reorganize locales for DSW between versions 4.26 and 4.27.
This tool migrates locale assets stored in MinIO (S3-compatible) from the legacy folder naming format:
locales/<organization-id>:<locale-id>:<version>/wizard.jsonlocales/<organization-id>:<locale-id>:<version>/mail.po
to the new structure:
locales/<locale_uuid>/wizard.jsonlocales/<locale_uuid>/mail.po
The locale_uuid is resolved from PostgreSQL using:
SELECT uuid
FROM locale
WHERE organization_id = <organization_id>
AND locale_id = <locale_id>
AND version = <version>;- Connects to MinIO using
.envconfiguration - Lists all objects under the fixed prefix
locales/ - Extracts the legacy folder name (
<org>:<locale>:<version>) - Looks up the matching UUID in PostgreSQL
- Moves (copy + delete)
wizard.jsonand/ormail.poif present - If the DB record is missing, prints a WARNING
- If only
wizard.jsonexists (or onlymail.po), it migrates only the existing file
- Python 3.11+
- Access to MinIO and PostgreSQL
-
Create and activate a virtual environment:
python3.11 -m venv .venv source .venv/bin/activate -
Install dependencies:
pip install -r requirements.txt
-
Create
.envfrom the example:cp .env.example .env
-
Edit
.envwith your MinIO and PostgreSQL credentials.
python migrate_locales.pySet:
DRY_RUN=truein your .env to print what would be moved without changing anything.
- "Move" is implemented as S3 copy + delete.
- If the destination object already exists, the script skips it and prints a warning.