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

supabase / cli / 19325748827

13 Nov 2025 08:49AM UTC coverage: 54.419% (-0.3%) from 54.699%
19325748827

Pull #4372

github

web-flow
Merge e70f78d92 into a057b7430
Pull Request #4372: fix: toggle `DENO_NO_PACKAGE_JSON` conditionally

3 of 3 new or added lines in 1 file covered. (100.0%)

160 existing lines in 12 files now uncovered.

6361 of 11689 relevant lines covered (54.42%)

6.1 hits per line

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

70.0
/internal/inspect/vacuum_stats/vacuum_stats.go
1
package vacuum_stats
2

3
import (
4
        "context"
5
        _ "embed"
6
        "fmt"
7
        "strings"
8

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

18
//go:embed vacuum_stats.sql
19
var VacuumStatsQuery string
20

21
type Result struct {
22
        Name                  string
23
        Last_vacuum           string
24
        Last_autovacuum       string
25
        Last_analyze          string
26
        Last_autoanalyze      string
27
        Rowcount              string
28
        Dead_rowcount         string
29
        Autovacuum_threshold  string
30
        Autoanalyze_threshold string
31
        Expect_autovacuum     string
32
        Expect_autoanalyze    string
33
}
34

35
func Run(ctx context.Context, config pgconn.Config, fsys afero.Fs, options ...func(*pgx.ConnConfig)) error {
1✔
36
        conn, err := utils.ConnectByConfig(ctx, config, options...)
1✔
37
        if err != nil {
1✔
UNCOV
38
                return err
×
39
        }
×
40
        defer conn.Close(context.Background())
1✔
41
        rows, err := conn.Query(ctx, VacuumStatsQuery, reset.LikeEscapeSchema(utils.InternalSchemas))
1✔
42
        if err != nil {
1✔
43
                return errors.Errorf("failed to query rows: %w", err)
×
44
        }
×
45
        result, err := pgxv5.CollectRows[Result](rows)
1✔
46
        if err != nil {
1✔
UNCOV
47
                return err
×
UNCOV
48
        }
×
49

50
        table := "|Table|Last Vacuum|Last Auto Vacuum|Last Analyze|Last Auto Analyze|Row count|Dead row count|Expect autovacuum?|Expect autoanalyze?|\n|-|-|-|-|-|-|-|-|-|\n"
1✔
51
        for _, r := range result {
2✔
52
                rowcount := strings.Replace(r.Rowcount, "-1", "No stats", 1)
1✔
53
                table += fmt.Sprintf("|`%s`|%s|%s|%s|%s|`%s`|`%s`|`%s`|`%s`|\n", r.Name, r.Last_vacuum, r.Last_autovacuum, r.Last_analyze, r.Last_autoanalyze, rowcount, r.Dead_rowcount, r.Expect_autovacuum, r.Expect_autoanalyze)
1✔
54
        }
1✔
55
        return utils.RenderTable(table)
1✔
56
}
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