PG Migrate
About
Database migration tool for PostgreSQL written in Rust
Features
- Create migration
- Upgrade / Downgrade database
- Get current migration
- Get head migration
- Get migrations history
Installation
Set up the database URL and migrations directory in the environment variables DATABASE_URL and MIGRATION_DIR.
DATABASE_URL=postgresql://username:password@localhost/dbname
CLI Usage
- Create migration:
-
Upgrade / Downgrade: There is multiple options to upgrade or downgrade the database:
- Upgrade to the latest migration:
- Upgrade / Downgrade to a specific migration by migration id:
- Upgrade / Downgrade by number of migrations:
- Upgrade to the latest migration:
-
Get head:
- Get current migration:
- Get migrations history