Skip to content

Commit 63f830b

Browse files
vjeevagithub-actions[bot]
authored andcommitted
docs: update usage docs
1 parent 187f524 commit 63f830b

1 file changed

Lines changed: 54 additions & 9 deletions

File tree

docs/usage.md

Lines changed: 54 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ $ belt [OPTIONS] COMMAND [ARGS]...
2121
* `dst-dsn`: Print a dsn to stdout that you can use to...
2222
* `check-pkeys`: Print out lists of tables with and without...
2323
* `check-connectivity`: Returns exit code 0 if pgbelt can connect...
24-
* `revoke-logins`: Discovers all users in the db who can log...
25-
* `restore-logins`: Grant permission to log in for any user...
24+
* `revoke-logins`: Discovers all users who can log in and...
25+
* `restore-logins`: Discovers all roles that currently have...
2626
* `precheck`: Report whether your source database meets...
2727
* `reset`: Reset an in-progress migration before...
2828
* `dump-schema`: Dumps and sanitizes the schema from the...
@@ -40,6 +40,7 @@ $ belt [OPTIONS] COMMAND [ARGS]...
4040
* `analyze`: Run ANALYZE in the destination database.
4141
* `validate-data`: Compares data in the source and target...
4242
* `sync`: Sync and validate all data that is not...
43+
* `diff-sequences`: Compare source and destination sequence...
4344
* `teardown-back-replication`: Stops pglogical replication from the...
4445
* `teardown-forward-replication`: Stops pglogical replication from the...
4546
* `teardown`: Removes all pglogical configuration from...
@@ -188,10 +189,8 @@ $ belt check-connectivity [OPTIONS] DC [DB]
188189

189190
## `belt revoke-logins`
190191

191-
Discovers all users in the db who can log in, saves them in the config file,
192-
then revokes their permission to log in. Use this command to ensure that all
193-
writes to the source database have been stopped before syncing sequence values
194-
and tables without primary keys.
192+
Discovers all users who can log in and revokes their permission.
193+
Stateless — queries pg_roles each time rather than caching a user list.
195194

196195
Always excludes built-in service accounts (pglogical, rdsadmin, monitoring, etc.).
197196
Use --exclude-user to exclude additional specific usernames.
@@ -225,10 +224,11 @@ $ belt revoke-logins [OPTIONS] DC [DB]
225224

226225
## `belt restore-logins`
227226

228-
Grant permission to log in for any user present in the config file. The user
229-
must already have a password. This will not generate or modify existing
230-
passwords for users.
227+
Discovers all roles that currently have NOLOGIN and re-enables login for
228+
them, excluding built-in service accounts and any roles specified via
229+
--exclude-user / --exclude-pattern.
231230

231+
This is stateless — it does not rely on a previously saved user list.
232232
Intended to be used after revoke-logins in case a rollback is required.
233233

234234

@@ -250,6 +250,8 @@ $ belt restore-logins [OPTIONS] DC [DB]
250250
**Options**:
251251

252252
* `--json`: Output structured JSON instead of human-readable tables.
253+
* `-e, --exclude-user TEXT`: Additional usernames to exclude from restoration (can be repeated).
254+
* `-p, --exclude-pattern TEXT`: SQL LIKE patterns to exclude usernames (e.g. '%%myapp%%'). Can be repeated.
253255
* `--help`: Show this message and exit.
254256

255257
## `belt precheck`
@@ -299,6 +301,12 @@ This command:
299301
Note: sequence values are intentionally left unchanged. They only need to be
300302
synchronized after cutover by running sync-sequences.
301303

304+
WARNING: --force skips the safety check that prevents resetting when the
305+
destination is the same size or larger than the source. This is intended for
306+
post-migration resets where SRC and DST are identical. Using --force on a
307+
live migration where DST is genuinely the primary copy will result in
308+
irreversible data loss.
309+
302310

303311
Requires both src and dst to be not null in the config file.
304312

@@ -318,6 +326,7 @@ $ belt reset [OPTIONS] DC [DB]
318326
**Options**:
319327

320328
* `--json`: Output structured JSON instead of human-readable tables.
329+
* `--force`: Skip the dataset-size failsafe that normally prevents reset when DST >= SRC. Use ONLY after a completed migration when you are certain the destination database should be wiped and all its up-to-date data discarded.
321330
* `--help`: Show this message and exit.
322331

323332
## `belt dump-schema`
@@ -778,6 +787,42 @@ $ belt sync [OPTIONS] DC [DB]
778787
* `--no-schema / --no-no-schema`: [default: no-no-schema]
779788
* `--help`: Show this message and exit.
780789

790+
## `belt diff-sequences`
791+
792+
Compare source and destination sequence last_value for each targeted sequence.
793+
794+
Uses the **root** database user on both source and destination (same as
795+
``diff-schemas``), not the pglogical user.
796+
797+
Destination values are highlighted green when they are greater than or equal to
798+
source, and red otherwise.
799+
800+
Requires both src and dst to be not null in the config file.
801+
802+
If the db name is not given, runs for every database in the datacenter (same
803+
pattern as ``diff-schemas``).
804+
805+
806+
Requires both src and dst to be not null in the config file.
807+
808+
If the db name is not given run on all dbs in the dc.
809+
810+
**Usage**:
811+
812+
```console
813+
$ belt diff-sequences [OPTIONS] DC [DB]
814+
```
815+
816+
**Arguments**:
817+
818+
* `DC`: [required]
819+
* `[DB]`
820+
821+
**Options**:
822+
823+
* `--json`: Output structured JSON instead of human-readable tables.
824+
* `--help`: Show this message and exit.
825+
781826
## `belt teardown-back-replication`
782827

783828
Stops pglogical replication from the destination database to the source.

0 commit comments

Comments
 (0)