CLI Commands¶
Edgy ships with a full CLI for migrations, shell usage, inspection, and admin serving.
This page is a practical map of the commands, when to use them, and typical call patterns.
Before Running Commands¶
Edgy needs an application context (edgy.monkay.instance) for most commands.
You can provide it by:
--app path.to.moduleEDGY_DEFAULT_APP=path.to.module- preloads in settings (for automatic discovery)
See Discovery for details.
If you need centralized command behavior (preloads, migration directory, shell settings), check Settings.
Command Families At a Glance¶
| Goal | Typical Commands |
|---|---|
| Setup migration repository | list-templates, init |
| Generate revision files | revision, makemigrations, merge, edit |
| Apply or revert revisions | migrate, downgrade, stamp |
| Inspect migration state | current, heads, branches, history, show, check |
| Runtime utilities | shell, inspectdb, admin_serve |
Migration Bootstrap¶
edgy list-templates¶
What: Show available migration repository templates.
When: Before edgy init, when choosing a template.
edgy init¶
What: Create migration repository files (alembic.ini, env scripts, versions folder).
When: First-time migration setup.
Migration Generation¶
edgy revision¶
What: Create a new revision script.
When: Manual revision creation or fine-grained control.
edgy makemigrations¶
What: Alias for edgy revision --autogenerate.
When: Standard model-to-migration workflow.
edgy merge¶
What: Merge multiple heads into one revision.
When: Branching migration histories create multiple heads.
edgy edit¶
What: Open/edit a revision file from the CLI.
When: Quick script edits without manual path lookup.
Migration Execution¶
edgy migrate¶
What: Upgrade database to a target revision (defaults to head).
When: Apply migrations.
edgy downgrade¶
What: Roll back to an earlier revision.
When: Revert schema changes.
edgy stamp¶
What: Mark revision table without running migration operations.
When: Align revision metadata with an already-synced database.
Migration Introspection¶
edgy current¶
What: Show current revision state.
edgy heads¶
What: Show current head revisions.
edgy branches¶
What: Show migration branch points.
edgy history¶
What: Show migration history.
edgy show¶
What: Show one revision script summary/details.
edgy check¶
What: Check for model changes that would generate operations.
Runtime and Utilities¶
edgy shell¶
What: Start interactive shell with imported models and defaults.
edgy inspectdb¶
What: Reflect an existing database and emit ReflectModel definitions.
edgy admin_serve¶
What: Run the Edgy admin development server.
Recommended Flow¶
edgy init(once)edgy makemigrationsedgy migrate- repeat 2-3 as models evolve
graph LR
A["Model changes"] --> B["edgy makemigrations"]
B --> C["Review revision file"]
C --> D["edgy migrate"]
D --> E["Verify with edgy current/check"]