PG_SQLAPPLY

Postgres SQLApply Tool

Tool on Python (3) for migrating Postgres databases using changesets, with features for visualizing commits, dry-run functionality, and comprehensive logging of the process.

Features

folder

Organized Structure

Changesets with database sections and numbered SQL scripts for clear organization

sync

Transaction Control

Single transaction mode with automatic rollback on errors

clipboard

Execution History

Tracks all executed scripts with MD5 checksums in database schema

search

Dry Run Mode

Check and validate changesets before actual execution

lightning

Force Re-apply

Re-execute all, failed only, or changed scripts (by MD5)

link

Editions

Full (Python package) or Onefile .py

Quick Start

# Clone repository
git clone https://github.com/mk-samoilov/pg_sqlapply.git
cd pg_sqlapply

# Initialize config
python3 -m sql_apply

# Create changeset structure
mkdir -p changes/release_v1/my_database

# Add SQL scripts
echo "CREATE TABLE users (id SERIAL PRIMARY KEY);" > changes/release_v1/my_database/01_users.sql

# Initialize and execute
python3 -m sql_apply release_v1 --init
python3 -m sql_apply release_v1

Resources

- Name - - Repository - - Download -
Lasted GitHub Repo Download ZIP
Lasted Onefile GitHub Repo Download ZIP

Requirements

python Python 3.10+
postgres PostgreSQL + psql
linux Linux