Like diff but for PostgreSQL schemas
Go to file
2020-08-01 16:33:27 +10:00
.circleci Identity cols (#123) 2020-04-03 11:49:09 +11:00
.github cleanup funding file 2020-05-08 20:06:48 +10:00
deploy partitioning, collations support 2018-11-20 17:32:54 +11:00
docs fix doc formatting 2020-04-23 11:23:54 +10:00
migra modify enums before creating tables 2020-07-28 21:31:41 +10:00
tests defaults before notnulls 2020-08-01 16:33:27 +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 better sequences, better enums 2020-06-30 22:13:03 +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
docker-entrypoint.sh Log docker command only if env is enabled. 2018-08-05 22:18:42 +08:00
Dockerfile Improved Docker container. 2018-08-05 22:13:12 +08:00
LICENSE initial commit 2016-07-25 16:38:42 +12:00
Makefile add test output 2019-03-03 14:49:39 +11:00
MANIFEST.in new docs 2017-08-20 13:25:05 +10:00
pyproject.toml defaults before notnulls 2020-08-01 16:33:27 +10:00
README.md more README 2019-03-03 14:29:43 +11: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 >= 10 only. Known issues exist with earlier versions. Development resources are limited, and feature support rather than backwards compatibility is prioritised.

THE DOCS

Documentation is at djrobstep.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