diff --git a/.changeset/odd-foxes-mix.md b/.changeset/odd-foxes-mix.md
new file mode 100644
index 0000000..feb3220
--- /dev/null
+++ b/.changeset/odd-foxes-mix.md
@@ -0,0 +1,5 @@
+---
+'@emigrate/cli': minor
+---
+
+Add support for passing the relative path to a migration file to remove from the history using the "remove" command
diff --git a/docs/src/content/docs/commands/remove.mdx b/docs/src/content/docs/commands/remove.mdx
index 421b7de..fde9919 100644
--- a/docs/src/content/docs/commands/remove.mdx
+++ b/docs/src/content/docs/commands/remove.mdx
@@ -13,22 +13,22 @@ The `remove` command is used to remove a migration from the history. This is use
```bash
- npx emigrate remove [options]
+ npx emigrate remove [options]
```
```bash
- pnpm emigrate remove [options]
+ pnpm emigrate remove [options]
```
```bash
- yarn emigrate remove [options]
+ yarn emigrate remove [options]
```
```bash
- bunx --bun emigrate remove [options]
+ bunx --bun emigrate remove [options]
```
@@ -44,16 +44,18 @@ The `remove` command is used to remove a migration from the history. This is use
```
```bash
- deno task emigrate remove [options]
+ deno task emigrate remove [options]
```
## Arguments
-### ``
+### ``
-The name of the migration file to remove, including the extension, e.g. `20200101000000_some_migration.js`.
+The name of the migration file to remove, including the extension, e.g. `20200101000000_some_migration.js`, or a relative file path to a migration file to remove, e.g: `migrations/20200101000000_some_migration.js`.
+
+Using relative file paths is useful in terminals that support autocomplete, and also when you copy and use the relative migration file path from the output of the `list` command.
## Options
diff --git a/packages/cli/README.md b/packages/cli/README.md
index 0769765..e1cf709 100644
--- a/packages/cli/README.md
+++ b/packages/cli/README.md
@@ -20,6 +20,24 @@ bun add @emigrate/cli
## Usage
+```text
+Usage: emigrate /
+
+Options:
+
+ -h, --help Show this help message and exit
+ -v, --version Print version number and exit
+
+Commands:
+
+ up Run all pending migrations (or do a dry run)
+ new Create a new migration file
+ list List all migrations and their status
+ remove Remove entries from the migration history
+```
+
+### `emigrate up`
+
```text
Usage: emigrate up [options]
diff --git a/packages/cli/src/cli.ts b/packages/cli/src/cli.ts
index bd74870..c4c031e 100644
--- a/packages/cli/src/cli.ts
+++ b/packages/cli/src/cli.ts
@@ -440,14 +440,14 @@ const remove: Action = async (args) => {
allowPositionals: true,
});
- const usage = `Usage: emigrate remove [options]
+ const usage = `Usage: emigrate remove [options]
Remove entries from the migration history.
This is useful if you want to retry a migration that has failed.
Arguments:
- name The name of the migration file to remove from the history (required)
+ name/path The name of or relative path to the migration file to remove from the history (required)
Options:
@@ -466,6 +466,7 @@ Examples:
emigrate remove -d migrations -s fs 20231122120529381_some_migration_file.js
emigrate remove --directory ./migrations --storage postgres 20231122120529381_some_migration_file.sql
emigrate remove -i dotenv/config -d ./migrations -s postgres 20231122120529381_some_migration_file.sql
+ emigrate remove -i dotenv/config -d ./migrations -s postgres migrations/20231122120529381_some_migration_file.sql
`;
if (values.help) {