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

supabase / cli / 11267309158

10 Oct 2024 04:12AM UTC coverage: 60.211% (-0.04%) from 60.248%
11267309158

Pull #2754

github

sweatybridge
feat: support postgres config update without restart
Pull Request #2754: feat: support postgres config update without restart

4 of 9 new or added lines in 2 files covered. (44.44%)

5 existing lines in 1 file now uncovered.

6516 of 10822 relevant lines covered (60.21%)

6.0 hits per line

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

66.67
/cmd/postgres.go
1
package cmd
2

3
import (
4
        "github.com/spf13/afero"
5
        "github.com/spf13/cobra"
6
        "github.com/supabase/cli/internal/postgresConfig/get"
7
        "github.com/supabase/cli/internal/postgresConfig/update"
8
        "github.com/supabase/cli/internal/utils/flags"
9
)
10

11
var (
12
        postgresCmd = &cobra.Command{
13
                GroupID: groupManagementAPI,
14
                Use:     "postgres-config",
15
                Short:   "Manage Postgres database config",
16
        }
17

18
        postgresConfigGetCmd = &cobra.Command{
19
                Use:   "get",
20
                Short: "Get the current Postgres database config overrides",
21
                RunE: func(cmd *cobra.Command, args []string) error {
×
22
                        return get.Run(cmd.Context(), flags.ProjectRef, afero.NewOsFs())
×
23
                },
×
24
        }
25

26
        postgresConfigUpdateCmd = &cobra.Command{
27
                Use:   "update",
28
                Short: "Update Postgres database config",
29
                Long: `Overriding the default Postgres config could result in unstable database behavior.
30
Custom configuration also overrides the optimizations generated based on the compute add-ons in use.`,
31
                RunE: func(cmd *cobra.Command, args []string) error {
×
NEW
32
                        return update.Run(cmd.Context(), flags.ProjectRef, postgresConfigValues, postgresConfigUpdateReplaceMode, noRestart, afero.NewOsFs())
×
33
                },
×
34
        }
35

36
        postgresConfigValues            []string
37
        postgresConfigUpdateReplaceMode bool
38
        noRestart                       bool
39
)
40

41
func init() {
1✔
42
        postgresCmd.PersistentFlags().StringVar(&flags.ProjectRef, "project-ref", "", "Project ref of the Supabase project.")
1✔
43
        postgresCmd.AddCommand(postgresConfigGetCmd)
1✔
44
        postgresCmd.AddCommand(postgresConfigUpdateCmd)
1✔
45

1✔
46
        updateFlags := postgresConfigUpdateCmd.Flags()
1✔
47
        updateFlags.StringSliceVar(&postgresConfigValues, "config", []string{}, "Config overrides specified as a 'key=value' pair")
1✔
48
        updateFlags.BoolVar(&postgresConfigUpdateReplaceMode, "replace-existing-overrides", false, "If true, replaces all existing overrides with the ones provided. If false (default), merges existing overrides with the ones provided.")
1✔
49
        updateFlags.BoolVar(&noRestart, "no-restart", false, "Do not restart the database after updating config.")
1✔
50

1✔
51
        rootCmd.AddCommand(postgresCmd)
1✔
52
}
1✔
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