SQL migrations for projects using PostgreSQL
Project description
pgmigrations
SQL migrations for projects using PostgreSQL
Example Usage
Initialise the migrations
pgmigrations init
This will create a directory called migrations in the current working directory
Create a migration
pgmigrations create <tag>
This will create a skeleton migration in the migrations directory. The migration will consist of a directory with
the name <timestamp>_migrations_<tag>, for example 20200701_1030_migrations_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=<dsn> [--path <colon separated list of migration locations>]
or
export PGMIGRATIONS_DSN=<dsn>
export PGMIGRATIONS_PATH=<colon separated list of migration locations>
pgmigrations apply
This will apply any unapplied migrations. Each migration is applied in an atomic transaction.
Rollback a migration
pgmigrations rollback --dsn=<dsn> [--path <colon separated list of migration locations>]
or
export PGMIGRATIONS_DSN=<dsn>
export PGMIGRATIONS_PATH=<colon separated list of migration locations>
pgmigrations rollback <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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pgmigrations-0.0.13.tar.gz.
File metadata
- Download URL: pgmigrations-0.0.13.tar.gz
- Upload date:
- Size: 4.5 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.2.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.6.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
69f2798ef1dbde946fd4e74e58417ea5966dd711bbed74485a460b81957cb1a6
|
|
| MD5 |
d373e8238021e105df1efc62f1e37cf2
|
|
| BLAKE2b-256 |
9c4ca643596ce6b3947dbd98c2d5a6fae59c0f6b4ac636296db00d0b4e379313
|
File details
Details for the file pgmigrations-0.0.13-py3-none-any.whl.
File metadata
- Download URL: pgmigrations-0.0.13-py3-none-any.whl
- Upload date:
- Size: 7.3 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.2.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.6.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
17bc2cc475757dd42f8ea464d7da88c6dc3ba802cb804a7b1c67b31c8a990e4e
|
|
| MD5 |
053167298795e9e3feecc5902494944a
|
|
| BLAKE2b-256 |
e39e15e8b6ae3afff3ecfdcfb95076abaef71ffad178de907113781c5df413d4
|