Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
fix: return empty database (#2170)
ecmadao5c990fab9430
diff --git a/server/openapi.go b/server/openapi.goindex 838827da26..32072f3257 100644--- a/server/openapi.go+++ b/server/openapi.go@@ -26,7 +26,7 @@ type catalogService struct{}// GetDatabase is the API message in catalog.// We will not connect to the user's database in the early version of sql check api.func (*catalogService) GetDatabase(_ context.Context) (*catalog.Database, error) {- return nil, nil+ return &catalog.Database{}, nil}type sqlCheckRequestBody struct {diff --git a/sql-server/advise.go b/sql-server/advise.goindex cfce31d2e9..389402954e 100644--- a/sql-server/advise.go+++ b/sql-server/advise.go@@ -27,7 +27,7 @@ type catalogService struct{}// GetDatabase is the API message in catalog.// We will not connect to the user's database in the early version of sql check api.func (*catalogService) GetDatabase(_ context.Context) (*catalog.Database, error) {- return nil, nil+ return &catalog.Database{}, nil}type sqlCheckRequestBody struct {diff --git a/store/catalog.go b/store/catalog.goindex aa4e6a8b7d..7edabf1b86 100644--- a/store/catalog.go+++ b/store/catalog.go@@ -34,6 +34,10 @@ func NewCatalog(databaseID *int, store *Store, dbType db.Type) *Catalog {// GetDatabase implements the catalog.Catalog interface.func (c *Catalog) GetDatabase(ctx context.Context) (*catalog.Database, error) {+ if c.databaseID == nil {+ return &catalog.Database{}, nil+ }+database, err := c.store.GetDatabase(ctx, &api.DatabaseFind{ID: c.databaseID,})