Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ func GetRootCmd() *cobra.Command {

func addSentryScope(scope *sentry.Scope) {
serviceImages := utils.Config.GetServiceImages()
imageToVersion := make(map[string]interface{}, len(serviceImages))
imageToVersion := make(map[string]any, len(serviceImages))
for _, image := range serviceImages {
parts := strings.Split(image, ":")
// Bypasses sentry's IP sanitization rule, ie. 15.1.0.147
Expand All @@ -271,7 +271,7 @@ func addSentryScope(scope *sentry.Scope) {
}
}
scope.SetContext("Services", imageToVersion)
scope.SetContext("Config", map[string]interface{}{
scope.SetContext("Config", map[string]any{
"Image Registry": utils.GetRegistry(),
"Project ID": flags.ProjectRef,
})
Expand Down
3 changes: 2 additions & 1 deletion cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package cmd
import (
"fmt"
"os"
"slices"
"sort"
"strings"

Expand All @@ -18,7 +19,7 @@ func validateExcludedContainers(excludedContainers []string) {
var invalidContainers []string

for _, e := range excludedContainers {
if !utils.SliceContains(validContainers, e) {
if !slices.Contains(validContainers, e) {
invalidContainers = append(invalidContainers, e)
}
}
Expand Down
6 changes: 3 additions & 3 deletions internal/db/branch/switch_/switch__test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func TestSwitchCommand(t *testing.T) {
Query(reset.TERMINATE_BACKENDS).
Reply("SELECT 1").
Query(reset.COUNT_REPLICATION_SLOTS).
Reply("SELECT 1", []interface{}{0}).
Reply("SELECT 1", []any{0}).
Query("ALTER DATABASE postgres RENAME TO main;").
Reply("ALTER DATABASE").
Query("ALTER DATABASE " + branch + " RENAME TO postgres;").
Expand Down Expand Up @@ -237,7 +237,7 @@ func TestSwitchDatabase(t *testing.T) {
Query(reset.TERMINATE_BACKENDS).
Reply("SELECT 1").
Query(reset.COUNT_REPLICATION_SLOTS).
Reply("SELECT 1", []interface{}{0}).
Reply("SELECT 1", []any{0}).
Query("ALTER DATABASE postgres RENAME TO main;").
ReplyError(pgerrcode.DuplicateDatabase, `database "main" already exists`)
// Setup mock docker
Expand Down Expand Up @@ -267,7 +267,7 @@ func TestSwitchDatabase(t *testing.T) {
Query(reset.TERMINATE_BACKENDS).
Reply("SELECT 1").
Query(reset.COUNT_REPLICATION_SLOTS).
Reply("SELECT 1", []interface{}{0}).
Reply("SELECT 1", []any{0}).
Query("ALTER DATABASE postgres RENAME TO main;").
Reply("ALTER DATABASE").
Query("ALTER DATABASE target RENAME TO postgres;").
Expand Down
18 changes: 9 additions & 9 deletions internal/db/lint/lint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func TestLintCommand(t *testing.T) {
Query(ENABLE_PGSQL_CHECK).
Reply("CREATE EXTENSION").
Query(checkSchemaScript, "public").
Reply("SELECT 1", []interface{}{"f1", string(data)}).
Reply("SELECT 1", []any{"f1", string(data)}).
Query("rollback").Reply("ROLLBACK")
// Run test
err = Run(context.Background(), []string{"public"}, "warning", "none", dbConfig, fsys, conn.Intercept)
Expand Down Expand Up @@ -117,8 +117,8 @@ func TestLintDatabase(t *testing.T) {
Reply("CREATE EXTENSION").
Query(checkSchemaScript, "public").
Reply("SELECT 2",
[]interface{}{"f1", string(r1)},
[]interface{}{"f2", string(r2)},
[]any{"f1", string(r1)},
[]any{"f2", string(r2)},
).
Query("rollback").Reply("ROLLBACK")
// Run test
Expand Down Expand Up @@ -158,9 +158,9 @@ func TestLintDatabase(t *testing.T) {
Query(ENABLE_PGSQL_CHECK).
Reply("CREATE EXTENSION").
Query(checkSchemaScript, "public").
Reply("SELECT 1", []interface{}{"where_clause", string(r1)}).
Reply("SELECT 1", []any{"where_clause", string(r1)}).
Query(checkSchemaScript, "private").
Reply("SELECT 1", []interface{}{"f2", string(r2)}).
Reply("SELECT 1", []any{"f2", string(r2)}).
Query("rollback").Reply("ROLLBACK")
// Run test
result, err := LintDatabase(context.Background(), conn.MockClient(t), []string{"public", "private"})
Expand Down Expand Up @@ -191,7 +191,7 @@ func TestLintDatabase(t *testing.T) {
Query(ENABLE_PGSQL_CHECK).
Reply("CREATE EXTENSION").
Query(checkSchemaScript, "public").
Reply("SELECT 1", []interface{}{"f1", "malformed"}).
Reply("SELECT 1", []any{"f1", "malformed"}).
Query("rollback").Reply("ROLLBACK")
// Run test
_, err := LintDatabase(context.Background(), conn.MockClient(t), []string{"public"})
Expand Down Expand Up @@ -253,7 +253,7 @@ func TestPrintResult(t *testing.T) {
Query(ENABLE_PGSQL_CHECK).
Reply("CREATE EXTENSION").
Query(checkSchemaScript, "public").
Reply("SELECT 1", []interface{}{"f1", `{"function":"22751","issues":[{"level":"warning","message":"test warning"}]}`}).
Reply("SELECT 1", []any{"f1", `{"function":"22751","issues":[{"level":"warning","message":"test warning"}]}`}).
Query("rollback").Reply("ROLLBACK")
// Run test
err := Run(context.Background(), []string{"public"}, "warning", "warning", dbConfig, fsys, conn.Intercept)
Expand All @@ -271,7 +271,7 @@ func TestPrintResult(t *testing.T) {
Query(ENABLE_PGSQL_CHECK).
Reply("CREATE EXTENSION").
Query(checkSchemaScript, "public").
Reply("SELECT 1", []interface{}{"f1", `{"function":"22751","issues":[{"level":"error","message":"test error"}]}`}).
Reply("SELECT 1", []any{"f1", `{"function":"22751","issues":[{"level":"error","message":"test error"}]}`}).
Query("rollback").Reply("ROLLBACK")
// Run test
err := Run(context.Background(), []string{"public"}, "warning", "error", dbConfig, fsys, conn.Intercept)
Expand All @@ -289,7 +289,7 @@ func TestPrintResult(t *testing.T) {
Query(ENABLE_PGSQL_CHECK).
Reply("CREATE EXTENSION").
Query(checkSchemaScript, "public").
Reply("SELECT 1", []interface{}{"f1", `{"function":"22751","issues":[{"level":"error","message":"test error"}]}`}).
Reply("SELECT 1", []any{"f1", `{"function":"22751","issues":[{"level":"error","message":"test error"}]}`}).
Query("rollback").Reply("ROLLBACK")
// Run test
err := Run(context.Background(), []string{"public"}, "warning", "none", dbConfig, fsys, conn.Intercept)
Expand Down
3 changes: 2 additions & 1 deletion internal/db/pull/pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"math"
"os"
"path/filepath"
"slices"
"strconv"
"strings"

Expand Down Expand Up @@ -120,7 +121,7 @@ func diffRemoteSchema(ctx context.Context, schema []string, path string, config
func diffUserSchemas(ctx context.Context, schema []string, path string, config pgconn.Config, fsys afero.Fs) error {
var managed, user []string
for _, s := range schema {
if utils.SliceContains(managedSchemas, s) {
if slices.Contains(managedSchemas, s) {
managed = append(managed, s)
} else {
user = append(user, s)
Expand Down
6 changes: 3 additions & 3 deletions internal/db/pull/pull_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func TestPullSchema(t *testing.T) {
conn := pgtest.NewConn()
defer conn.Close(t)
conn.Query(migration.LIST_MIGRATION_VERSION).
Reply("SELECT 1", []interface{}{"0"}).
Reply("SELECT 1", []any{"0"}).
Query(migration.ListSchemas, migration.ManagedSchemas).
ReplyError(pgerrcode.DuplicateTable, `relation "test" already exists`)
// Run test
Expand All @@ -116,7 +116,7 @@ func TestPullSchema(t *testing.T) {
conn := pgtest.NewConn()
defer conn.Close(t)
conn.Query(migration.LIST_MIGRATION_VERSION).
Reply("SELECT 1", []interface{}{"0"})
Reply("SELECT 1", []any{"0"})
// Run test
err := run(context.Background(), []string{"public"}, "", conn.MockClient(t), fsys)
// Check error
Expand Down Expand Up @@ -167,7 +167,7 @@ func TestSyncRemote(t *testing.T) {
conn := pgtest.NewConn()
defer conn.Close(t)
conn.Query(migration.LIST_MIGRATION_VERSION).
Reply("SELECT 1", []interface{}{"20220727064247"})
Reply("SELECT 1", []any{"20220727064247"})
// Run test
err := assertRemoteInSync(context.Background(), conn.MockClient(t), fsys)
// Check error
Expand Down
4 changes: 2 additions & 2 deletions internal/db/reset/reset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ func TestRecreateDatabase(t *testing.T) {
Query(TERMINATE_BACKENDS).
Reply("SELECT 1").
Query(COUNT_REPLICATION_SLOTS).
Reply("SELECT 1", []interface{}{0}).
Reply("SELECT 1", []any{0}).
Query("DROP DATABASE IF EXISTS postgres WITH (FORCE)").
Reply("DROP DATABASE").
Query("CREATE DATABASE postgres WITH OWNER postgres").
Expand Down Expand Up @@ -269,7 +269,7 @@ func TestRecreateDatabase(t *testing.T) {
Query(TERMINATE_BACKENDS).
Reply("SELECT 1").
Query(COUNT_REPLICATION_SLOTS).
Reply("SELECT 1", []interface{}{0}).
Reply("SELECT 1", []any{0}).
Query("DROP DATABASE IF EXISTS postgres WITH (FORCE)").
ReplyError(pgerrcode.ObjectInUse, `database "postgres" is used by an active logical replication slot`).
Query("CREATE DATABASE postgres WITH OWNER postgres").
Expand Down
4 changes: 2 additions & 2 deletions internal/hostnames/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func TestVerifyCNAME(t *testing.T) {
MatchParam("type", "5").
MatchHeader("accept", "application/dns-json").
Reply(http.StatusOK).
JSON(&map[string]interface{}{"Answer": []map[string]interface{}{
JSON(&map[string]any{"Answer": []map[string]any{
{
"Type": 5, "Data": "foobarbaz.supabase.co.",
},
Expand All @@ -36,7 +36,7 @@ func TestVerifyCNAMEFailures(t *testing.T) {
MatchParam("type", "5").
MatchHeader("accept", "application/dns-json").
Reply(http.StatusOK).
JSON(&map[string]interface{}{"Answer": []map[string]interface{}{
JSON(&map[string]any{"Answer": []map[string]any{
{
"Type": 28, "Data": "127.0.0.1",
},
Expand Down
2 changes: 1 addition & 1 deletion internal/init/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func updateGitIgnore(ignorePath string, fsys afero.Fs) error {
return nil
}

type VSCodeSettings map[string]interface{}
type VSCodeSettings map[string]any

func loadUserSettings(path string, fsys afero.Fs) (VSCodeSettings, error) {
data, err := afero.ReadFile(fsys, path)
Expand Down
8 changes: 4 additions & 4 deletions internal/link/link_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func TestLinkCommand(t *testing.T) {
conn.Query(utils.SET_SESSION_ROLE).
Reply("SET ROLE").
Query(GET_LATEST_STORAGE_MIGRATION).
Reply("SELECT 1", []interface{}{"custom-metadata"})
Reply("SELECT 1", []any{"custom-metadata"})
helper.MockMigrationHistory(conn)
helper.MockSeedHistory(conn)
// Flush pending mocks after test execution
Expand Down Expand Up @@ -200,7 +200,7 @@ func TestLinkCommand(t *testing.T) {
conn.Query(utils.SET_SESSION_ROLE).
Reply("SET ROLE").
Query(GET_LATEST_STORAGE_MIGRATION).
Reply("SELECT 1", []interface{}{"custom-metadata"})
Reply("SELECT 1", []any{"custom-metadata"})
helper.MockMigrationHistory(conn)
helper.MockSeedHistory(conn)
// Flush pending mocks after test execution
Expand Down Expand Up @@ -423,7 +423,7 @@ func TestLinkDatabase(t *testing.T) {
})
defer conn.Close(t)
conn.Query(GET_LATEST_STORAGE_MIGRATION).
Reply("SELECT 1", []interface{}{"custom-metadata"})
Reply("SELECT 1", []any{"custom-metadata"})
helper.MockMigrationHistory(conn)
helper.MockSeedHistory(conn)
// Run test
Expand All @@ -446,7 +446,7 @@ func TestLinkDatabase(t *testing.T) {
})
defer conn.Close(t)
conn.Query(GET_LATEST_STORAGE_MIGRATION).
Reply("SELECT 1", []interface{}{"custom-metadata"})
Reply("SELECT 1", []any{"custom-metadata"})
helper.MockMigrationHistory(conn)
helper.MockSeedHistory(conn)
// Run test
Expand Down
4 changes: 2 additions & 2 deletions internal/migration/down/down_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func TestMigrationsDown(t *testing.T) {
conn := pgtest.NewConn()
defer conn.Close(t)
conn.Query(migration.LIST_MIGRATION_VERSION).
Reply("SELECT 2", []interface{}{"20221201000000"}, []interface{}{"20221201000001"})
Reply("SELECT 2", []any{"20221201000000"}, []any{"20221201000001"})
// Run test
err := Run(context.Background(), 1, dbConfig, fsys, conn.Intercept)
// Check error
Expand All @@ -54,7 +54,7 @@ func TestMigrationsDown(t *testing.T) {
conn := pgtest.NewConn()
defer conn.Close(t)
conn.Query(migration.LIST_MIGRATION_VERSION).
Reply("SELECT 2", []interface{}{"20221201000000"}, []interface{}{"20221201000001"})
Reply("SELECT 2", []any{"20221201000000"}, []any{"20221201000001"})
// Run test
err := Run(context.Background(), 2, dbConfig, fsys, conn.Intercept)
// Check error
Expand Down
4 changes: 2 additions & 2 deletions internal/migration/list/list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func TestRemoteMigrations(t *testing.T) {
conn := pgtest.NewConn()
defer conn.Close(t)
conn.Query(migration.LIST_MIGRATION_VERSION).
Reply("SELECT 1", []interface{}{"20220727064247"})
Reply("SELECT 1", []any{"20220727064247"})
// Run test
versions, err := loadRemoteVersions(context.Background(), dbConfig, conn.Intercept)
// Check error
Expand Down Expand Up @@ -104,7 +104,7 @@ func TestRemoteMigrations(t *testing.T) {
conn := pgtest.NewConn()
defer conn.Close(t)
conn.Query(migration.LIST_MIGRATION_VERSION).
Reply("SELECT 1", []interface{}{})
Reply("SELECT 1", []any{})
// Run test
_, err := loadRemoteVersions(context.Background(), dbConfig, conn.Intercept)
// Check error
Expand Down
20 changes: 10 additions & 10 deletions internal/migration/up/up_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func TestPendingMigrations(t *testing.T) {
conn := pgtest.NewConn()
defer conn.Close(t)
conn.Query(migration.LIST_MIGRATION_VERSION).
Reply("SELECT 2", []interface{}{"20221201000000"}, []interface{}{"20221201000001"})
Reply("SELECT 2", []any{"20221201000000"}, []any{"20221201000001"})
// Run test
pending, err := GetPendingMigrations(context.Background(), false, conn.MockClient(t), fsys)
// Check error
Expand Down Expand Up @@ -61,7 +61,7 @@ func TestPendingMigrations(t *testing.T) {
conn := pgtest.NewConn()
defer conn.Close(t)
conn.Query(migration.LIST_MIGRATION_VERSION).
Reply("SELECT 1", []interface{}{"0"})
Reply("SELECT 1", []any{"0"})
// Run test
_, err := GetPendingMigrations(context.Background(), false, conn.MockClient(t), fsys)
// Check error
Expand All @@ -81,7 +81,7 @@ func TestPendingMigrations(t *testing.T) {
conn := pgtest.NewConn()
defer conn.Close(t)
conn.Query(migration.LIST_MIGRATION_VERSION).
Reply("SELECT 1", []interface{}{"1"})
Reply("SELECT 1", []any{"1"})
// Run test
_, err := GetPendingMigrations(context.Background(), false, conn.MockClient(t), fsys)
// Check error
Expand All @@ -106,7 +106,7 @@ func TestIgnoreVersionMismatch(t *testing.T) {
conn := pgtest.NewConn()
defer conn.Close(t)
conn.Query(migration.LIST_MIGRATION_VERSION).
Reply("SELECT 2", []interface{}{"20221201000000"}, []interface{}{"20221201000002"})
Reply("SELECT 2", []any{"20221201000000"}, []any{"20221201000002"})
// Run test
pending, err := GetPendingMigrations(context.Background(), true, conn.MockClient(t), fsys)
// Check error
Expand All @@ -130,7 +130,7 @@ func TestIgnoreVersionMismatch(t *testing.T) {
conn := pgtest.NewConn()
defer conn.Close(t)
conn.Query(migration.LIST_MIGRATION_VERSION).
Reply("SELECT 2", []interface{}{"20221201000002"}, []interface{}{"20221201000004"})
Reply("SELECT 2", []any{"20221201000002"}, []any{"20221201000004"})
// Run test
_, err := GetPendingMigrations(context.Background(), true, conn.MockClient(t), fsys)
// Check error
Expand All @@ -153,11 +153,11 @@ func TestIgnoreVersionMismatch(t *testing.T) {
defer conn.Close(t)
conn.Query(migration.LIST_MIGRATION_VERSION).
Reply("SELECT 5",
[]interface{}{"20221201000000"},
[]interface{}{"20221201000001"},
[]interface{}{"20221201000002"},
[]interface{}{"20221201000003"},
[]interface{}{"20221201000004"},
[]any{"20221201000000"},
[]any{"20221201000001"},
[]any{"20221201000002"},
[]any{"20221201000003"},
[]any{"20221201000004"},
)
// Run test
_, err := GetPendingMigrations(context.Background(), true, conn.MockClient(t), fsys)
Expand Down
2 changes: 1 addition & 1 deletion internal/postgresConfig/update/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func Run(ctx context.Context, projectRef string, values []string, replaceOverrid
newConfigOverrides[splits[0]] = splits[1]
}
// 2. If not in replace mode, retrieve current overrides
finalOverrides := make(map[string]interface{})
finalOverrides := make(map[string]any)
{
if !replaceOverrides {
config, err := get.GetCurrentPostgresConfig(ctx, projectRef)
Expand Down
8 changes: 4 additions & 4 deletions internal/sso/create/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ func Run(ctx context.Context, params RunParams) error {
if params.AttributeMapping != "" {
body.AttributeMapping = &struct {
Keys map[string]struct {
Array *bool "json:\"array,omitempty\""
Default *interface{} "json:\"default,omitempty\""
Name *string "json:\"name,omitempty\""
Names *[]string "json:\"names,omitempty\""
Array *bool "json:\"array,omitempty\""
Default *any "json:\"default,omitempty\""
Name *string "json:\"name,omitempty\""
Names *[]string "json:\"names,omitempty\""
} "json:\"keys\""
}{}
if err := saml.ReadAttributeMappingFile(Fs, params.AttributeMapping, body.AttributeMapping); err != nil {
Expand Down
8 changes: 4 additions & 4 deletions internal/sso/internal/saml/files_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ func TestReadAttributeMappingFile(t *testing.T) {
body := api.CreateProviderBody{
AttributeMapping: &struct {
Keys map[string]struct {
Array *bool "json:\"array,omitempty\""
Default *interface{} "json:\"default,omitempty\""
Name *string "json:\"name,omitempty\""
Names *[]string "json:\"names,omitempty\""
Array *bool "json:\"array,omitempty\""
Default *any "json:\"default,omitempty\""
Name *string "json:\"name,omitempty\""
Names *[]string "json:\"names,omitempty\""
} "json:\"keys\""
}{},
}
Expand Down
Loading