From 55f6a8e526bcbb8521b17a67fe1195e61d0a0ba4 Mon Sep 17 00:00:00 2001 From: Han Qiao Date: Wed, 3 Dec 2025 11:05:19 +0800 Subject: [PATCH 1/8] chore: grant gha permission to cli repo --- .github/workflows/release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 79e7ecb69..7e2d16b9e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -103,6 +103,7 @@ jobs: owner: ${{ github.repository_owner }} repositories: | supabase + cli - run: go run tools/changelog/main.go ${{ secrets.SLACK_CHANNEL }} env: GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} From 05ee3e07703b4ee1143d2c3cc3a3bee50a4ed77f Mon Sep 17 00:00:00 2001 From: Qiao Han Date: Wed, 3 Dec 2025 16:17:06 +0800 Subject: [PATCH 2/8] fix: trim space for migration version --- internal/seed/buckets/buckets_test.go | 2 ++ internal/utils/tenant/database_test.go | 35 +++++++++++++------------- pkg/config/config.go | 2 +- 3 files changed, 20 insertions(+), 19 deletions(-) diff --git a/internal/seed/buckets/buckets_test.go b/internal/seed/buckets/buckets_test.go index e14a40e74..7194f390b 100644 --- a/internal/seed/buckets/buckets_test.go +++ b/internal/seed/buckets/buckets_test.go @@ -30,6 +30,7 @@ public = false` bucketPath := filepath.Join(utils.SupabaseDirPath, "images") require.NoError(t, fsys.Mkdir(bucketPath, 0755)) // Setup mock api + defer gock.OffAll() gock.New(utils.Config.Api.ExternalUrl). Get("/storage/v1/bucket"). Reply(http.StatusOK). @@ -54,6 +55,7 @@ public = false` t.Run("ignores unconfigured buckets", func(t *testing.T) { // Setup mock api + defer gock.OffAll() gock.New(utils.Config.Api.ExternalUrl). Get("/storage/v1/bucket"). Reply(http.StatusOK). diff --git a/internal/utils/tenant/database_test.go b/internal/utils/tenant/database_test.go index 5a042cd74..108326951 100644 --- a/internal/utils/tenant/database_test.go +++ b/internal/utils/tenant/database_test.go @@ -13,56 +13,55 @@ import ( ) func TestGetDatabaseVersion(t *testing.T) { - t.Run("retrieves database version successfully", func(t *testing.T) { - token := apitest.RandomAccessToken(t) - t.Setenv("SUPABASE_ACCESS_TOKEN", string(token)) + // Setup valid access token + token := apitest.RandomAccessToken(t) + t.Setenv("SUPABASE_ACCESS_TOKEN", string(token)) + // Setup valid project ref + projectRef := apitest.RandomProjectRef() + t.Run("retrieves database version successfully", func(t *testing.T) { + // Setup mock api defer gock.OffAll() - projectRef := apitest.RandomProjectRef() - mockPostgres := api.V1ProjectWithDatabaseResponse{Id: projectRef} + mockPostgres := api.V1ProjectWithDatabaseResponse{} mockPostgres.Database.Version = "14.1.0.99" gock.New(utils.DefaultApiHost). Get("/v1/projects/" + projectRef). Reply(http.StatusOK). JSON(mockPostgres) - + // Run test version, err := GetDatabaseVersion(context.Background(), projectRef) - + // Check error assert.NoError(t, err) assert.Equal(t, "14.1.0.99", version) assert.Empty(t, apitest.ListUnmatchedRequests()) }) t.Run("handles project not found", func(t *testing.T) { - token := apitest.RandomAccessToken(t) - t.Setenv("SUPABASE_ACCESS_TOKEN", string(token)) - + // Setup mock api defer gock.OffAll() projectRef := apitest.RandomProjectRef() gock.New(utils.DefaultApiHost). Get("/v1/projects/" + projectRef). Reply(http.StatusNotFound) - + // Run test version, err := GetDatabaseVersion(context.Background(), projectRef) - + // Check error assert.ErrorContains(t, err, "unexpected retrieve project status 404:") assert.Empty(t, version) assert.Empty(t, apitest.ListUnmatchedRequests()) }) t.Run("handles empty database version", func(t *testing.T) { - token := apitest.RandomAccessToken(t) - t.Setenv("SUPABASE_ACCESS_TOKEN", string(token)) - + // Setup mock api defer gock.OffAll() projectRef := apitest.RandomProjectRef() gock.New(utils.DefaultApiHost). Get("/v1/projects/" + projectRef). Reply(http.StatusOK). - JSON(api.V1ProjectWithDatabaseResponse{Id: projectRef}) - + JSON(api.V1ProjectWithDatabaseResponse{}) + // Run test version, err := GetDatabaseVersion(context.Background(), projectRef) - + // Check error assert.ErrorIs(t, err, errDatabaseVersion) assert.Empty(t, version) assert.Empty(t, apitest.ListUnmatchedRequests()) diff --git a/pkg/config/config.go b/pkg/config/config.go index 3096f4d55..6e9ef96bb 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -634,7 +634,7 @@ func (c *config) Load(path string, fsys fs.FS, overrides ...ConfigEditor) error } } if version, err := fs.ReadFile(fsys, builder.StorageMigrationPath); err == nil && len(version) > 0 { - c.Storage.TargetMigration = string(version) + c.Storage.TargetMigration = strings.TrimSpace(string(version)) } if version, err := fs.ReadFile(fsys, builder.EdgeRuntimeVersionPath); err == nil && len(version) > 0 { c.EdgeRuntime.Image = replaceImageTag(Images.EdgeRuntime, string(version)) From 43f4766fc6eb512dcc48b8eaa6b0765faa9db700 Mon Sep 17 00:00:00 2001 From: Qiao Han Date: Wed, 3 Dec 2025 16:17:28 +0800 Subject: [PATCH 3/8] fix: race condition when fetching service versions --- internal/services/services.go | 25 ++++-- internal/services/services_test.go | 139 +++++++++++++++++++++++++++++ 2 files changed, 156 insertions(+), 8 deletions(-) create mode 100644 internal/services/services_test.go diff --git a/internal/services/services.go b/internal/services/services.go index 46d399c43..146926180 100644 --- a/internal/services/services.go +++ b/internal/services/services.go @@ -11,9 +11,12 @@ import ( "github.com/supabase/cli/internal/utils" "github.com/supabase/cli/internal/utils/flags" "github.com/supabase/cli/internal/utils/tenant" + "github.com/supabase/cli/pkg/config" "github.com/supabase/cli/pkg/queue" ) +var ErrEnvNotSupported = errors.New("--output env flag is not supported") + func Run(ctx context.Context, fsys afero.Fs) error { if err := flags.LoadProjectRef(fsys); err != nil && !errors.Is(err, utils.ErrNotLinked) { fmt.Fprintln(os.Stderr, err) @@ -43,7 +46,7 @@ func Run(ctx context.Context, fsys afero.Fs) error { Services: serviceImages, }) case utils.OutputEnv: - return errors.Errorf("--output env flag is not supported") + return errors.New(ErrEnvNotSupported) } return utils.EncodeOutput(utils.OutputFormat.Value, os.Stdout, serviceImages) @@ -76,39 +79,39 @@ func CheckVersions(ctx context.Context, fsys afero.Fs) []imageVersion { } func listRemoteImages(ctx context.Context, projectRef string) map[string]string { - linked := map[string]string{} keys, err := tenant.GetApiKeys(ctx, projectRef) if err != nil { - return linked + return nil } + linked := config.NewConfig() jq := queue.NewJobQueue(5) api := tenant.NewTenantAPI(ctx, projectRef, keys.ServiceRole) jobs := []func() error{ func() error { version, err := tenant.GetDatabaseVersion(ctx, projectRef) if err == nil { - linked[utils.Config.Db.Image] = version + linked.Db.Image = version } return nil }, func() error { version, err := api.GetGotrueVersion(ctx) if err == nil { - linked[utils.Config.Auth.Image] = version + linked.Auth.Image = version } return nil }, func() error { version, err := api.GetPostgrestVersion(ctx) if err == nil { - linked[utils.Config.Api.Image] = version + linked.Api.Image = version } return nil }, func() error { version, err := api.GetStorageVersion(ctx) if err == nil { - linked[utils.Config.Storage.Image] = version + linked.Storage.Image = version } return err }, @@ -123,7 +126,13 @@ func listRemoteImages(ctx context.Context, projectRef string) map[string]string if err := jq.Collect(); err != nil { fmt.Fprintln(logger, err) } - return linked + // Convert to map last to avoid race condition + return map[string]string{ + utils.Config.Db.Image: linked.Db.Image, + utils.Config.Auth.Image: linked.Auth.Image, + utils.Config.Api.Image: linked.Api.Image, + utils.Config.Storage.Image: linked.Storage.Image, + } } func suggestUpdateCmd(serviceImages map[string]string) string { diff --git a/internal/services/services_test.go b/internal/services/services_test.go new file mode 100644 index 000000000..fd8c85d1b --- /dev/null +++ b/internal/services/services_test.go @@ -0,0 +1,139 @@ +package services + +import ( + "context" + "net/http" + "testing" + + "github.com/h2non/gock" + "github.com/oapi-codegen/nullable" + "github.com/spf13/afero" + "github.com/stretchr/testify/assert" + "github.com/supabase/cli/internal/testing/apitest" + "github.com/supabase/cli/internal/utils" + "github.com/supabase/cli/internal/utils/flags" + "github.com/supabase/cli/internal/utils/tenant" + "github.com/supabase/cli/pkg/api" +) + +func TestServicesCommand(t *testing.T) { + t.Run("output pretty", func(t *testing.T) { + utils.OutputFormat.Value = utils.OutputPretty + // Run test + err := Run(context.Background(), afero.NewMemMapFs()) + // Check error + assert.NoError(t, err) + }) + + t.Run("output toml", func(t *testing.T) { + utils.OutputFormat.Value = utils.OutputToml + // Run test + err := Run(context.Background(), afero.NewMemMapFs()) + // Check error + assert.NoError(t, err) + }) + + t.Run("output json", func(t *testing.T) { + utils.OutputFormat.Value = utils.OutputJson + // Run test + err := Run(context.Background(), afero.NewMemMapFs()) + // Check error + assert.NoError(t, err) + }) + + t.Run("output env", func(t *testing.T) { + utils.OutputFormat.Value = utils.OutputEnv + // Run test + err := Run(context.Background(), afero.NewMemMapFs()) + // Check error + assert.ErrorIs(t, err, ErrEnvNotSupported) + }) +} + +func TestCheckVersions(t *testing.T) { + // Setup valid access token + token := apitest.RandomAccessToken(t) + t.Setenv("SUPABASE_ACCESS_TOKEN", string(token)) + // Setup valid project ref + flags.ProjectRef = apitest.RandomProjectRef() + projectHost := "https://" + utils.GetSupabaseHost(flags.ProjectRef) + // Setup mock project + mockProject := api.V1ProjectWithDatabaseResponse{} + mockProject.Database.Version = "14.1.0.99" + + t.Run("diff service versions", func(t *testing.T) { + // Setup mock api + defer gock.OffAll() + gock.New(utils.DefaultApiHost). + Get("/v1/projects/" + flags.ProjectRef + "/api-keys"). + Reply(http.StatusOK). + JSON([]api.ApiKeyResponse{{ + Name: "service_role", + ApiKey: nullable.NewNullableWithValue("service-key"), + }}) + gock.New(utils.DefaultApiHost). + Get("/v1/projects/" + flags.ProjectRef). + Reply(http.StatusOK). + JSON(mockProject) + // Mock service versions + gock.New(projectHost). + Get("/auth/v1/health"). + Reply(http.StatusOK). + JSON(tenant.HealthResponse{Version: "v2.74.2"}) + gock.New(projectHost). + Get("/rest/v1/"). + Reply(http.StatusOK). + JSON(tenant.SwaggerResponse{Info: tenant.SwaggerInfo{Version: "11.1.0"}}) + gock.New(projectHost). + Get("/storage/v1/version"). + Reply(http.StatusOK). + BodyString("1.28.0") + // Run test + images := CheckVersions(context.Background(), afero.NewMemMapFs()) + // Check error + assert.Equal(t, len(images), 10) + for _, img := range images { + assert.NotEqual(t, img.Local, img.Remote) + } + assert.Empty(t, apitest.ListUnmatchedRequests()) + }) + + t.Run("list remote images", func(t *testing.T) { + // Setup mock api + defer gock.OffAll() + gock.New(utils.DefaultApiHost). + Get("/v1/projects/" + flags.ProjectRef + "/api-keys"). + Reply(http.StatusOK). + JSON([]api.ApiKeyResponse{{ + Name: "service_role", + ApiKey: nullable.NewNullableWithValue("service-key"), + }}) + gock.New(utils.DefaultApiHost). + Get("/v1/projects/" + flags.ProjectRef). + Reply(http.StatusOK). + JSON(mockProject) + // Mock service versions + gock.New(projectHost). + Get("/auth/v1/health"). + Reply(http.StatusOK). + JSON(tenant.HealthResponse{Version: "v2.74.2"}) + gock.New(projectHost). + Get("/rest/v1/"). + Reply(http.StatusOK). + JSON(tenant.SwaggerResponse{Info: tenant.SwaggerInfo{Version: "11.1.0"}}) + gock.New(projectHost). + Get("/storage/v1/version"). + Reply(http.StatusOK). + BodyString("1.28.0") + // Run test + images := listRemoteImages(context.Background(), flags.ProjectRef) + // Check error + assert.Equal(t, images, map[string]string{ + utils.Config.Db.Image: "14.1.0.99", + utils.Config.Auth.Image: "v2.74.2", + utils.Config.Api.Image: "v11.1.0", + utils.Config.Storage.Image: "v1.28.0", + }) + assert.Empty(t, apitest.ListUnmatchedRequests()) + }) +} From b9afe63b1956fd7c73d4d89a217c89be990c4b36 Mon Sep 17 00:00:00 2001 From: Qiao Han Date: Wed, 3 Dec 2025 16:20:25 +0800 Subject: [PATCH 4/8] chore: refactor common error type --- internal/branches/list/list.go | 2 +- internal/functions/list/list.go | 2 +- internal/orgs/list/list.go | 2 +- internal/projects/list/list.go | 2 +- internal/secrets/list/list.go | 2 +- internal/services/services.go | 4 +--- internal/services/services_test.go | 2 +- internal/snippets/list/list.go | 2 +- internal/sso/get/get.go | 2 +- internal/utils/output.go | 2 ++ 10 files changed, 11 insertions(+), 11 deletions(-) diff --git a/internal/branches/list/list.go b/internal/branches/list/list.go index 4c6d3757a..12dad2c0b 100644 --- a/internal/branches/list/list.go +++ b/internal/branches/list/list.go @@ -30,7 +30,7 @@ func Run(ctx context.Context, fsys afero.Fs) error { Branches: branches, }) case utils.OutputEnv: - return errors.Errorf("--output env flag is not supported") + return errors.New(utils.ErrEnvNotSupported) } return utils.EncodeOutput(utils.OutputFormat.Value, os.Stdout, branches) diff --git a/internal/functions/list/list.go b/internal/functions/list/list.go index b174365a3..c376a22a9 100644 --- a/internal/functions/list/list.go +++ b/internal/functions/list/list.go @@ -45,7 +45,7 @@ func Run(ctx context.Context, projectRef string, fsys afero.Fs) error { Functions: *resp.JSON200, }) case utils.OutputEnv: - return errors.Errorf("--output env flag is not supported") + return errors.New(utils.ErrEnvNotSupported) } return utils.EncodeOutput(utils.OutputFormat.Value, os.Stdout, *resp.JSON200) diff --git a/internal/orgs/list/list.go b/internal/orgs/list/list.go index aedbb4236..663cc61fe 100644 --- a/internal/orgs/list/list.go +++ b/internal/orgs/list/list.go @@ -30,7 +30,7 @@ func Run(ctx context.Context) error { Organizations: *resp.JSON200, }) case utils.OutputEnv: - return errors.Errorf("--output env flag is not supported") + return errors.New(utils.ErrEnvNotSupported) } return utils.EncodeOutput(utils.OutputFormat.Value, os.Stdout, *resp.JSON200) diff --git a/internal/projects/list/list.go b/internal/projects/list/list.go index 3c756abbf..8f29bb2b2 100644 --- a/internal/projects/list/list.go +++ b/internal/projects/list/list.go @@ -64,7 +64,7 @@ func Run(ctx context.Context, fsys afero.Fs) error { Projects: projects, }) case utils.OutputEnv: - return errors.Errorf("--output env flag is not supported") + return errors.New(utils.ErrEnvNotSupported) } return utils.EncodeOutput(utils.OutputFormat.Value, os.Stdout, projects) diff --git a/internal/secrets/list/list.go b/internal/secrets/list/list.go index 731ba2daa..3e6c1a2ba 100644 --- a/internal/secrets/list/list.go +++ b/internal/secrets/list/list.go @@ -35,7 +35,7 @@ func Run(ctx context.Context, projectRef string, fsys afero.Fs) error { Secrets: secrets, }) case utils.OutputEnv: - return errors.Errorf("--output env flag is not supported") + return errors.New(utils.ErrEnvNotSupported) } return utils.EncodeOutput(utils.OutputFormat.Value, os.Stdout, secrets) diff --git a/internal/services/services.go b/internal/services/services.go index 146926180..c1b7074e3 100644 --- a/internal/services/services.go +++ b/internal/services/services.go @@ -15,8 +15,6 @@ import ( "github.com/supabase/cli/pkg/queue" ) -var ErrEnvNotSupported = errors.New("--output env flag is not supported") - func Run(ctx context.Context, fsys afero.Fs) error { if err := flags.LoadProjectRef(fsys); err != nil && !errors.Is(err, utils.ErrNotLinked) { fmt.Fprintln(os.Stderr, err) @@ -46,7 +44,7 @@ func Run(ctx context.Context, fsys afero.Fs) error { Services: serviceImages, }) case utils.OutputEnv: - return errors.New(ErrEnvNotSupported) + return errors.New(utils.ErrEnvNotSupported) } return utils.EncodeOutput(utils.OutputFormat.Value, os.Stdout, serviceImages) diff --git a/internal/services/services_test.go b/internal/services/services_test.go index fd8c85d1b..e2ba6bfd0 100644 --- a/internal/services/services_test.go +++ b/internal/services/services_test.go @@ -46,7 +46,7 @@ func TestServicesCommand(t *testing.T) { // Run test err := Run(context.Background(), afero.NewMemMapFs()) // Check error - assert.ErrorIs(t, err, ErrEnvNotSupported) + assert.ErrorIs(t, err, utils.ErrEnvNotSupported) }) } diff --git a/internal/snippets/list/list.go b/internal/snippets/list/list.go index 5d32a04c0..ca5529cee 100644 --- a/internal/snippets/list/list.go +++ b/internal/snippets/list/list.go @@ -40,7 +40,7 @@ func Run(ctx context.Context, fsys afero.Fs) error { } return utils.RenderTable(table) case utils.OutputEnv: - return errors.Errorf("--output env flag is not supported") + return errors.New(utils.ErrEnvNotSupported) } return utils.EncodeOutput(utils.OutputFormat.Value, os.Stdout, *resp.JSON200) diff --git a/internal/sso/get/get.go b/internal/sso/get/get.go index 07e6251f7..b57bba695 100644 --- a/internal/sso/get/get.go +++ b/internal/sso/get/get.go @@ -37,7 +37,7 @@ func Run(ctx context.Context, ref, providerId, format string) error { case utils.OutputPretty: return render.SingleMarkdown(*resp.JSON200) case utils.OutputEnv: - return errors.Errorf("--output env flag is not supported") + return errors.New(utils.ErrEnvNotSupported) default: return utils.EncodeOutput(format, os.Stdout, resp.JSON200) } diff --git a/internal/utils/output.go b/internal/utils/output.go index f0c7e191b..df879fb42 100644 --- a/internal/utils/output.go +++ b/internal/utils/output.go @@ -38,6 +38,8 @@ var OutputFormat = EnumFlag{ Value: OutputPretty, } +var ErrEnvNotSupported = errors.New("--output env flag is not supported") + func EncodeOutput(format string, w io.Writer, value any) error { switch format { case OutputEnv: From b7bf150a97cf59aaa177895957d8f090f715bb64 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 4 Dec 2025 00:30:51 +0000 Subject: [PATCH 5/8] fix(docker): bump supabase/postgres from 17.6.1.058 to 17.6.1.059 in /pkg/config/templates (#4576) fix(docker): bump supabase/postgres in /pkg/config/templates Bumps supabase/postgres from 17.6.1.058 to 17.6.1.059. --- updated-dependencies: - dependency-name: supabase/postgres dependency-version: 17.6.1.059 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pkg/config/templates/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/config/templates/Dockerfile b/pkg/config/templates/Dockerfile index c64d7578d..24573489e 100644 --- a/pkg/config/templates/Dockerfile +++ b/pkg/config/templates/Dockerfile @@ -1,5 +1,5 @@ # Exposed for updates by .github/dependabot.yml -FROM supabase/postgres:17.6.1.058 AS pg +FROM supabase/postgres:17.6.1.059 AS pg # Append to ServiceImages when adding new dependencies below FROM library/kong:2.8.1 AS kong FROM axllent/mailpit:v1.22.3 AS mailpit From 95a6b7732bf15033c98b91842ab0ed3ff643d2e7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 4 Dec 2025 00:36:23 +0000 Subject: [PATCH 6/8] fix(docker): bump the docker-minor group in /pkg/config/templates with 3 updates (#4575) fix(docker): bump the docker-minor group Bumps the docker-minor group in /pkg/config/templates with 3 updates: supabase/edge-runtime, supabase/realtime and supabase/logflare. Updates `supabase/edge-runtime` from v1.69.27 to v1.69.28 Updates `supabase/realtime` from v2.66.2 to v2.67.2 Updates `supabase/logflare` from 1.26.16 to 1.26.20 --- updated-dependencies: - dependency-name: supabase/edge-runtime dependency-version: v1.69.28 dependency-type: direct:production dependency-group: docker-minor - dependency-name: supabase/realtime dependency-version: v2.67.2 dependency-type: direct:production dependency-group: docker-minor - dependency-name: supabase/logflare dependency-version: 1.26.20 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: docker-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pkg/config/templates/Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/config/templates/Dockerfile b/pkg/config/templates/Dockerfile index 24573489e..04044a246 100644 --- a/pkg/config/templates/Dockerfile +++ b/pkg/config/templates/Dockerfile @@ -7,13 +7,13 @@ FROM postgrest/postgrest:v14.1 AS postgrest FROM supabase/postgres-meta:v0.93.1 AS pgmeta FROM supabase/studio:2025.12.01-sha-4ad48b7 AS studio FROM darthsim/imgproxy:v3.8.0 AS imgproxy -FROM supabase/edge-runtime:v1.69.27 AS edgeruntime +FROM supabase/edge-runtime:v1.69.28 AS edgeruntime FROM timberio/vector:0.28.1-alpine AS vector FROM supabase/supavisor:2.7.4 AS supavisor FROM supabase/gotrue:v2.183.0 AS gotrue -FROM supabase/realtime:v2.66.2 AS realtime +FROM supabase/realtime:v2.67.2 AS realtime FROM supabase/storage-api:v1.32.1 AS storage -FROM supabase/logflare:1.26.16 AS logflare +FROM supabase/logflare:1.26.20 AS logflare # Append to JobImages when adding new dependencies below FROM supabase/pgadmin-schema-diff:cli-0.0.5 AS differ FROM supabase/migra:3.0.1663481299 AS migra From 7f1bb04bc2005a1af9e695e65c1d946219a246ba Mon Sep 17 00:00:00 2001 From: Han Qiao Date: Thu, 4 Dec 2025 13:46:37 +0800 Subject: [PATCH 7/8] fix: suggest repair command after squash local (#4578) fix: suggest repair command after squash --- internal/migration/squash/squash.go | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/migration/squash/squash.go b/internal/migration/squash/squash.go index 1ba5c55a9..b2c1650af 100644 --- a/internal/migration/squash/squash.go +++ b/internal/migration/squash/squash.go @@ -40,6 +40,7 @@ func Run(ctx context.Context, version string, config pgconn.Config, fsys afero.F } // 2. Update migration history if utils.IsLocalDatabase(config) { + utils.CmdSuggestion = fmt.Sprintf("Run %s to update your remote migration history table.", utils.Aqua("supabase migration repair --status applied")) return nil } if shouldUpdate, err := utils.NewConsole().PromptYesNo(ctx, "Update remote migration history table?", true); err != nil { From 03a9671e46f2c69c6eeb3faacd097d14de290535 Mon Sep 17 00:00:00 2001 From: Han Qiao Date: Thu, 4 Dec 2025 14:34:45 +0800 Subject: [PATCH 8/8] fix: remove config volume mount from db container (#4579) --- internal/db/reset/reset_test.go | 1 - internal/db/start/start.go | 1 - internal/db/start/start_test.go | 3 --- internal/start/start_test.go | 2 -- internal/stop/stop_test.go | 2 -- internal/utils/config.go | 2 -- 6 files changed, 11 deletions(-) diff --git a/internal/db/reset/reset_test.go b/internal/db/reset/reset_test.go index 9eeb0f150..839ccdc8b 100644 --- a/internal/db/reset/reset_test.go +++ b/internal/db/reset/reset_test.go @@ -38,7 +38,6 @@ func TestResetCommand(t *testing.T) { t.Run("seeds storage after reset", func(t *testing.T) { utils.DbId = "test-reset" - utils.ConfigId = "test-config" utils.Config.Db.MajorVersion = 15 // Setup in-memory fs fsys := afero.NewMemMapFs() diff --git a/internal/db/start/start.go b/internal/db/start/start.go index 78fc1cf45..f9ba14eb3 100644 --- a/internal/db/start/start.go +++ b/internal/db/start/start.go @@ -122,7 +122,6 @@ func NewHostConfig() container.HostConfig { RestartPolicy: container.RestartPolicy{Name: "always"}, Binds: []string{ utils.DbId + ":/var/lib/postgresql/data", - utils.ConfigId + ":/etc/postgresql-custom", }, } if utils.Config.Db.MajorVersion <= 14 { diff --git a/internal/db/start/start_test.go b/internal/db/start/start_test.go index 4cad4fb11..39f23d8ba 100644 --- a/internal/db/start/start_test.go +++ b/internal/db/start/start_test.go @@ -55,7 +55,6 @@ func TestStartDatabase(t *testing.T) { t.Run("initialize main branch", func(t *testing.T) { utils.Config.Db.MajorVersion = 15 utils.DbId = "supabase_db_test" - utils.ConfigId = "supabase_config_test" utils.Config.Db.Port = 5432 // Setup in-memory fs fsys := afero.NewMemMapFs() @@ -103,7 +102,6 @@ func TestStartDatabase(t *testing.T) { t.Run("recover from backup volume", func(t *testing.T) { utils.Config.Db.MajorVersion = 14 utils.DbId = "supabase_db_test" - utils.ConfigId = "supabase_config_test" utils.Config.Db.Port = 5432 // Setup in-memory fs fsys := afero.NewMemMapFs() @@ -316,7 +314,6 @@ func TestStartDatabaseWithCustomSettings(t *testing.T) { // Setup utils.Config.Db.MajorVersion = 15 utils.DbId = "supabase_db_test" - utils.ConfigId = "supabase_config_test" utils.Config.Db.Port = 5432 utils.Config.Db.Settings.MaxConnections = cast.Ptr(uint(50)) diff --git a/internal/start/start_test.go b/internal/start/start_test.go index 787fba4f6..a90d7a719 100644 --- a/internal/start/start_test.go +++ b/internal/start/start_test.go @@ -120,7 +120,6 @@ func TestDatabaseStart(t *testing.T) { } // Start postgres utils.DbId = "test-postgres" - utils.ConfigId = "test-config" utils.Config.Db.Port = 54322 utils.Config.Db.MajorVersion = 15 gock.New(utils.Docker.DaemonHost()). @@ -230,7 +229,6 @@ func TestDatabaseStart(t *testing.T) { JSON(image.InspectResponse{}) // Start postgres utils.DbId = "test-postgres" - utils.ConfigId = "test-config" utils.Config.Db.Port = 54322 utils.Config.Db.MajorVersion = 15 gock.New(utils.Docker.DaemonHost()). diff --git a/internal/stop/stop_test.go b/internal/stop/stop_test.go index d260143df..e39fdd722 100644 --- a/internal/stop/stop_test.go +++ b/internal/stop/stop_test.go @@ -191,7 +191,6 @@ func TestStopServices(t *testing.T) { t.Run("removes data volumes", func(t *testing.T) { utils.DbId = "test-db" - utils.ConfigId = "test-config" utils.StorageId = "test-storage" utils.EdgeRuntimeId = "test-functions" utils.InbucketId = "test-inbucket" @@ -208,7 +207,6 @@ func TestStopServices(t *testing.T) { t.Run("skips all filter when removing data volumes with Docker version pre-v1.42", func(t *testing.T) { utils.DbId = "test-db" - utils.ConfigId = "test-config" utils.StorageId = "test-storage" utils.EdgeRuntimeId = "test-functions" utils.InbucketId = "test-inbucket" diff --git a/internal/utils/config.go b/internal/utils/config.go index 62e0134e4..108c3391a 100644 --- a/internal/utils/config.go +++ b/internal/utils/config.go @@ -18,7 +18,6 @@ import ( var ( NetId string DbId string - ConfigId string KongId string GotrueId string InbucketId string @@ -64,7 +63,6 @@ func UpdateDockerIds() { NetId = GetId("network") } DbId = GetId(DbAliases[0]) - ConfigId = GetId("config") KongId = GetId(KongAliases[0]) GotrueId = GetId(GotrueAliases[0]) InbucketId = GetId(InbucketAliases[0])