Simple tool to evolve PostgreSQL schema easily.

License: PostgreSQL

Language: Python

PyPI version Build Status


PostgreSQL migrations made easy


PGmigrate is a database migration tool developed by Yandex.

PGmigrate has the following key-features:

  • Transactional and nontransactional migrations: you can enjoy whole power of PostgreSQL DDL
  • Callbacks: you can run some DDL on specific steps of migration process (e.g. drop some code before executing migrations, and create it back after migrations were applied)
  • Online migrations: you can execute series of transactional migrations and callbacks in a single transaction (so, if something goes wrong simple ROLLBACK will bring you in consistent state)


pip install yandex-pgmigrate

Running tests

Tests require running PostgreSQL instance with superuser (to create/drop dbs). You could setup this yourself and use tox to start tests:


Second option is to use docker and make:

make test

How to use

Complete manual is here.

Release history

  • 1.0.3 (2017-12-28)
    • Fix migration error with comment at the end of file
    • Add blocking pids termination
    • Some minor fixes and improvements
  • 1.0.2 (2017-04-05)
    • Speed up get_info function a bit
    • Fix callbacks in transactional/nontransactional migrations mix on db init
  • 1.0.1 (2017-04-01)
    • Fix bug with python format patterns in migration text
    • Sort info command output by version
    • Support 'latest' target version
    • Add option to override user in migration meta
    • Fix info command fail without target on initialized database
    • Add session setup option
  • 1.0.0 (2016-10-03)
    • First opensource version


Distributed under the PostgreSQL license. See LICENSE for more information.

Project Statistics

Sourcerank 7
Repository Size 71.3 KB
Stars 363
Forks 33
Watchers 24
Open issues 1
Dependencies 0
Contributors 3
Tags 5
Last updated
Last pushed

Top Contributors See all

secwall Vladimir Borodin avmhawk

Packages Referencing this Repo

PostgreSQL migrations made easy
Latest release 1.0.4 - Updated - 363 stars

Recent Tags See all

1.0.4 April 14, 2019
v1.0.3 December 28, 2017
v1.0.2 April 05, 2017
v1.0.1 April 01, 2017
v1.0.0 October 03, 2016

Interesting Forks See all

Simple tool to evolve PostgreSQL schema easily.
Python - Last pushed - 2 stars
Simple tool to evolve PostgreSQL schema easily.
Python - Updated - 1 stars

Something wrong with this page? Make a suggestion

Last synced: 2019-04-15 04:08:11 UTC

Login to resync this repository