Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: exclude supabase managed schemas from inspect subcommand #2138

Merged
merged 14 commits into from
Apr 12, 2024

Conversation

encima
Copy link
Member

@encima encima commented Apr 10, 2024

What kind of change does this PR introduce?

Feature/Fix: moving queries for inspect to the root inspect module and removing Supabase schemas from queries

What is the current behavior?

Queries are within the command and show results from Supabase schemas that could cause concern or make the user take actions on schemas they do not own

What is the new behavior?

  • Queries moved into a single place (could be further developed to template similar queries)
  • Supabase schemas removed from relevant queries
  • Explanation of hit rates added to cache-hit command and a column explains whether action might be needed

Additional context

image

@encima encima requested a review from a team as a code owner April 10, 2024 07:50
@coveralls
Copy link

coveralls commented Apr 10, 2024

Pull Request Test Coverage Report for Build 8665741536

Details

  • 2 of 46 (4.35%) changed or added relevant lines in 20 files are covered.
  • 5 unchanged lines in 1 file lost coverage.
  • Overall coverage decreased (-0.07%) to 57.738%

Changes Missing Coverage Covered Lines Changed/Added Lines %
internal/inspect/bloat/bloat.go 0 1 0.0%
internal/inspect/calls/calls.go 0 1 0.0%
internal/inspect/index_sizes/index_sizes.go 0 1 0.0%
internal/inspect/outliers/outliers.go 0 1 0.0%
internal/inspect/role_connections/role_connections.go 0 1 0.0%
internal/inspect/table_index_sizes/table_index_sizes.go 0 1 0.0%
internal/inspect/total_index_size/total_index_size.go 0 1 0.0%
internal/inspect/vacuum_stats/vacuum_stats.go 0 1 0.0%
internal/inspect/blocking/blocking.go 0 2 0.0%
internal/inspect/index_usage/index_usage.go 0 2 0.0%
Files with Coverage Reduction New Missed Lines %
internal/gen/keys/keys.go 5 11.76%
Totals Coverage Status
Change from base Build 8657336860: -0.07%
Covered Lines: 6376
Relevant Lines: 11043

💛 - Coveralls

@encima encima force-pushed the feat/inspect-suggest branch 2 times, most recently from 76428d5 to 867bc75 Compare April 10, 2024 12:07
Copy link
Contributor

@sweatybridge sweatybridge left a comment

Choose a reason for hiding this comment

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

Just one more comment. Everything else looks good.

internal/inspect/queries.go Outdated Show resolved Hide resolved
@sweatybridge sweatybridge changed the title Refine inspect subcommand fix: exclude supabase managed schemas from inspect subcommand Apr 12, 2024
@encima encima force-pushed the feat/inspect-suggest branch 2 times, most recently from 859216a to 03c5f18 Compare April 12, 2024 05:19
internal/inspect/queries.go Outdated Show resolved Hide resolved
internal/inspect/queries.go Outdated Show resolved Hide resolved
internal/inspect/queries.go Outdated Show resolved Hide resolved
internal/inspect/queries.go Outdated Show resolved Hide resolved
internal/inspect/queries.go Outdated Show resolved Hide resolved
Copy link
Contributor

@sweatybridge sweatybridge left a comment

Choose a reason for hiding this comment

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

I've verified all commands locally and fixed the result types where appropriate.

A new change I made is to include managed schemas like auth, storage, extensions, etc. when inspecting table sizes, ie. table-records-count, table-sizes, total-table-sizes. Because records in these schemas are mostly inserted by the user, it would be a good idea to surface their sizes. Schemas with pg_* prefix and information_schema are still excluded from these queries.

In the future, we can perhaps move queries.go to individual *.sql files for better syntax checks.

@sweatybridge sweatybridge merged commit 82885ea into develop Apr 12, 2024
13 checks passed
@sweatybridge sweatybridge deleted the feat/inspect-suggest branch April 12, 2024 17:31
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.

3 participants