A migration stitcher (therefore mitch) for PostgreSQL, SQLite, MariaDB, and others
fix(cli): clean up help texts
public
fix(cli): clean up help texts
- show "current directory" as the default of --project instead of
a bound method or (dynamic)
- drop the <class 'list'> default of create --dependency
- describe stash and status in `mitch --help`
- mention MITCH_DATABASE_URL/DATABASE_URL for up and add
- help for create's argument; ADR reference out of rework's summary
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
+ database_url: Annotated[str|None, typer.Option("--database", "-d", help="Database URL. Can also be set via MITCH_DATABASE_URL or DATABASE_URL environment variable.")] =None,
+ database_url: Annotated[str|None, typer.Option("--database", "-d", help="Database URL. Can also be set via MITCH_DATABASE_URL or DATABASE_URL environment variable.")] =None,
491
491
if_modified: Annotated[
492
492
IfModifiedOption |None,
493
493
typer.Option(
modified
src/mitch/cli/log.py
+2 −1
@@ -41,7 +41,8 @@
41
41
"--project",
42
42
"-p",
43
43
help="Project directory.",
44
- default_factory=lambda: Path.cwd(),
44
+ default_factory=Path.cwd,
45
+ show_default="current directory",
45
46
dir_okay=True,
46
47
file_okay=False,
47
48
exists=True,
modified
src/mitch/cli/revert.py
+2 −2
@@ -15,7 +15,7 @@
15
15
16
16
@app.command(name="down", help="Revert all applied migrations in the project.")
database_url: Annotated[str|None, typer.Option("--database", "-d", help="Database URL. Can also be set via MITCH_DATABASE_URL or DATABASE_URL environment variable.")] =None,
20
20
) ->None:
21
21
"""Revert all applied migrations in the project."""
database_url: Annotated[str|None, typer.Option("--database", "-d", help="Database URL. Can also be set via MITCH_DATABASE_URL or DATABASE_URL environment variable.")] =None,
53
53
) ->None:
54
54
"""Revert the specified migrations and their dependants in the project.
modified
src/mitch/cli/rework.py
+4 −1
@@ -29,17 +29,20 @@
29
29
"-p",
30
30
help="Project directory.",
31
31
default_factory=Path.cwd,
32
+ show_default="current directory",
32
33
dir_okay=True,
33
34
file_okay=False,
34
35
exists=True,
35
36
),
36
37
],
37
38
) ->None:
38
- """Create a new version of a migration (ADR cli/rework/rework-keeps-the-previous-version-in-every-history).
39
+ """Create a new version of a migration.
39
40
40
41
The current files are archived as `<name>@<n>.*` under their original ID. The files at the original
41
42
path become the new version: a new ID, a dependency on the archived version, ordering constraints on
42
43
its current dependants, and a down script that restores the archived version.
44
+
45
+ See ADR cli/rework/rework-keeps-the-previous-version-in-every-history.
43
46
"""
44
47
project = Project.from_path(root)
45
48
if":"in migration_id and (linked := project.try_resolve(migration_id)) isnotNoneandnot project.is_own(linked):
modified
src/mitch/cli/stash.py
+3 −1
@@ -59,7 +59,8 @@
59
59
"--project",
60
60
"-p",
61
61
help="Project directory.",
62
- default_factory=lambda: Path.cwd(),
62
+ default_factory=Path.cwd,
63
+ show_default="current directory",
63
64
dir_okay=True,
64
65
file_okay=False,
65
66
exists=True,
@@ -81,6 +82,7 @@
81
82
),
82
83
] =None,
83
84
) ->None:
85
+ """Revert migrations changed in the working copy, stash the changes, and re-apply the committed versions."""
84
86
project = Project.from_path(root)
85
87
vcs_manager = project.get_migration_manager(vcs)
86
88
modified
src/mitch/cli/status.py
+3 −1
@@ -108,7 +108,8 @@
108
108
"--project",
109
109
"-p",
110
110
help="Project directory.",
111
- default_factory=lambda: Path.cwd(),
111
+ default_factory=Path.cwd,
112
+ show_default="current directory",
112
113
dir_okay=True,
113
114
file_okay=False,
114
115
exists=True,
@@ -150,6 +151,7 @@
150
151
),
151
152
] =None,
152
153
) ->None:
154
+ """Show which migrations are available, modified or missing on the database."""