Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
chore: rename consts to be Go idiomatic (#4603)
Joe Chena8b4179d82e2
diff --git a/backend/server/webhook.go b/backend/server/webhook.goindex 326c8b6609..b7e161768e 100644--- a/backend/server/webhook.go+++ b/backend/server/webhook.go@@ -648,9 +648,9 @@ func groupFileInfoByRepo(distinctFileList []vcs.DistinctFileItem, repositoryListtype fileType intconst (- unknownFileType fileType = iota- migrationFileType- schemaFileType+ fileTypeUnknown fileType = iota+ fileTypeMigration+ fileTypeSchema)// getFileInfo processes the file item against the candidate list of@@ -694,11 +694,11 @@ func getFileInfo(fileItem vcs.DistinctFileItem, repositoryList []*api.Repository}if mi != nil {if fileItem.IsYAML && mi.Type != db.Data {- return nil, unknownFileType, nil, errors.New("only DML is allowed for YAML files in a tenant project")+ return nil, fileTypeUnknown, nil, errors.New("only DML is allowed for YAML files in a tenant project")}migrationInfo = mi- fType = migrationFileType+ fType = fileTypeMigrationfileRepositoryList = append(fileRepositoryList, repository)continue}@@ -713,7 +713,7 @@ func getFileInfo(fileItem vcs.DistinctFileItem, repositoryList []*api.Repository}if si != nil {migrationInfo = si- fType = schemaFileType+ fType = fileTypeSchemafileRepositoryList = append(fileRepositoryList, repository)continue}@@ -721,7 +721,7 @@ func getFileInfo(fileItem vcs.DistinctFileItem, repositoryList []*api.Repositoryswitch len(fileRepositoryList) {case 0:- return nil, unknownFileType, nil, errors.Errorf("file change is not associated with any project")+ return nil, fileTypeUnknown, nil, errors.Errorf("file change is not associated with any project")case 1:return migrationInfo, fType, fileRepositoryList[0], nildefault:@@ -729,7 +729,7 @@ func getFileInfo(fileItem vcs.DistinctFileItem, repositoryList []*api.Repositoryfor _, repository := range fileRepositoryList {projectList = append(projectList, repository.Project.Name)}- return nil, unknownFileType, nil, errors.Errorf("file change should be associated with exactly one project but found %s", strings.Join(projectList, ", "))+ return nil, fileTypeUnknown, nil, errors.Errorf("file change should be associated with exactly one project but found %s", strings.Join(projectList, ", "))}}@@ -751,7 +751,7 @@ func (s *Server) processFilesInProject(ctx context.Context, pushEvent vcs.PushEvcreatorID := s.getIssueCreatorID(ctx, pushEvent.CommitList[0].AuthorEmail)for _, fileInfo := range fileInfoList {- if fileInfo.fType == schemaFileType {+ if fileInfo.fType == fileTypeSchema {if repo.Project.SchemaChangeType == api.ProjectSchemaChangeTypeSDL {// Create one issue per schema file for SDL project.migrationDetailListForFile, activityCreateListForFile := s.prepareIssueFromSDLFile(ctx, repo, pushEvent, fileInfo.migrationInfo, fileInfo.item.FileName)@@ -768,7 +768,7 @@ func (s *Server) processFilesInProject(ctx context.Context, pushEvent vcs.PushEv} else {log.Debug("Ignored schema file for non-SDL project", zap.String("fileName", fileInfo.item.FileName), zap.String("type", string(fileInfo.item.ItemType)))}- } else { // fileInfo.fType == migrationFileType+ } else { // fileInfo.fType == fileTypeMigration// This is a migration-based DDL or DML file and we would allow it for both DDL and SDL schema change type project.// For DDL schema change type project, this is expected.// For SDL schema change type project, we allow it because:diff --git a/backend/server/webhook_test.go b/backend/server/webhook_test.goindex 1f86145c05..763e35fcea 100644--- a/backend/server/webhook_test.go+++ b/backend/server/webhook_test.go@@ -201,7 +201,7 @@ func TestGetFileInfo(t *testing.T) {)require.NoError(t, err)assert.Equal(t, 1, repo.ID)- assert.Equal(t, migrationFileType, fileType)+ assert.Equal(t, fileTypeMigration, fileType)want := &db.MigrationInfo{Version: "0001",@@ -230,7 +230,7 @@ func TestGetFileInfo(t *testing.T) {)require.NoError(t, err)assert.Equal(t, 1, repo.ID)- assert.Equal(t, migrationFileType, fileType)+ assert.Equal(t, fileTypeMigration, fileType)want := &db.MigrationInfo{Version: "0001",@@ -262,7 +262,7 @@ func TestGetFileInfo(t *testing.T) {)require.NoError(t, err)assert.Equal(t, 1, repo.ID)- assert.Equal(t, migrationFileType, fileType)+ assert.Equal(t, fileTypeMigration, fileType)want := &db.MigrationInfo{Version: "0001",