Skip to content

refactor: second pass at adding pg commands from pg-extras plugin to cli PR 2 of 3#3779

Merged
jdodson merged 2 commits into
feature/migrate_pg_extras_to_clifrom
jbd_migrate_commands2
Jun 18, 2026
Merged

refactor: second pass at adding pg commands from pg-extras plugin to cli PR 2 of 3#3779
jdodson merged 2 commits into
feature/migrate_pg_extras_to_clifrom
jbd_migrate_commands2

Conversation

@jdodson

@jdodson jdodson commented Jun 17, 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 2 of 3 to accomplish this task and we will be merging these PRs in feature/migrate_pg_extras_to_cli

Commands migrated:

  • pg:long-running-queries
  • pg:mandelbrot
  • pg:records-rank
  • pg:seq-scans
  • pg:stats-reset
  • pg:table-indexes-size

Extra things done:

  • Add new postgres words to cspell dictionary
  • Added some new tests to flex missing code paths

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:long-running-queries --help) <(heroku pg:long-running-queries --help)
diff <(./bin/run pg:mandelbrot --help) <(heroku pg:mandelbrot --help)
diff <(./bin/run pg:records-rank --help) <(heroku pg:records-rank --help)
diff <(./bin/run pg:seq-scans --help) <(heroku pg:seq-scans --help)
diff <(./bin/run pg:stats-reset --help) <(heroku pg:stats-reset --help)
diff <(./bin/run pg:table-indexes-size --help) <(heroku pg:table-indexes-size --help)

New Command Testing Steps:

  1. Show all queries running longer than five minutes (pid | duration | query, ordered by duration descending; an idle or short-running database returns no rows)

./bin/run pg:long-running-queries -a $APP

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

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

  1. Render the Mandelbrot set as ASCII art (a block of .,-+%@# characters forming the fractal; note this command has no underscore alias)

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

  1. Show all tables ranked by estimated row count (name | estimated_count, ordered by number of rows descending)

./bin/run pg:records-rank -a $APP

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

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

  1. Show the count of sequential scans per table (name | count, ordered by sequential scans descending)

./bin/run pg:seq-scans -a $APP

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

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

  1. Show the total index size per table (table | index_size for each table, descending by size, e.g. 128 kB)

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

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

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

  1. Reset the database statistics by calling pg_stat_reset() (prints the API-returned message, e.g. Reset stats; confirm pg_stat_user_tables counters return to zero afterward) WARNING THIS RESETS DB STATS

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

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

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

Screenshots (if applicable)

Related Issues

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

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

@k80bowman k80bowman 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.

Looks good!

@jdodson jdodson merged commit 24edb7f into feature/migrate_pg_extras_to_cli Jun 18, 2026
22 checks passed
@jdodson jdodson deleted the jbd_migrate_commands2 branch June 18, 2026 16:39
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