docs(cli): document the relative file path support for the "remove" command
This commit is contained in:
parent
2f6b4d23e0
commit
0faebbe647
4 changed files with 35 additions and 9 deletions
5
.changeset/odd-foxes-mix.md
Normal file
5
.changeset/odd-foxes-mix.md
Normal file
|
|
@ -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
|
||||||
|
|
@ -13,22 +13,22 @@ The `remove` command is used to remove a migration from the history. This is use
|
||||||
<Tabs>
|
<Tabs>
|
||||||
<TabItem label="npm">
|
<TabItem label="npm">
|
||||||
```bash
|
```bash
|
||||||
npx emigrate remove [options] <name>
|
npx emigrate remove [options] <name/path>
|
||||||
```
|
```
|
||||||
</TabItem>
|
</TabItem>
|
||||||
<TabItem label="pnpm">
|
<TabItem label="pnpm">
|
||||||
```bash
|
```bash
|
||||||
pnpm emigrate remove [options] <name>
|
pnpm emigrate remove [options] <name/path>
|
||||||
```
|
```
|
||||||
</TabItem>
|
</TabItem>
|
||||||
<TabItem label="yarn">
|
<TabItem label="yarn">
|
||||||
```bash
|
```bash
|
||||||
yarn emigrate remove [options] <name>
|
yarn emigrate remove [options] <name/path>
|
||||||
```
|
```
|
||||||
</TabItem>
|
</TabItem>
|
||||||
<TabItem label="bun">
|
<TabItem label="bun">
|
||||||
```bash
|
```bash
|
||||||
bunx --bun emigrate remove [options] <name>
|
bunx --bun emigrate remove [options] <name/path>
|
||||||
```
|
```
|
||||||
</TabItem>
|
</TabItem>
|
||||||
<TabItem label="deno">
|
<TabItem label="deno">
|
||||||
|
|
@ -44,16 +44,18 @@ The `remove` command is used to remove a migration from the history. This is use
|
||||||
```
|
```
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
deno task emigrate remove [options] <name>
|
deno task emigrate remove [options] <name/path>
|
||||||
```
|
```
|
||||||
</TabItem>
|
</TabItem>
|
||||||
</Tabs>
|
</Tabs>
|
||||||
|
|
||||||
## Arguments
|
## Arguments
|
||||||
|
|
||||||
### `<name>`
|
### `<name/path>`
|
||||||
|
|
||||||
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 <Link href="/commands/list/">`list`</Link> command.
|
||||||
|
|
||||||
## Options
|
## Options
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,24 @@ bun add @emigrate/cli
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
|
```text
|
||||||
|
Usage: emigrate <options>/<command>
|
||||||
|
|
||||||
|
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
|
```text
|
||||||
Usage: emigrate up [options]
|
Usage: emigrate up [options]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -440,14 +440,14 @@ const remove: Action = async (args) => {
|
||||||
allowPositionals: true,
|
allowPositionals: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
const usage = `Usage: emigrate remove [options] <name>
|
const usage = `Usage: emigrate remove [options] <name/path>
|
||||||
|
|
||||||
Remove entries from the migration history.
|
Remove entries from the migration history.
|
||||||
This is useful if you want to retry a migration that has failed.
|
This is useful if you want to retry a migration that has failed.
|
||||||
|
|
||||||
Arguments:
|
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:
|
Options:
|
||||||
|
|
||||||
|
|
@ -466,6 +466,7 @@ Examples:
|
||||||
emigrate remove -d migrations -s fs 20231122120529381_some_migration_file.js
|
emigrate remove -d migrations -s fs 20231122120529381_some_migration_file.js
|
||||||
emigrate remove --directory ./migrations --storage postgres 20231122120529381_some_migration_file.sql
|
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 20231122120529381_some_migration_file.sql
|
||||||
|
emigrate remove -i dotenv/config -d ./migrations -s postgres migrations/20231122120529381_some_migration_file.sql
|
||||||
`;
|
`;
|
||||||
|
|
||||||
if (values.help) {
|
if (values.help) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue