Skip to content

ds-wizard/dsw-locale-migration-script

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Locale assets migration (MinIO + PostgreSQL)

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.json
  • locales/<organization-id>:<locale-id>:<version>/mail.po

to the new structure:

  • locales/<locale_uuid>/wizard.json
  • locales/<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>;

What it does

  • Connects to MinIO using .env configuration
  • 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.json and/or mail.po if present
  • If the DB record is missing, prints a WARNING
  • If only wizard.json exists (or only mail.po), it migrates only the existing file

Requirements

  • Python 3.11+
  • Access to MinIO and PostgreSQL

Setup

  1. Create and activate a virtual environment:

    python3.11 -m venv .venv
    source .venv/bin/activate
  2. Install dependencies:

    pip install -r requirements.txt
  3. Create .env from the example:

    cp .env.example .env
  4. Edit .env with your MinIO and PostgreSQL credentials.

Run

python migrate_locales.py

Dry run

Set:

DRY_RUN=true

in your .env to print what would be moved without changing anything.

Notes

  • "Move" is implemented as S3 copy + delete.
  • If the destination object already exists, the script skips it and prints a warning.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages