Skip to content

Prod deploy #3689

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

Open
wants to merge 39 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
5d24bdf
chore(deps): bump supabase/realtime from v2.36.7 to v2.36.8 in /pkg/c…
dependabot[bot] Jun 3, 2025
535b14c
chore(deps): bump supabase/logflare from 1.12.0 to 1.14.2 in /pkg/con…
dependabot[bot] Jun 3, 2025
74d0ab8
chore(deps): bump supabase/postgres from 17.4.1.038 to 17.4.1.039 in …
dependabot[bot] Jun 4, 2025
2aadf58
feat: implement physical backup commands (#3648)
sweatybridge Jun 4, 2025
070e558
feat: alias migration down command as reset (#3635)
sweatybridge Jun 4, 2025
18241d8
fix: update default postgres major version to 17 (#3652)
sweatybridge Jun 4, 2025
4c57b11
fix: migrate down using sql reset (#3655)
sweatybridge Jun 4, 2025
d98ce7d
chore(deps): bump github.com/containers/common from 0.63.0 to 0.63.1 …
dependabot[bot] Jun 5, 2025
af3ccab
chore(deps): bump github.com/go-git/go-git/v5 from 5.16.0 to 5.16.1 (…
dependabot[bot] Jun 5, 2025
631d8b4
chore(deps): bump supabase/postgres from 17.4.1.039 to 17.4.1.040 in …
dependabot[bot] Jun 5, 2025
bcc8498
chore(deps): bump supabase/realtime from v2.36.8 to v2.36.9 in /pkg/c…
dependabot[bot] Jun 5, 2025
b8f8639
chore(deps): bump supabase/storage-api from v1.23.0 to v1.24.1 in /pk…
dependabot[bot] Jun 5, 2025
a47f9fa
chore(deps): bump supabase/studio from 2025.06.02-sha-8f2993d to 2025…
dependabot[bot] Jun 5, 2025
865f304
fix: adjust api key handling for logflare, studio, and vecor (#3653)
Ziinc Jun 5, 2025
4ccaea3
fix: move db dump to public pkg (#3673)
sweatybridge Jun 6, 2025
245b451
chore(deps): bump supabase/storage-api from v1.24.1 to v1.24.4 in /pk…
dependabot[bot] Jun 9, 2025
f299582
chore(deps): bump supabase/realtime from v2.36.9 to v2.36.11 in /pkg/…
dependabot[bot] Jun 9, 2025
300cdf9
chore(deps): bump supabase/postgres from 17.4.1.040 to 17.4.1.042 in …
dependabot[bot] Jun 9, 2025
06bc4eb
fix: allow skipping migrations so it can be managed by ORM (#3683)
sweatybridge Jun 9, 2025
fe74c48
chore(deps): bump google.golang.org/grpc from 1.72.2 to 1.73.0 in /pk…
dependabot[bot] Jun 9, 2025
efdf14a
chore(deps): bump golang.org/x/mod from 0.24.0 to 0.25.0 in /pkg (#3665)
dependabot[bot] Jun 9, 2025
bbe2f91
chore(deps): bump golang.org/x/mod from 0.24.0 to 0.25.0 (#3667)
dependabot[bot] Jun 9, 2025
7280a46
chore(deps): bump supabase/gotrue from v2.174.0 to v2.175.0 in /pkg/c…
dependabot[bot] Jun 9, 2025
389f733
chore(deps): bump supabase/storage-api from v1.24.4 to v1.24.6 in /pk…
dependabot[bot] Jun 10, 2025
30bf461
chore(deps): bump supabase/studio from 2025.06.05-sha-671aea0 to 2025…
dependabot[bot] Jun 10, 2025
7e3a6aa
chore(deps): bump supabase/realtime from v2.36.11 to v2.36.14 in /pkg…
dependabot[bot] Jun 10, 2025
25cc476
chore(deps): bump github.com/slack-go/slack from 0.17.0 to 0.17.1 (#3…
dependabot[bot] Jun 10, 2025
f4f46cb
chore(deps): bump github.com/go-git/go-git/v5 from 5.16.1 to 5.16.2 (…
dependabot[bot] Jun 10, 2025
55e2c45
fix: expose pointer to config struct (#3685)
sweatybridge Jun 10, 2025
f86152e
fix: fallback to deploy with api when docker not found (#3699)
sweatybridge Jun 11, 2025
06aaa3f
chore(ci): add api-sync codegen automation workflow (#3701)
avallete Jun 11, 2025
2fc65cd
chore(deps): bump supabase/realtime from v2.36.14 to v2.36.16 in /pkg…
dependabot[bot] Jun 11, 2025
b3bee3d
chore(deps): bump supabase/gotrue from v2.175.0 to v2.176.0 in /pkg/c…
dependabot[bot] Jun 11, 2025
f2b5f76
chore(ci): use PAT for generated PR (#3712)
avallete Jun 12, 2025
0cf9350
chore: sync API types from infrastructure (#3713)
kiwicopple Jun 12, 2025
8d89df7
fix: download compressed function from local api (#3709)
sweatybridge Jun 12, 2025
ea556bd
chore(deps): bump supabase/supavisor from 2.5.1 to 2.5.2 in /pkg/conf…
dependabot[bot] Jun 13, 2025
b9c5f32
chore(deps): bump supabase/realtime from v2.36.16 to v2.36.18 in /pkg…
dependabot[bot] Jun 13, 2025
2e617fe
chore(deps): bump supabase/postgres from 17.4.1.042 to 17.4.1.043 in …
dependabot[bot] Jun 13, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions .github/workflows/api-sync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: API Sync

on:
repository_dispatch:
types: [api-sync]
workflow_dispatch: # allow manual triggering

# Add explicit permissions
permissions:
contents: write
pull-requests: write

jobs:
sync:
name: Sync API Types
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true

- name: Run codegen
run: go generate

- name: Check for changes
id: check
run: |
if git diff --ignore-space-at-eol --exit-code --quiet pkg; then
echo "No changes detected"
echo "has_changes=false" >> $GITHUB_OUTPUT
else
echo "Changes detected"
echo "has_changes=true" >> $GITHUB_OUTPUT
fi

- name: Create Pull Request
if: steps.check.outputs.has_changes == 'true'
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.GH_PAT }}
commit-message: "chore: sync API types from infrastructure"
title: "chore: sync API types from infrastructure"
body: |
This PR was automatically created to sync API types from the infrastructure repository.

Changes were detected in the generated API code after syncing with the latest spec from infrastructure.
branch: sync/api-types
base: develop
labels: |
automated pr
api-sync
46 changes: 46 additions & 0 deletions cmd/backups.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package cmd

import (
"github.com/spf13/cobra"
"github.com/supabase/cli/internal/backups/list"
"github.com/supabase/cli/internal/backups/restore"
"github.com/supabase/cli/internal/utils/flags"
)

var (
backupsCmd = &cobra.Command{
GroupID: groupManagementAPI,
Use: "backups",
Short: "Manage Supabase physical backups",
}

backupListCmd = &cobra.Command{
Use: "list",
Short: "Lists available physical backups",
Args: cobra.NoArgs,
RunE: func(cmd *cobra.Command, args []string) error {
return list.Run(cmd.Context())
},
}

timestamp int64

backupRestoreCmd = &cobra.Command{
Use: "restore",
Short: "Restore to a specific timestamp using PITR",
Args: cobra.NoArgs,
RunE: func(cmd *cobra.Command, args []string) error {
return restore.Run(cmd.Context(), timestamp)
},
}
)

func init() {
backupFlags := backupsCmd.PersistentFlags()
backupFlags.StringVar(&flags.ProjectRef, "project-ref", "", "Project ref of the Supabase project.")
backupsCmd.AddCommand(backupListCmd)
restoreFlags := backupRestoreCmd.Flags()
restoreFlags.Int64VarP(&timestamp, "timestamp", "t", 0, "The recovery time target in seconds since epoch.")
backupsCmd.AddCommand(backupRestoreCmd)
rootCmd.AddCommand(backupsCmd)
}
13 changes: 11 additions & 2 deletions cmd/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"github.com/supabase/cli/internal/db/test"
"github.com/supabase/cli/internal/utils"
"github.com/supabase/cli/internal/utils/flags"
"github.com/supabase/cli/pkg/migration"
)

var (
Expand Down Expand Up @@ -120,7 +121,13 @@ var (
}
},
RunE: func(cmd *cobra.Command, args []string) error {
return dump.Run(cmd.Context(), file, flags.DbConfig, schema, excludeTable, dataOnly, roleOnly, keepComments, useCopy, dryRun, afero.NewOsFs())
opts := []migration.DumpOptionFunc{
migration.WithSchema(schema...),
migration.WithoutTable(excludeTable...),
migration.WithComments(keepComments),
migration.WithColumnInsert(!useCopy),
}
return dump.Run(cmd.Context(), file, flags.DbConfig, dataOnly, roleOnly, dryRun, afero.NewOsFs(), opts...)
},
PostRun: func(cmd *cobra.Command, args []string) {
if len(file) > 0 {
Expand Down Expand Up @@ -195,7 +202,7 @@ var (
if noSeed {
utils.Config.Db.Seed.Enabled = false
}
return reset.Run(cmd.Context(), migrationVersion, flags.DbConfig, afero.NewOsFs())
return reset.Run(cmd.Context(), migrationVersion, nLastVersion, flags.DbConfig, afero.NewOsFs())
},
}

Expand Down Expand Up @@ -319,6 +326,8 @@ func init() {
resetFlags.BoolVar(&noSeed, "no-seed", false, "Skip running the seed script after reset.")
dbResetCmd.MarkFlagsMutuallyExclusive("db-url", "linked", "local")
resetFlags.StringVar(&migrationVersion, "version", "", "Reset up to the specified version.")
resetFlags.UintVar(&nLastVersion, "last", 0, "Reset up to the last n migration versions.")
dbResetCmd.MarkFlagsMutuallyExclusive("version", "last")
dbCmd.AddCommand(dbResetCmd)
// Build lint command
lintFlags := dbLintCmd.Flags()
Expand Down
19 changes: 19 additions & 0 deletions cmd/migration.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"github.com/spf13/afero"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"github.com/supabase/cli/internal/migration/down"
"github.com/supabase/cli/internal/migration/fetch"
"github.com/supabase/cli/internal/migration/list"
"github.com/supabase/cli/internal/migration/new"
Expand Down Expand Up @@ -90,6 +91,17 @@ var (
},
}

nLastVersion uint

migrationDownCmd = &cobra.Command{
Use: "down",
Short: "Resets applied migrations up to the last n versions",
Args: cobra.NoArgs,
RunE: func(cmd *cobra.Command, args []string) error {
return down.Run(cmd.Context(), nLastVersion, flags.DbConfig, afero.NewOsFs())
},
}

migrationFetchCmd = &cobra.Command{
Use: "fetch",
Short: "Fetch migration files from history table",
Expand Down Expand Up @@ -141,6 +153,13 @@ func init() {
upFlags.Bool("local", true, "Applies pending migrations to the local database.")
migrationUpCmd.MarkFlagsMutuallyExclusive("db-url", "linked", "local")
migrationCmd.AddCommand(migrationUpCmd)
downFlags := migrationDownCmd.Flags()
downFlags.UintVar(&nLastVersion, "last", 1, "Reset up to the last n migration versions.")
downFlags.String("db-url", "", "Resets applied migrations on the database specified by the connection string (must be percent-encoded).")
downFlags.Bool("linked", false, "Resets applied migrations on the linked project.")
downFlags.Bool("local", true, "Resets applied migrations on the local database.")
migrationDownCmd.MarkFlagsMutuallyExclusive("db-url", "linked", "local")
migrationCmd.AddCommand(migrationDownCmd)
// Build up command
fetchFlags := migrationFetchCmd.Flags()
fetchFlags.String("db-url", "", "Fetches migrations from the database specified by the connection string (must be percent-encoded).")
Expand Down
18 changes: 9 additions & 9 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ require (
github.com/charmbracelet/glamour v0.9.1
github.com/charmbracelet/lipgloss v1.1.0
github.com/containerd/errdefs v1.0.0
github.com/containers/common v0.63.0
github.com/containers/common v0.63.1
github.com/docker/cli v28.2.2+incompatible
github.com/docker/docker v28.2.2+incompatible
github.com/docker/go-connections v0.5.0
github.com/getsentry/sentry-go v0.33.0
github.com/go-errors/errors v1.5.1
github.com/go-git/go-git/v5 v5.16.0
github.com/go-git/go-git/v5 v5.16.2
github.com/go-xmlfmt/xmlfmt v1.1.3
github.com/golangci/golangci-lint/v2 v2.1.6
github.com/google/go-github/v62 v62.0.0
Expand All @@ -31,7 +31,7 @@ require (
github.com/joho/godotenv v1.5.1
github.com/muesli/reflow v0.3.0
github.com/oapi-codegen/oapi-codegen/v2 v2.4.1
github.com/slack-go/slack v0.17.0
github.com/slack-go/slack v0.17.1
github.com/spf13/afero v1.14.0
github.com/spf13/cobra v1.9.1
github.com/spf13/pflag v1.0.6
Expand All @@ -43,10 +43,10 @@ require (
github.com/withfig/autocomplete-tools/packages/cobra v1.2.0
github.com/zalando/go-keyring v0.2.6
go.opentelemetry.io/otel v1.36.0
golang.org/x/mod v0.24.0
golang.org/x/mod v0.25.0
golang.org/x/oauth2 v0.30.0
golang.org/x/term v0.32.0
google.golang.org/grpc v1.72.2
google.golang.org/grpc v1.73.0
gopkg.in/yaml.v3 v3.0.1
gotest.tools/gotestsum v1.12.2
)
Expand Down Expand Up @@ -318,8 +318,8 @@ require (
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.34.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.34.0 // indirect
go.opentelemetry.io/otel/metric v1.36.0 // indirect
go.opentelemetry.io/otel/sdk v1.34.0 // indirect
go.opentelemetry.io/otel/sdk/metric v1.34.0 // indirect
go.opentelemetry.io/otel/sdk v1.35.0 // indirect
go.opentelemetry.io/otel/sdk/metric v1.35.0 // indirect
go.opentelemetry.io/otel/trace v1.36.0 // indirect
go.opentelemetry.io/proto/otlp v1.5.0 // indirect
go.uber.org/atomic v1.9.0 // indirect
Expand All @@ -333,8 +333,8 @@ require (
golang.org/x/sys v0.33.0 // indirect
golang.org/x/text v0.24.0 // indirect
golang.org/x/tools v0.32.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20250303144028-a0af3efb3deb // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20250313205543-e70fdf4c4cb4 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20250324211829-b45e905df463 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20250324211829-b45e905df463 // indirect
google.golang.org/protobuf v1.36.6 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
Expand Down
36 changes: 18 additions & 18 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,8 @@ github.com/containerd/errdefs/pkg v0.3.0 h1:9IKJ06FvyNlexW690DXuQNx2KA2cUJXx151X
github.com/containerd/errdefs/pkg v0.3.0/go.mod h1:NJw6s9HwNuRhnjJhM7pylWwMyAkmCQvQ4GpJHEqRLVk=
github.com/containerd/log v0.1.0 h1:TCJt7ioM2cr/tfR8GPbGf9/VRAX8D2B4PjzCpfX540I=
github.com/containerd/log v0.1.0/go.mod h1:VRRf09a7mHDIRezVKTRCrOq78v577GXq3bSa3EhrzVo=
github.com/containers/common v0.63.0 h1:ox6vgUYX5TSvt4W+bE36sYBVz/aXMAfRGVAgvknSjBg=
github.com/containers/common v0.63.0/go.mod h1:+3GCotSqNdIqM3sPs152VvW7m5+Mg8Kk+PExT3G9hZw=
github.com/containers/common v0.63.1 h1:6g02gbW34PaRVH4Heb2Pk11x0SdbQ+8AfeKKeQGqYBE=
github.com/containers/common v0.63.1/go.mod h1:+3GCotSqNdIqM3sPs152VvW7m5+Mg8Kk+PExT3G9hZw=
github.com/containers/storage v1.58.0 h1:Q7SyyCCjqgT3wYNgRNIL8o/wUS92heIj2/cc8Sewvcc=
github.com/containers/storage v1.58.0/go.mod h1:w7Jl6oG+OpeLGLzlLyOZPkmUso40kjpzgrHUk5tyBlo=
github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
Expand Down Expand Up @@ -312,8 +312,8 @@ github.com/go-git/go-billy/v5 v5.6.2 h1:6Q86EsPXMa7c3YZ3aLAQsMA0VlWmy43r6FHqa/UN
github.com/go-git/go-billy/v5 v5.6.2/go.mod h1:rcFC2rAsp/erv7CMz9GczHcuD0D32fWzH+MJAU+jaUU=
github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20231010084843-55a94097c399 h1:eMje31YglSBqCdIqdhKBW8lokaMrL3uTkpGYlE2OOT4=
github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20231010084843-55a94097c399/go.mod h1:1OCfN199q1Jm3HZlxleg+Dw/mwps2Wbk9frAWm+4FII=
github.com/go-git/go-git/v5 v5.16.0 h1:k3kuOEpkc0DeY7xlL6NaaNg39xdgQbtH5mwCafHO9AQ=
github.com/go-git/go-git/v5 v5.16.0/go.mod h1:4Ge4alE/5gPs30F2H1esi2gPd69R0C39lolkucHBOp8=
github.com/go-git/go-git/v5 v5.16.2 h1:fT6ZIOjE5iEnkzKyxTHK1W4HGAsPhqEqiSAssSO77hM=
github.com/go-git/go-git/v5 v5.16.2/go.mod h1:4Ge4alE/5gPs30F2H1esi2gPd69R0C39lolkucHBOp8=
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
Expand Down Expand Up @@ -895,8 +895,8 @@ github.com/sivchari/containedctx v1.0.3 h1:x+etemjbsh2fB5ewm5FeLNi5bUjK0V8n0RB+W
github.com/sivchari/containedctx v1.0.3/go.mod h1:c1RDvCbnJLtH4lLcYD/GqwiBSSf4F5Qk0xld2rBqzJ4=
github.com/skeema/knownhosts v1.3.1 h1:X2osQ+RAjK76shCbvhHHHVl3ZlgDm8apHEHFqRjnBY8=
github.com/skeema/knownhosts v1.3.1/go.mod h1:r7KTdC8l4uxWRyK2TpQZ/1o5HaSzh06ePQNxPwTcfiY=
github.com/slack-go/slack v0.17.0 h1:Vqd4GGIcwwgEu80GBs3cXoPPho5bkDGSFnuZbSG0NhA=
github.com/slack-go/slack v0.17.0/go.mod h1:X+UqOufi3LYQHDnMG1vxf0J8asC6+WllXrVrhl8/Prk=
github.com/slack-go/slack v0.17.1 h1:x0Mnc6biHBea5vfxLR+x4JFl/Rm3eIo0iS3xDZenX+o=
github.com/slack-go/slack v0.17.1/go.mod h1:X+UqOufi3LYQHDnMG1vxf0J8asC6+WllXrVrhl8/Prk=
github.com/sonatard/noctx v0.1.0 h1:JjqOc2WN16ISWAjAk8M5ej0RfExEXtkEyExl2hLW+OM=
github.com/sonatard/noctx v0.1.0/go.mod h1:0RvBxqY8D4j9cTTTWE8ylt2vqj2EPI8fHmrxHdsaZ2c=
github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo=
Expand Down Expand Up @@ -1048,10 +1048,10 @@ go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.34.0 h1:BEj3S
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.34.0/go.mod h1:9cKLGBDzI/F3NoHLQGm4ZrYdIHsvGt6ej6hUowxY0J4=
go.opentelemetry.io/otel/metric v1.36.0 h1:MoWPKVhQvJ+eeXWHFBOPoBOi20jh6Iq2CcCREuTYufE=
go.opentelemetry.io/otel/metric v1.36.0/go.mod h1:zC7Ks+yeyJt4xig9DEw9kuUFe5C3zLbVjV2PzT6qzbs=
go.opentelemetry.io/otel/sdk v1.34.0 h1:95zS4k/2GOy069d321O8jWgYsW3MzVV+KuSPKp7Wr1A=
go.opentelemetry.io/otel/sdk v1.34.0/go.mod h1:0e/pNiaMAqaykJGKbi+tSjWfNNHMTxoC9qANsCzbyxU=
go.opentelemetry.io/otel/sdk/metric v1.34.0 h1:5CeK9ujjbFVL5c1PhLuStg1wxA7vQv7ce1EK0Gyvahk=
go.opentelemetry.io/otel/sdk/metric v1.34.0/go.mod h1:jQ/r8Ze28zRKoNRdkjCZxfs6YvBTG1+YIqyFVFYec5w=
go.opentelemetry.io/otel/sdk v1.35.0 h1:iPctf8iprVySXSKJffSS79eOjl9pvxV9ZqOWT0QejKY=
go.opentelemetry.io/otel/sdk v1.35.0/go.mod h1:+ga1bZliga3DxJ3CQGg3updiaAJoNECOgJREo9KHGQg=
go.opentelemetry.io/otel/sdk/metric v1.35.0 h1:1RriWBmCKgkeHEhM7a2uMjMUfP7MsOF5JpUCaEqEI9o=
go.opentelemetry.io/otel/sdk/metric v1.35.0/go.mod h1:is6XYCUMpcKi+ZsOvfluY5YstFnhW0BidkR+gL+qN+w=
go.opentelemetry.io/otel/trace v1.36.0 h1:ahxWNuqZjpdiFAyrIoQ4GIiAIhxAunQR6MUoKrsNd4w=
go.opentelemetry.io/otel/trace v1.36.0/go.mod h1:gQ+OnDZzrybY4k4seLzPAWNwVBBVlF2szhehOBB/tGA=
go.opentelemetry.io/proto/otlp v1.5.0 h1:xJvq7gMzB31/d406fB8U5CBdyQGw4P399D1aQWU/3i4=
Expand Down Expand Up @@ -1144,8 +1144,8 @@ golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.13.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/mod v0.24.0 h1:ZfthKaKaT4NrhGVZHO1/WDTwGES4De8KtWO0SIbNJMU=
golang.org/x/mod v0.24.0/go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww=
golang.org/x/mod v0.25.0 h1:n7a+ZbQKQA/Ysbyb0/6IbB1H/X41mKgbhfv7AfG/44w=
golang.org/x/mod v0.25.0/go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
Expand Down Expand Up @@ -1444,10 +1444,10 @@ google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7Fc
google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto/googleapis/api v0.0.0-20250303144028-a0af3efb3deb h1:p31xT4yrYrSM/G4Sn2+TNUkVhFCbG9y8itM2S6Th950=
google.golang.org/genproto/googleapis/api v0.0.0-20250303144028-a0af3efb3deb/go.mod h1:jbe3Bkdp+Dh2IrslsFCklNhweNTBgSYanP1UXhJDhKg=
google.golang.org/genproto/googleapis/rpc v0.0.0-20250313205543-e70fdf4c4cb4 h1:iK2jbkWL86DXjEx0qiHcRE9dE4/Ahua5k6V8OWFb//c=
google.golang.org/genproto/googleapis/rpc v0.0.0-20250313205543-e70fdf4c4cb4/go.mod h1:LuRYeWDFV6WOn90g357N17oMCaxpgCnbi/44qJvDn2I=
google.golang.org/genproto/googleapis/api v0.0.0-20250324211829-b45e905df463 h1:hE3bRWtU6uceqlh4fhrSnUyjKHMKB9KrTLLG+bc0ddM=
google.golang.org/genproto/googleapis/api v0.0.0-20250324211829-b45e905df463/go.mod h1:U90ffi8eUL9MwPcrJylN5+Mk2v3vuPDptd5yyNUiRR8=
google.golang.org/genproto/googleapis/rpc v0.0.0-20250324211829-b45e905df463 h1:e0AIkUUhxyBKh6ssZNrAMeqhA7RKUj42346d1y02i2g=
google.golang.org/genproto/googleapis/rpc v0.0.0-20250324211829-b45e905df463/go.mod h1:qQ0YXyHHx3XkvlzUtpXDkS29lDSafHMZBAZDc03LQ3A=
google.golang.org/grpc v1.0.5/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
Expand All @@ -1461,8 +1461,8 @@ google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKa
google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk=
google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
google.golang.org/grpc v1.72.2 h1:TdbGzwb82ty4OusHWepvFWGLgIbNo1/SUynEN0ssqv8=
google.golang.org/grpc v1.72.2/go.mod h1:wH5Aktxcg25y1I3w7H69nHfXdOG3UiadoBtjh3izSDM=
google.golang.org/grpc v1.73.0 h1:VIWSmpI2MegBtTuFt5/JWy2oXxtjJ/e89Z70ImfD2ok=
google.golang.org/grpc v1.73.0/go.mod h1:50sbHOUqWoCQGI8V2HQLJM0B+LMlIUjNSZmow7EVBQc=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
Expand Down
69 changes: 69 additions & 0 deletions internal/backups/list/list.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
package list

import (
"context"
"fmt"
"os"

"github.com/go-errors/errors"
"github.com/supabase/cli/internal/migration/list"
"github.com/supabase/cli/internal/utils"
"github.com/supabase/cli/internal/utils/flags"
"github.com/supabase/cli/pkg/api"
"github.com/supabase/cli/pkg/cast"
)

func Run(ctx context.Context) error {
resp, err := utils.GetSupabase().V1ListAllBackupsWithResponse(ctx, flags.ProjectRef)
if err != nil {
return errors.Errorf("failed to list physical backups: %w", err)
} else if resp.JSON200 == nil {
return errors.Errorf("unexpected list backup status %d: %s", resp.StatusCode(), string(resp.Body))
}
switch utils.OutputFormat.Value {
case utils.OutputPretty:
if len(resp.JSON200.Backups) > 0 {
return listLogicalBackups(*resp.JSON200)
}
table := `REGION|WALG|PITR|EARLIEST TIMESTAMP|LATEST TIMESTAMP
|-|-|-|-|-|
`
table += fmt.Sprintf(
"|`%s`|`%t`|`%t`|`%d`|`%d`|\n",
utils.FormatRegion(resp.JSON200.Region),
resp.JSON200.WalgEnabled,
resp.JSON200.PitrEnabled,
cast.Val(resp.JSON200.PhysicalBackupData.EarliestPhysicalBackupDateUnix, 0),
cast.Val(resp.JSON200.PhysicalBackupData.LatestPhysicalBackupDateUnix, 0),
)
return list.RenderTable(table)
case utils.OutputEnv:
return errors.Errorf("--output env flag is not supported")
}
return utils.EncodeOutput(utils.OutputFormat.Value, os.Stdout, *resp.JSON200)
}

const (
BACKUP_LOGICAL = "LOGICAL"
BACKUP_PHYSICAL = "PHYSICAL"
)

func listLogicalBackups(resp api.V1BackupsResponse) error {
table := `REGION|BACKUP TYPE|STATUS|CREATED AT (UTC)
|-|-|-|-|
`
for _, backup := range resp.Backups {
backupType := BACKUP_LOGICAL
if backup.IsPhysicalBackup {
backupType = BACKUP_PHYSICAL
}
table += fmt.Sprintf(
"|`%s`|`%s`|`%s`|`%s`|\n",
utils.FormatRegion(resp.Region),
backupType,
backup.Status,
utils.FormatTimestamp(backup.InsertedAt),
)
}
return list.RenderTable(table)
}
Loading