Like diff but for PostgreSQL schemas
Go to file
Robert Lechte 13f3099df1 refmt
2020-08-28 13:07:07 +10:00
.circleci try push tags 2020-08-28 13:03:35 +10:00
.github cleanup funding file 2020-05-08 20:06:48 +10:00
deploy refmt 2020-08-28 13:07:07 +10:00
docs doc tweaks 2020-08-20 19:28:20 +10:00
migra modify enums before creating tables 2020-07-28 21:31:41 +10:00
tests parameterize tests 2020-08-14 13:09:40 +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 vbump schemainspect 2020-08-20 19:13:42 +10:00
README.md change docs link 2020-08-20 19:01:11 +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 >= 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 databaseci.com/docs/migra. Note that the docs have moved to databaseci.com. If you're wondering what that's about, read the blog post here (https://databaseci.com/blog/hello-world).

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