SQL migrations for projects using PostgreSQL
Project description
pgmigrations
SQL migrations for projects using PostgreSQL
Example Usage
Initialise the migrations
pgmigrations init <dsn>
This will create a directory called migrations
and will create a table called pgmigrations
in the database
to store the migration history.
Create a migration
pgmigrations create <dsn> <tag>
This will create a skeleton migration in the migrations directory
. The migration will consist of a directory with
the name <timestamp>_tag
, for example 20200701_1030_first_migration
, which contains two files;
apply.sql
and rollback.sql
.
As the names suggests, apply.sql
will be executed when the migration is applied and rollback.sql
will be
executed if the migraiton is rollbacked.
Apply migrations
pgmigrations apply <dsn>
This will apply any unapplied migrations. Each migration is applied in an atomic transaction.
Rollback a migration
pgmigrations rollback <dsn> <name>
This will rollback an already applied migration.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pgmigrations-0.0.1.0.tar.gz
.
File metadata
- Download URL: pgmigrations-0.0.1.0.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.1.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.6.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f80daab3f134fcca3947e62a9d77d0582faebf841f5b2138c59a69e92c5668a8 |
|
MD5 | 912abdf91cec2ea04d0b73a40c424bff |
|
BLAKE2b-256 | f5ec0476d7bb917ac9ab1fb9cac59fd85849d4471bb77f97bde8266e036149b2 |
File details
Details for the file pgmigrations-0.0.1.0-py3-none-any.whl
.
File metadata
- Download URL: pgmigrations-0.0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.1.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.6.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 44f404f09636717eac0873a581daf32bd20f20b7e857917a4e6c66870eed0574 |
|
MD5 | c802b65e920d9240f532f2fd2a3f93b3 |
|
BLAKE2b-256 | bde448993da4f36d43e7894c0ca10b6d3f2467167c5c63c1d08d97debf2151dc |