Like diff but for PostgreSQL schemas
Go to file
2022-09-18 16:05:13 +10:00
.circleci fixbuild 2022-07-24 21:29:58 +10:00
.github cleanup funding file 2020-05-08 20:06:48 +10:00
deploy tags 2020-08-28 13:59:50 +10:00
docs Add exclude schema option (#152) 2020-10-08 10:31:01 +11:00
migra drop expression support 2022-09-18 16:05:13 +10:00
tests drop expression support 2022-09-18 16:05:13 +10:00
.dockerignore Added Dockerfile and .dockerignore 2018-01-12 13:31:19 +11:00
.flake8 .flake8 2018-10-29 09:56:16 +11:00
.gitignore Update tests for excl constraints 2022-07-24 19:18:33 +10:00
build-docker.sh Improved Docker container. 2018-08-05 22:13:12 +08:00
CODE_OF_CONDUCT.md Create CODE_OF_CONDUCT.md 2019-04-07 13:39:35 +10:00
CONTRIBUTION_GUIDE.md contrib guide 2022-03-16 22:44:21 +11:00
docker-entrypoint.sh Fix container image build (#178) 2021-05-20 13:21:07 +10:00
Dockerfile Fix container image build (#178) 2021-05-20 13:21:07 +10:00
LICENSE initial commit 2016-07-25 16:38:42 +12:00
Makefile update tests (#197) 2022-03-13 15:04:40 +11:00
MANIFEST.in new docs 2017-08-20 13:25:05 +10:00
poetry.lock drop expression support 2022-09-18 16:05:13 +10:00
pyproject.toml drop expression support 2022-09-18 16:05:13 +10:00
README.md minor readme edit 2020-09-03 07:57:04 +10:00

migra: Like diff but for Postgres schemas

  • compare schemas

  • autogenerate migration scripts

  • autosync your development database from your application models

  • make your schema changes testable, robust, and (mostly) automatic

migra is a schema diff tool for PostgreSQL, written in Python. Use it in your python scripts, or from the command line like this:

$ migra postgresql:///a postgresql:///b
alter table "public"."products" add column newcolumn text;

alter table "public"."products" add constraint "x" CHECK ((price > (0)::numeric));

migra magically figures out all the statements required to get from A to B.

Most features of PostgreSQL are supported.

Migra supports PostgreSQL >= 9 only. Known issues exist with earlier versions. More recent versions are more comprehensively tested. Development resources are limited, and feature support rather than backwards compatibility is prioritised.

THE DOCS

Documentation is at databaseci.com/docs/migra.

Folks, schemas are good

Schema migrations are without doubt the most cumbersome and annoying part of working with SQL databases. So much so that some people think that schemas themselves are bad!

But schemas are actually good. Enforcing data consistency and structure is a good thing. Its the migration tooling that is bad, because its harder to use than it should be. migra is an attempt to change that, and make migrations easy, safe, and reliable instead of something to dread.

Contributing

Contributing is easy. Jump into the issues, find a feature or fix you'd like to work on, and get involved. Or create a new issue and suggest something completely different. If you're unsure about any aspect of the process, just ask.

Credits