From 913272fba0c6b429ef8ce9f04498ebc5d5b653be Mon Sep 17 00:00:00 2001 From: Eugene Triguba Date: Sat, 13 Jan 2024 19:18:42 -0500 Subject: Add command reference --- README.md | 51 +++++++++++++++++++++++++++++++++++++++++++++++ internal/commands/down.go | 2 +- internal/commands/new.go | 2 +- internal/commands/up.go | 2 +- 4 files changed, 54 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 401955a..fff1d31 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,11 @@ Bolt is a command-line tool designed to simplify and streamline your database mi - [Configuration](#configuration) - [Configuration File](#configuration-file) - [Environment Variables](#environment-variables) + - [Commands](#commands) + - [`bolt new`](#bolt-new) + - [`bolt up`](#bolt-up) + - [`bolt down`](#bolt-down) + - [`bolt status`](#bolt-status) - [Explanation](#explanation) - [How Are Migration Scripts Executed?](#how-are-migration-scripts-executed) - [How Does Bolt Know What Migrations Have Been Applied?](#how-does-bolt-know-what-migrations-have-been-applied) @@ -263,6 +268,52 @@ All configuration file settings have corresponding environment variables. - `BOLT_CONNECTION_DBNAME` - `BOLT_CONNECTION_DRIVER` +### Commands + +#### `bolt new` + +```bash +$ bolt help new +new [-message|-m]: + Create a new database migration + -m string + alias for -message (default "autogenerated") + -message string + Message to use for the migration (default "autogenerated") +``` + +#### `bolt up` + +```bash +$ bolt help up +up [-version|-v]: + Apply migrations against the database + -v string + alias for -version + -version string + The version to upgrade up and including to. +``` + +#### `bolt down` + +```bash +$ bolt help up +down [-version|-v]: + Downgrade migrations against the database. + -v string + alias for -version + -version string + The version to downgrade down and including to. +``` + +#### `bolt status` + +```bash +$ bolt help status +status: + List the database migrations and their statuses +``` + ## Explanation ### How Are Migration Scripts Executed? diff --git a/internal/commands/down.go b/internal/commands/down.go index e974cdf..2beae2e 100644 --- a/internal/commands/down.go +++ b/internal/commands/down.go @@ -25,7 +25,7 @@ func (*DownCmd) Synopsis() string { } func (*DownCmd) Usage() string { - return `down: + return `down [-version|-v]: Downgrade migrations against the database. ` } diff --git a/internal/commands/new.go b/internal/commands/new.go index 79c0ceb..864de4e 100644 --- a/internal/commands/new.go +++ b/internal/commands/new.go @@ -26,7 +26,7 @@ func (*NewCmd) Synopsis() string { } func (*NewCmd) Usage() string { - return `create [-message|-m]: + return `new [-message|-m]: Create a new database migration ` } diff --git a/internal/commands/up.go b/internal/commands/up.go index f27c054..57f9109 100644 --- a/internal/commands/up.go +++ b/internal/commands/up.go @@ -25,7 +25,7 @@ func (*UpCmd) Synopsis() string { } func (*UpCmd) Usage() string { - return `up: + return `up [-version|-v]: Apply migrations against the database ` } -- cgit v1.2.3