Skip to content

PasarGuard/db-migrations

Repository files navigation

PasarGuard Database Migration Tool

Simple database migration tool for PasarGuard data between PostgreSQL, MySQL/MariaDB, and SQLite.

Prerequisites

Install uv (Linux/macOS):

curl -LsSf https://astral.sh/uv/install.sh | sh
source $HOME/.local/bin/env

Recommended Flow (Step-by-Step)

  1. Back up the source database.
  2. Install and run PasarGuard on the target database with the same app version as source.
  3. Wait until PasarGuard completes its own DB migrations.
  4. Prepare migration tool:
git clone https://github.com/PasarGuard/db-migratons.git
cd db-migratons
uv sync
chmod +x migrate.sh
  1. Run interactive migration:
./migrate.sh
  1. In wizard: choose source, enter target DB URL, review summary, confirm with yes.
  2. Verify users, groups, settings, and subscriptions in panel/API.

Alternative Run Modes

Config file mode:

cp config.example.yml config.yml
uv run migrations/universal.py --config config.yml

Direct CLI mode:

./migrate.sh <source> --to <type> --db <target_url> [--exclude-tables <tables>]

URL Formats

PostgreSQL:

postgresql+asyncpg://username:password@host:port/database

MySQL/MariaDB:

mysql+pymysql://username:password@host:port/database

SQLite:

sqlite:///path/to/database.db

Important Files

Notes

  • Migration clears target data after interactive confirmation.
  • Use --exclude-tables for log/history tables if needed.

Support

Other Languages

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •