• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

supabase / cli / 8665741536

12 Apr 2024 05:19PM UTC coverage: 57.738% (-0.07%) from 57.812%
8665741536

Pull #2138

github

sweatybridge
fix: add schema column to table sizes query
Pull Request #2138: fix: exclude supabase managed schemas from inspect subcommand

2 of 46 new or added lines in 20 files covered. (4.35%)

5 existing lines in 1 file now uncovered.

6376 of 11043 relevant lines covered (57.74%)

662.93 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/internal/inspect/unused_indexes/unused_indexes.go
1
package unused_indexes
2

3
import (
4
        "context"
5
        "fmt"
6

7
        "github.com/go-errors/errors"
8
        "github.com/jackc/pgconn"
9
        "github.com/jackc/pgx/v4"
10
        "github.com/spf13/afero"
11
        "github.com/supabase/cli/internal/db/reset"
12
        "github.com/supabase/cli/internal/inspect"
13
        "github.com/supabase/cli/internal/migration/list"
14
        "github.com/supabase/cli/internal/utils"
15
        "github.com/supabase/cli/internal/utils/pgxv5"
16
)
17

18
type Result struct {
19
        Table       string
20
        Index       string
21
        Index_size  string
22
        Index_scans int64
23
}
24

25
func Run(ctx context.Context, config pgconn.Config, fsys afero.Fs, options ...func(*pgx.ConnConfig)) error {
×
26
        conn, err := utils.ConnectByConfig(ctx, config, options...)
×
27
        if err != nil {
×
28
                return err
×
29
        }
×
NEW
30
        rows, err := conn.Query(ctx, inspect.UNUSED_INDEXES_QUERY, reset.LikeEscapeSchema(utils.InternalSchemas))
×
31
        if err != nil {
×
32
                return errors.Errorf("failed to query rows: %w", err)
×
33
        }
×
34
        result, err := pgxv5.CollectRows[Result](rows)
×
35
        if err != nil {
×
36
                return err
×
37
        }
×
38

39
        table := "|Table|Index|Index Size|Index Scans\n|-|-|-|-|\n"
×
40
        for _, r := range result {
×
NEW
41
                table += fmt.Sprintf("|`%s`|`%s`|`%s`|`%d`|\n", r.Table, r.Index, r.Index_size, r.Index_scans)
×
42
        }
×
43
        return list.RenderTable(table)
×
44
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc