Crates.io | migr |
lib.rs | migr |
version | 0.1.1 |
source | src |
created_at | 2023-09-30 19:49:49.111133 |
updated_at | 2023-10-07 12:43:40.174135 |
description | A minimal migration tool for postgres. |
homepage | https://github.com/biblius/pg_migrator |
repository | |
max_upload_size | |
id | 988827 |
size | 51,222 |
A minimal CLI tool to manipulate PostgreSQL migrations.
cargo install migr
Run migr
to see a list of available commands.
The tool requires the DATABASE_URL
variable to be set in the process env.
To get started with a fresh migrationss directory run
migr setup
For generating migrations, it is advised you use
migr gen <NAME>
This will maintain correct ordering of migrations via timestamps. If you ever choose to edit or create a migration manually and the ordering matters, ensure you change the timestamp accordingly.
migr sync [-t]
-t
will remove migrations from the metadata table that don't exist in the directory.
migr run/rev/redo [-c] [-a] [-e <NAME>]
-c
is a count of how many migrations the action will be performed on.
-a
will perform the action on all migrations.
-e
performs the action on the exact migration. The name should be the exact migration name without the timestamp, e.g. XXXX-XX-XX-XXXXXX\_
create_table_foo
.