Skip to content

refactor!: final pass at adding pg commands from pg-extras plugin to cli PR 3 of 3#3780

Merged
jdodson merged 1 commit into
feature/migrate_pg_extras_to_clifrom
jbd_migrate_commands3
Jun 18, 2026
Merged

refactor!: final pass at adding pg commands from pg-extras plugin to cli PR 3 of 3#3780
jdodson merged 1 commit into
feature/migrate_pg_extras_to_clifrom
jbd_migrate_commands3

Conversation

@jdodson

@jdodson jdodson commented Jun 18, 2026

Copy link
Copy Markdown

Summary

We need to move the commands from the pg-extras plugin to the core CLI, which will require us to update the commands to use oclif/core v4 and heroku-cli-command v12.

This is PR 3 of 3 and final to accomplish this task and we will be merging these PRs in feature/migrate_pg_extras_to_cli

Commands migrated:

  • pg:table-size
  • pg:total-index-size
  • pg:total-table-size
  • pg:unused-indexes
  • pg:user-connections
  • pg:vacuum-stats

Type of Change

Breaking Changes (major semver update)

  • Add a ! after your change type to denote a change that breaks current behavior

Feature Additions (minor semver update)

  • feat: Introduces a new feature to the codebase

Patch Updates (patch semver update)

  • fix: Bug fix
  • deps: Dependency upgrade
  • revert: Revert a previous commit
  • chore: Change that does not affect production code
  • refactor: Refactoring existing code without changing behavior
  • test: Add/update/remove tests

Testing

The --help changes (should be limited to --prompt and GLOBAL FLAGS additions that came with cli upgrades) ALSO examples as the cli requires:

diff <(./bin/run pg:table-size --help) <(heroku pg:table-size --help)
diff <(./bin/run pg:total-index-size --help) <(heroku pg:total-index-size --help)
diff <(./bin/run pg:total-table-size --help) <(heroku pg:total-table-size --help)
diff <(./bin/run pg:unused-indexes --help) <(heroku pg:unused-indexes --help)
diff <(./bin/run pg:user-connections --help) <(heroku pg:user-connections --help)
diff <(./bin/run pg:vacuum-stats --help) <(heroku pg:vacuum-stats --help)

New Command Testing Steps:

  1. Show the size of the tables excluding indexes (name | size for each table, descending by size, e.g. 50 MB)

./bin/run pg:table-size -a $APP

  1. Confirm the underscore alias (visible) produces identical output to step 1

./bin/run pg:table_size -a $APP

  1. Show the total size of all indexes in the database (single size row, e.g. 15 MB)

./bin/run pg:total-index-size -a $APP

  1. Confirm the hidden underscore alias produces identical output to step 3

./bin/run pg:total_index_size -a $APP

  1. Show the size of the tables including indexes (name | size for each table, descending by size, e.g. 75 MB; values should be >= the matching row from step 1)

./bin/run pg:total-table-size -a $APP

  1. Confirm the underscore alias (visible) produces identical output to step 5

./bin/run pg:total_table_size -a $APP

  1. Show unused and almost unused indexes (table | index | index_size | index_scans, ordered by size-to-scan ratio descending; excludes unique indexes and tables under ~40 kB; a small or well-used database may return no rows)

./bin/run pg:unused-indexes -a $APP

  1. Confirm the underscore alias (visible) produces identical output to step 7

./bin/run pg:unused_indexes -a $APP

  1. Show the number of active connections per credential (credential | connections, ordered by connections descending)

./bin/run pg:user-connections -a $APP

  1. Confirm the hidden underscore alias produces identical output to step 9

./bin/run pg:user_connections -a $APP

  1. Show dead rows and whether an automatic vacuum is expected (schema | table | last_vacuum | last_autovacuum | rowcount | dead_rowcount | autovacuum_threshold | expect_autovacuum; expect_autovacuum shows yes only when dead rows exceed the threshold. Note: this command has no underscore alias)

./bin/run pg:vacuum-stats -a $APP

Screenshots (if applicable)

Related Issues

GUS work item: https://gus.lightning.force.com/lightning/r/ADM_Work__c/a07EE00002YzlNjYAJ/view

@jdodson jdodson requested a review from a team as a code owner June 18, 2026 19:56
@jdodson jdodson temporarily deployed to AcceptanceTests June 18, 2026 19:56 — with GitHub Actions Inactive
@jdodson jdodson temporarily deployed to AcceptanceTests June 18, 2026 19:56 — with GitHub Actions Inactive
@jdodson jdodson temporarily deployed to AcceptanceTests June 18, 2026 19:56 — with GitHub Actions Inactive
@jdodson jdodson deployed to AcceptanceTests June 18, 2026 19:56 — with GitHub Actions Active
@jdodson jdodson changed the base branch from main to feature/migrate_pg_extras_to_cli June 18, 2026 21:05

@michaelmalave michaelmalave left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@jdodson jdodson merged commit 9b56e85 into feature/migrate_pg_extras_to_cli Jun 18, 2026
24 checks passed
@jdodson jdodson deleted the jbd_migrate_commands3 branch June 18, 2026 23:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants