Skip to content

Commit 927a6d7

Browse files
committed
fix: update CLI documentation structure and improve formatting for clarity
1 parent 3f986cf commit 927a6d7

1 file changed

Lines changed: 13 additions & 5 deletions

File tree

docs/cli.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,27 @@
1-
Altus4 CLI
2-
===========
1+
---
2+
title: "Altus4 CLI"
3+
description: "Commands and usage for the Altus4 migrations CLI"
4+
sidebarPosition: 2
5+
---
6+
7+
## Overview
38

4-
Overview
59
- Provides a Laravel-like CLI for migrations without requiring the `mysql` binary.
610
- Uses Node.js `mysql2` to connect directly to your database.
711

812
Install/Build
13+
914
- Ensure deps installed: `npm ci`
1015
- Build: `npm run build`
1116

1217
Run
18+
1319
- From the repo root:
1420
- `./bin/altus migrate`
1521
- or via npm: `npm run cli -- migrate`
1622

1723
Commands
24+
1825
- `migrate` Run outstanding migrations
1926
- `migrate:install` Create the migrations table if missing
2027
- `migrate:status` Show applied and pending migrations
@@ -26,6 +33,7 @@ Commands
2633
- `migrate:down` Rollback last migration or a specific file (requires `--file`)
2734

2835
Options
36+
2937
- `--path <dir>` Directory containing migrations (default: `migrations`)
3038
- `--database <name>` Override `DB_DATABASE`
3139
- `--step [n]` For `migrate`: put each file in its own batch; for `rollback`: number of steps
@@ -37,10 +45,12 @@ Options
3745
- `--drop-views` For `fresh`: also drop database views
3846

3947
Environment
48+
4049
- Reads `.env` automatically from the repo root.
4150
- Uses the same env vars as the app: `DB_HOST`, `DB_PORT`, `DB_USERNAME`, `DB_PASSWORD`, `DB_DATABASE`, `DB_SOCKET` (optional), `APP_ENV`/`NODE_ENV`.
4251

4352
Examples
53+
4454
- Run migrations: `./bin/altus migrate`
4555
- Show status: `./bin/altus migrate:status`
4656
- Roll back last batch: `./bin/altus migrate:rollback`
@@ -58,7 +68,6 @@ Developer & testing
5868
- The CLI module (`src/cli/index.ts`) exports its command helpers so tests can call commands like `cmdUpOne` and `cmdDownOneOrRollback` directly. The module guards its `main()` call with `if (require.main === module)` to avoid starting when imported in tests.
5969
- The repository's integration tests already mock `mysql2/promise` and include a test that exercises the CLI helpers; run them with `npm run test:integration`.
6070

61-
6271
Seed files and directory layout
6372

6473
Place seed SQL files under the `migrations/seeds/` directory. Seed files are executed after migrations when `--seed` is provided and are run in natural sort order (so prefix filenames with numbers to control ordering).
@@ -98,4 +107,3 @@ Notes:
98107

99108
- Seeds are meant for bootstrapping local/dev instances. Avoid running production-sensitive seeds in production environments.
100109
- If `--pretend` is used, seeds will be printed but not executed.
101-

0 commit comments

Comments
 (0)