diff options
| author | Eugene Triguba <hello@eugenetriguba.com> | 2026-11-13 22:13:14 -0800 |
|---|---|---|
| committer | Eugene Triguba <hello@eugenetriguba.com> | 2026-11-13 22:13:14 -0800 |
| commit | 9656e14fc758053f34f5cb0e906093e2a18f6162 (patch) | |
| tree | 3d7799305de92be6a09bcd12c29fe0843b7b8cab /man | |
| parent | Remove migration dependencies (diff) | |
| download | cli-9656e14fc758053f34f5cb0e906093e2a18f6162.zip | |
Remove timestamp version style in favor of always using sequential
Diffstat (limited to 'man')
| -rw-r--r-- | man/bolt-down.1 | 2 | ||||
| -rw-r--r-- | man/bolt-migration.5 | 14 | ||||
| -rw-r--r-- | man/bolt-new.1 | 6 | ||||
| -rw-r--r-- | man/bolt-status.1 | 7 | ||||
| -rw-r--r-- | man/bolt-tutorial.7 | 32 | ||||
| -rw-r--r-- | man/bolt-up.1 | 2 | ||||
| -rw-r--r-- | man/bolt.1 | 2 | ||||
| -rw-r--r-- | man/bolt.toml.5 | 15 |
8 files changed, 33 insertions, 47 deletions
diff --git a/man/bolt-down.1 b/man/bolt-down.1 index 18be02c..e99eeb1 100644 --- a/man/bolt-down.1 +++ b/man/bolt-down.1 @@ -34,7 +34,7 @@ Revert all applied migrations: .Dl $ bolt down .Pp Revert migrations down to a specific version: -.Dl $ bolt down -v 20240316145038 +.Dl $ bolt down -v 002 .Sh SEE ALSO .Xr bolt 1 , .Xr bolt-status 1 , diff --git a/man/bolt-migration.5 b/man/bolt-migration.5 index 92728e8..92d1f37 100644 --- a/man/bolt-migration.5 +++ b/man/bolt-migration.5 @@ -15,13 +15,13 @@ Migration files are named using the pattern: .Pp Where .Ar version -is either a timestamp (e.g., -.Li 20240316145038 ) -or sequential number (e.g., -.Li 001 ) -depending on the configured version style. See -.Xr bolt.toml 5 -for configuration details. +is a sequential number (e.g., +.Li 001 ) . +.Xr bolt-new 1 +picks the next number automatically. +.Pp +Each version must be unique. If two migrations exist with the +same version, Bolt refuses to run until one of them is renumbered. .Sh DIRECTIVES Migration files use comment directives to separate sections. All directives are case-insensitive. diff --git a/man/bolt-new.1 b/man/bolt-new.1 index 4e83be0..d44367a 100644 --- a/man/bolt-new.1 +++ b/man/bolt-new.1 @@ -12,9 +12,9 @@ .Nm creates a new database migration file in the migrations directory. .Pp -The migration file is named using the configured version style (timestamp -or sequential) followed by the message. For example: -.Pa 20240316145038_create_users_table.sql . +The migration file is named with the next sequential version followed by +the message. For example: +.Pa 001_create_users_table.sql . .Sh OPTIONS .Bl -tag -width Ds .It Fl m Ar message , Fl -message Ar message diff --git a/man/bolt-status.1 b/man/bolt-status.1 index e07c404..c1677c2 100644 --- a/man/bolt-status.1 +++ b/man/bolt-status.1 @@ -11,7 +11,6 @@ displays all discovered migrations and indicates which ones have been applied to the database. .Pp -Migrations are shown in the order they would be executed, by version. The output includes: .Bl -bullet -offset Ds -compact .It @@ -29,9 +28,9 @@ exits 0 on success, and >0 if an error occurs. .Sh EXAMPLES .Bd -literal -offset indent $ bolt status -Version Message Applied -20240316145038 create_users_table X -20240317120000 add_email_index +Version Message Applied +001 create_users_table X +002 add_email_index .Ed .Sh SEE ALSO .Xr bolt 1 , diff --git a/man/bolt-tutorial.7 b/man/bolt-tutorial.7 index 0a137a0..ae2446e 100644 --- a/man/bolt-tutorial.7 +++ b/man/bolt-tutorial.7 @@ -16,6 +16,19 @@ Bolt installed .It A database available (PostgreSQL, MySQL, SQL Server, or SQLite) .El +.Sh CONFIGURING BOLT +Create a +.Pa bolt.toml +file: +.Bd -literal -offset indent +[database] +dsn = "bolt.db" +driver = "sqlite3" +.Ed +.Pp +See +.Xr bolt.toml 5 +for all configuration options. .Sh CREATING YOUR FIRST MIGRATION Create a migration with: .Dl $ bolt new -m \(dqcreate users table\(dq @@ -23,7 +36,7 @@ Create a migration with: This creates a .Pa migrations/ directory with a file like: -.Dl 20240316145038_create_users_table.sql +.Dl 001_create_users_table.sql .Sh WRITING MIGRATION SCRIPTS Edit the migration file to add SQL statements: .Bd -literal -offset indent @@ -45,25 +58,12 @@ section runs when applying the migration. The .Cm -- migrate:down section runs when reverting it. -.Sh CONFIGURING BOLT -Create a -.Pa bolt.toml -file: -.Bd -literal -offset indent -[database] -dsn = "postgresql://user:password@localhost:5432/mydb?sslmode=disable" -driver = "postgresql" -.Ed -.Pp -See -.Xr bolt.toml 5 -for all configuration options. .Sh APPLYING MIGRATIONS Apply all pending migrations: .Dl $ bolt up .Pp Apply up to a specific version: -.Dl $ bolt up -v 20240316145038 +.Dl $ bolt up -v 001 .Sh CHECKING STATUS View migration status: .Dl $ bolt status @@ -74,7 +74,7 @@ Revert the most recent migration: .Dl $ bolt down .Pp Revert to a specific version: -.Dl $ bolt down -v 20240316145038 +.Dl $ bolt down -v 001 .Sh SEE ALSO .Xr bolt 1 , .Xr bolt.toml 5 , diff --git a/man/bolt-up.1 b/man/bolt-up.1 index 19b41e9..df149b9 100644 --- a/man/bolt-up.1 +++ b/man/bolt-up.1 @@ -35,7 +35,7 @@ Apply all pending migrations: .Dl $ bolt up .Pp Apply migrations up to a specific version: -.Dl $ bolt up -v 20240316145038 +.Dl $ bolt up -v 002 .Sh SEE ALSO .Xr bolt 1 , .Xr bolt-down 1 , @@ -16,7 +16,7 @@ is a command-line tool for database migrations. .It Schema migrations are written in plain SQL. .It -Migrations can be versioned sequentially or by creation timestamp. +Migrations are versioned sequentially. .It All migrations run in transactions by default. .It diff --git a/man/bolt.toml.5 b/man/bolt.toml.5 index 15858ff..ef80875 100644 --- a/man/bolt.toml.5 +++ b/man/bolt.toml.5 @@ -31,17 +31,6 @@ absolute path. .Pp Environment variable: .Ev BOLT_MIGRATIONS_DIR_PATH -.It Cm version_style -The migration versioning style. -.Qq timestamp -(default) uses timestamps like -.Li 20240316145038 . -.Qq sequential -uses incrementing integers like -.Li 001 , 002 , 003 . -.Pp -Environment variable: -.Ev BOLT_MIGRATIONS_VERSION_STYLE .El .Sh DATABASE SECTION .Bl -tag -width Ds @@ -74,10 +63,9 @@ All configuration options can be set via environment variables. When both a configuration file setting and environment variable are present, the environment variable takes precedence. .Pp -.Bl -column "BOLT_MIGRATIONS_VERSION_STYLE" "migrations.version_style" -offset indent +.Bl -column "BOLT_MIGRATIONS_DIR_PATH" "migrations.directory_path" -offset indent .It Sy Environment Variable Ta Sy Configuration Key .It Ev BOLT_MIGRATIONS_DIR_PATH Ta Cm migrations.directory_path -.It Ev BOLT_MIGRATIONS_VERSION_STYLE Ta Cm migrations.version_style .It Ev BOLT_DB_DSN Ta Cm database.dsn .It Ev BOLT_DB_DRIVER Ta Cm database.driver .It Ev BOLT_DB_MIGRATIONS_TABLE Ta Cm database.migrations_table @@ -87,7 +75,6 @@ A complete configuration file: .Bd -literal -offset indent [migrations] directory_path = "migrations" -version_style = "timestamp" [database] dsn = "postgresql://user:password@localhost:5432/mydb?sslmode=disable" |