Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

refactor: remove String() for custom string types (#1760)

Yilong Li5893d12333ca
diff --git a/api/activity.go b/api/activity.go
index 45568628bc..306023cf69 100644
--- a/api/activity.go
+++ b/api/activity.go
@@ -65,48 +65,6 @@ const (
ActivityDatabaseRecoveryPITRDone ActivityType = "bb.database.recovery.pitr.done"
)
-func (e ActivityType) String() string {
- switch e {
- case ActivityIssueCreate:
- return "bb.issue.create"
- case ActivityIssueCommentCreate:
- return "bb.issue.comment.create"
- case ActivityIssueFieldUpdate:
- return "bb.issue.field.update"
- case ActivityIssueStatusUpdate:
- return "bb.issue.status.update"
- case ActivityPipelineTaskStatusUpdate:
- return "bb.pipeline.task.status.update"
- case ActivityPipelineTaskFileCommit:
- return "bb.pipeline.task.file.commit"
- case ActivityPipelineTaskStatementUpdate:
- return "bb.pipeline.task.statement.update"
- case ActivityMemberCreate:
- return "bb.member.create"
- case ActivityMemberRoleUpdate:
- return "bb.member.role.update"
- case ActivityMemberActivate:
- return "bb.member.activate"
- case ActivityMemberDeactivate:
- return "bb.member.deactivate"
- case ActivityProjectRepositoryPush:
- return "bb.project.repository.push"
- case ActivityProjectDatabaseTransfer:
- return "bb.project.database.transfer"
- case ActivityProjectMemberCreate:
- return "bb.project.member.create"
- case ActivityProjectMemberDelete:
- return "bb.project.member.delete"
- case ActivityProjectMemberRoleUpdate:
- return "bb.project.member.role.update"
- case ActivitySQLEditorQuery:
- return "bb.sql-editor.query"
- case ActivityDatabaseRecoveryPITRDone:
- return "bb.database.recovery.pitr.done"
- }
- return "bb.activity.unknown"
-}
-
// ActivityLevel is the level of activities.
type ActivityLevel string
@@ -119,18 +77,6 @@ const (
ActivityError ActivityLevel = "ERROR"
)
-func (e ActivityLevel) String() string {
- switch e {
- case ActivityInfo:
- return "INFO"
- case ActivityWarn:
- return "WARN"
- case ActivityError:
- return "ERROR"
- }
- return "UNKNOWN"
-}
-
// ActivityIssueCreatePayload is the API message payloads for creating issues.
// These payload types are only used when marshalling to the json format for saving into the database.
// So we annotate with json tag using camelCase naming which is consistent with normal
diff --git a/api/api.go b/api/api.go
index b0f47e80dd..1da3eb7504 100644
--- a/api/api.go
+++ b/api/api.go
@@ -13,16 +13,6 @@ const (
Archived RowStatus = "ARCHIVED"
)
-func (e RowStatus) String() string {
- switch e {
- case Normal:
- return "NORMAL"
- case Archived:
- return "ARCHIVED"
- }
- return ""
-}
-
// SortOrder is the sort order for the returned list.
type SortOrder string
@@ -32,13 +22,3 @@ const (
// DESC is the sort order to return in descending order.
DESC SortOrder = "DESC"
)
-
-func (e SortOrder) String() string {
- switch e {
- case ASC:
- return "ASC"
- case DESC:
- return "DESC"
- }
- return ""
-}
diff --git a/api/backup.go b/api/backup.go
index 107a79cf28..8715768939 100644
--- a/api/backup.go
+++ b/api/backup.go
@@ -19,18 +19,6 @@ const (
BackupStatusFailed BackupStatus = "FAILED"
)
-func (e BackupStatus) String() string {
- switch e {
- case BackupStatusPendingCreate:
- return "PENDING_CREATE"
- case BackupStatusDone:
- return "DONE"
- case BackupStatusFailed:
- return "FAILED"
- }
- return "UNKNOWN"
-}
-
// BackupType is the type of a backup.
type BackupType string
@@ -43,19 +31,6 @@ const (
BackupTypeManual BackupType = "MANUAL"
)
-func (e BackupType) String() string {
- switch e {
- case BackupTypeAutomatic:
- return "AUTOMATIC"
- case BackupTypePITR:
- return "PITR"
- case BackupTypeManual:
- return "MANUAL"
- default:
- return "UNKNOWN"
- }
-}
-
// BackupStorageBackend is the storage backend of a backup.
type BackupStorageBackend string
@@ -70,20 +45,6 @@ const (
BackupStorageBackendOSS BackupStorageBackend = "OSS"
)
-func (e BackupStorageBackend) String() string {
- switch e {
- case BackupStorageBackendLocal:
- return "LOCAL"
- case BackupStorageBackendS3:
- return "S3"
- case BackupStorageBackendGCS:
- return "GCS"
- case BackupStorageBackendOSS:
- return "OSS"
- }
- return "UNKNOWN"
-}
-
// BinlogInfo is the binlog coordination for MySQL.
type BinlogInfo struct {
FileName string `json:"fileName"`
diff --git a/api/data_source.go b/api/data_source.go
index cdd1b27639..2ac66a6663 100644
--- a/api/data_source.go
+++ b/api/data_source.go
@@ -40,18 +40,6 @@ const (
RO DataSourceType = "RO"
)
-func (e DataSourceType) String() string {
- switch e {
- case Admin:
- return "ADMIN"
- case RW:
- return "RW"
- case RO:
- return "RO"
- }
- return ""
-}
-
// DataSource is the API message for a data source.
type DataSource struct {
ID int `jsonapi:"primary,dataSource"`
diff --git a/api/database.go b/api/database.go
index 7959c2627b..1155c53e45 100644
--- a/api/database.go
+++ b/api/database.go
@@ -25,16 +25,6 @@ const (
NotFound SyncStatus = "NOT_FOUND"
)
-func (e SyncStatus) String() string {
- switch e {
- case OK:
- return "OK"
- case NotFound:
- return "NOT_FOUND"
- }
- return ""
-}
-
// Database is the API message for a database.
type Database struct {
ID int `jsonapi:"primary,database"`
diff --git a/api/inbox.go b/api/inbox.go
index 86c9c37a68..8a44e68073 100644
--- a/api/inbox.go
+++ b/api/inbox.go
@@ -14,16 +14,6 @@ const (
Read InboxStatus = "READ"
)
-func (e InboxStatus) String() string {
- switch e {
- case Unread:
- return "UNREAD"
- case Read:
- return "READ"
- }
- return "UNKNOWN"
-}
-
// Inbox is the API message for an inbox.
type Inbox struct {
ID int `jsonapi:"primary,inbox"`
diff --git a/api/instance.go b/api/instance.go
index 2235353873..755cd94b79 100644
--- a/api/instance.go
+++ b/api/instance.go
@@ -126,18 +126,6 @@ const (
InstanceMigrationSchemaNotExist InstanceMigrationSchemaStatus = "NOT_EXIST"
)
-func (e InstanceMigrationSchemaStatus) String() string {
- switch e {
- case InstanceMigrationSchemaUnknown:
- return "UNKNOWN"
- case InstanceMigrationSchemaOK:
- return "OK"
- case InstanceMigrationSchemaNotExist:
- return "NOT_EXIST"
- }
- return "UNKNOWN"
-}
-
// InstanceMigration is the API message for instance migration.
type InstanceMigration struct {
Status InstanceMigrationSchemaStatus `jsonapi:"attr,status"`
diff --git a/api/member.go b/api/member.go
index 8200078c8a..9cac446ec1 100644
--- a/api/member.go
+++ b/api/member.go
@@ -28,18 +28,6 @@ const (
Developer Role = "DEVELOPER"
)
-func (e Role) String() string {
- switch e {
- case Owner:
- return "OWNER"
- case DBA:
- return "DBA"
- case Developer:
- return "DEVELOPER"
- }
- return ""
-}
-
// Member is the API message for a member.
type Member struct {
ID int `jsonapi:"primary,member"`
diff --git a/api/pipeline.go b/api/pipeline.go
index e6654fd108..2c58f0c77d 100644
--- a/api/pipeline.go
+++ b/api/pipeline.go
@@ -19,18 +19,6 @@ const (
PipelineCanceled PipelineStatus = "CANCELED"
)
-func (e PipelineStatus) String() string {
- switch e {
- case PipelineOpen:
- return "OPEN"
- case PipelineDone:
- return "DONE"
- case PipelineCanceled:
- return "CANCELED"
- }
- return ""
-}
-
// Pipeline is the API message for pipelines.
type Pipeline struct {
ID int `jsonapi:"primary,pipeline"`
diff --git a/api/plan.go b/api/plan.go
index 072c7047b8..3e121d19c4 100644
--- a/api/plan.go
+++ b/api/plan.go
@@ -108,38 +108,6 @@ const (
FeatureBranding FeatureType = "bb.feature.branding"
)
-func (e FeatureType) String() string {
- switch e {
- case FeatureSchemaDrift:
- return "bb.feature.schema-drift"
- case FeatureTaskScheduleTime:
- return "bb.feature.task-schedule-time"
- case FeatureMultiTenancy:
- return "bb.feature.multi-tenancy"
- case FeatureDBAWorkflow:
- return "bb.feature.dba-workflow"
- case FeatureDataSource:
- return "bb.feature.data-source"
- case FeatureGhost:
- return "bb.feature.ghost"
- case FeaturePITR:
- return "bb.feature.pitr"
- case FeatureApprovalPolicy:
- return "bb.feature.approval-policy"
- case FeatureBackupPolicy:
- return "bb.feature.backup-policy"
- case FeatureSchemaReviewPolicy:
- return "bb.feature.schema-review-policy"
- case FeatureRBAC:
- return "bb.feature.rbac"
- case Feature3rdPartyAuth:
- return "bb.feature.3rd-party-auth"
- case FeatureBranding:
- return "bb.feature.branding"
- }
- return ""
-}
-
// Name returns a readable name of the feature
func (e FeatureType) Name() string {
switch e {
diff --git a/api/principal.go b/api/principal.go
index c0e210aaa9..64cf51d82e 100644
--- a/api/principal.go
+++ b/api/principal.go
@@ -17,16 +17,6 @@ const (
BOT PrincipalType = "BOT"
)
-func (e PrincipalType) String() string {
- switch e {
- case EndUser:
- return "END_USER"
- case BOT:
- return "BOT"
- }
- return ""
-}
-
// PrincipalAuthProvider is the type of an authentication provider.
type PrincipalAuthProvider string
diff --git a/api/project.go b/api/project.go
index 68ecda9588..4f6babe32e 100644
--- a/api/project.go
+++ b/api/project.go
@@ -22,16 +22,6 @@ const (
VCSWorkflow ProjectWorkflowType = "VCS"
)
-func (e ProjectWorkflowType) String() string {
- switch e {
- case UIWorkflow:
- return "UI"
- case VCSWorkflow:
- return "VCS"
- }
- return ""
-}
-
// ProjectVisibility is the visibility of a project.
type ProjectVisibility string
@@ -42,16 +32,6 @@ const (
Private ProjectVisibility = "PRIVATE"
)
-func (e ProjectVisibility) String() string {
- switch e {
- case Public:
- return "PUBLIC"
- case Private:
- return "PRIVATE"
- }
- return ""
-}
-
// ProjectTenantMode is the tenant mode setting for project.
type ProjectTenantMode string
diff --git a/api/project_member.go b/api/project_member.go
index 8963313723..2d257f3269 100644
--- a/api/project_member.go
+++ b/api/project_member.go
@@ -16,16 +16,6 @@ const (
ProjectRoleProviderGitLabSelfHost ProjectRoleProvider = "GITLAB_SELF_HOST"
)
-func (e ProjectRoleProvider) String() string {
- switch e {
- case ProjectRoleProviderBytebase:
- return "BYTEBASE"
- case ProjectRoleProviderGitLabSelfHost:
- return "GITLAB_SELF_HOST"
- }
- return ""
-}
-
// ProjectRoleProviderPayload is the payload for role provider
type ProjectRoleProviderPayload struct {
VCSRole string `json:"vcsRole"`
diff --git a/api/sheet.go b/api/sheet.go
index ebe90dd920..2e150aef71 100644
--- a/api/sheet.go
+++ b/api/sheet.go
@@ -16,18 +16,6 @@ const (
PublicSheet SheetVisibility = "PUBLIC"
)
-func (v SheetVisibility) String() string {
- switch v {
- case PrivateSheet:
- return "PRIVATE"
- case ProjectSheet:
- return "PROJECT"
- case PublicSheet:
- return "PUBLIC"
- }
- return ""
-}
-
// SheetSource is the type of sheet origin source.
type SheetSource string
@@ -40,19 +28,6 @@ const (
SheetFromGitHubCom SheetSource = "GITHUB_COM"
)
-func (v SheetSource) String() string {
- switch v {
- case SheetFromBytebase:
- return "BYTEBASE"
- case SheetFromGitLabSelfHost:
- return "GITLAB_SELF_HOST"
- case SheetFromGitHubCom:
- return "GITHUB_COM"
- }
- // Default sheet source is BYTEBASE.
- return "BYTEBASE"
-}
-
// SheetType is the type of sheet.
type SheetType string
@@ -61,16 +36,6 @@ const (
SheetForSQL SheetType = "SQL"
)
-func (v SheetType) String() string {
- switch v {
- case SheetForSQL:
- return "SQL"
- default:
- // Default sheet type is SQL.
- return "SQL"
- }
-}
-
// SheetVCSPayload is the additional data payload of the VCS sheet.
type SheetVCSPayload struct {
FileName string `json:"fileName"`
diff --git a/api/task.go b/api/task.go
index a26b353118..fe5d749170 100644
--- a/api/task.go
+++ b/api/task.go
@@ -34,24 +34,6 @@ const (
TaskCanceled TaskStatus = "CANCELED"
)
-func (e TaskStatus) String() string {
- switch e {
- case TaskPending:
- return "PENDING"
- case TaskPendingApproval:
- return "PENDING_APPROVAL"
- case TaskRunning:
- return "RUNNING"
- case TaskDone:
- return "DONE"
- case TaskFailed:
- return "FAILED"
- case TaskCanceled:
- return "CANCELED"
- }
- return "UNKNOWN"
-}
-
// TaskType is the type of a task.
type TaskType string
diff --git a/api/task_check_run.go b/api/task_check_run.go
index 9d55c5d765..f48450c91f 100644
--- a/api/task_check_run.go
+++ b/api/task_check_run.go
@@ -25,20 +25,6 @@ const (
TaskCheckRunCanceled TaskCheckRunStatus = "CANCELED"
)
-func (e TaskCheckRunStatus) String() string {
- switch e {
- case TaskCheckRunRunning:
- return "RUNNING"
- case TaskCheckRunDone:
- return "DONE"
- case TaskCheckRunFailed:
- return "FAILED"
- case TaskCheckRunCanceled:
- return "CANCELED"
- }
- return "UNKNOWN"
-}
-
// TaskCheckStatus is the status of a task check.
type TaskCheckStatus string
@@ -51,18 +37,6 @@ const (
TaskCheckStatusError TaskCheckStatus = "ERROR"
)
-func (e TaskCheckStatus) String() string {
- switch e {
- case TaskCheckStatusSuccess:
- return "SUCCESS"
- case TaskCheckStatusWarn:
- return "WARN"
- case TaskCheckStatusError:
- return "ERROR"
- }
- return "UNKNOWN"
-}
-
// TaskCheckType is the type of a taskCheck.
type TaskCheckType string
diff --git a/api/task_run.go b/api/task_run.go
index d2ac392fa3..0c96ca0426 100644
--- a/api/task_run.go
+++ b/api/task_run.go
@@ -22,20 +22,6 @@ const (
TaskRunCanceled TaskRunStatus = "CANCELED"
)
-func (e TaskRunStatus) String() string {
- switch e {
- case TaskRunRunning:
- return "RUNNING"
- case TaskRunDone:
- return "DONE"
- case TaskRunFailed:
- return "FAILED"
- case TaskRunCanceled:
- return "CANCELED"
- }
- return "UNKNOWN"
-}
-
// TaskRunResultPayload is the result payload for a task run.
type TaskRunResultPayload struct {
Detail string `json:"detail,omitempty"`
diff --git a/common/role.go b/common/role.go
index 6ac59f4492..bed7f104cc 100644
--- a/common/role.go
+++ b/common/role.go
@@ -9,13 +9,3 @@ const (
// ProjectDeveloper is the developer of a project.
ProjectDeveloper ProjectRole = "DEVELOPER"
)
-
-func (e ProjectRole) String() string {
- switch e {
- case ProjectOwner:
- return "OWNER"
- case ProjectDeveloper:
- return "DEVELOPER"
- }
- return ""
-}
diff --git a/metric/collector/member_count.go b/metric/collector/member_count.go
index 133d41d5fb..babf0d4697 100644
--- a/metric/collector/member_count.go
+++ b/metric/collector/member_count.go
@@ -36,9 +36,9 @@ func (c *memberCountCollector) Collect(ctx context.Context) ([]*metric.Metric, e
Name: metricAPI.MemberCountMetricName,
Value: memberCountMetric.Count,
Labels: map[string]string{
- "role": memberCountMetric.Role.String(),
+ "role": string(memberCountMetric.Role),
"status": string(memberCountMetric.Status),
- "row_status": memberCountMetric.RowStatus.String(),
+ "row_status": string(memberCountMetric.RowStatus),
},
})
}
diff --git a/metric/collector/project_count.go b/metric/collector/project_count.go
index 7d604ede54..bf849724f7 100644
--- a/metric/collector/project_count.go
+++ b/metric/collector/project_count.go
@@ -37,8 +37,8 @@ func (c *projectCountCollector) Collect(ctx context.Context) ([]*metric.Metric,
Value: projectCountMetric.Count,
Labels: map[string]string{
"tenant_mode": string(projectCountMetric.TenantMode),
- "workflow": projectCountMetric.WorkflowType.String(),
- "status": projectCountMetric.RowStatus.String(),
+ "workflow": string(projectCountMetric.WorkflowType),
+ "status": string(projectCountMetric.RowStatus),
},
})
}
diff --git a/plugin/advisor/advisor.go b/plugin/advisor/advisor.go
index 8e80e45c71..30d9f914ff 100644
--- a/plugin/advisor/advisor.go
+++ b/plugin/advisor/advisor.go
@@ -25,18 +25,6 @@ const (
SyntaxErrorTitle string = "Syntax error"
)
-func (e Status) String() string {
- switch e {
- case Success:
- return "INFO"
- case Warn:
- return "WARN"
- case Error:
- return "ERROR"
- }
- return "UNKNOWN"
-}
-
// NewStatusBySchemaReviewRuleLevel returns status by SchemaReviewRuleLevel.
func NewStatusBySchemaReviewRuleLevel(level SchemaReviewRuleLevel) (Status, error) {
switch level {
@@ -126,7 +114,7 @@ type Advice struct {
// MarshalLogObject constructs a field that carries Advice.
func (a Advice) MarshalLogObject(enc zapcore.ObjectEncoder) error {
- enc.AddString("status", a.Status.String())
+ enc.AddString("status", string(a.Status))
enc.AddInt("code", int(a.Code))
enc.AddString("title", a.Title)
enc.AddString("content", a.Content)
diff --git a/plugin/db/driver.go b/plugin/db/driver.go
index 471216a3a5..9be3ebb995 100644
--- a/plugin/db/driver.go
+++ b/plugin/db/driver.go
@@ -168,18 +168,6 @@ const (
LIBRARY MigrationSource = "LIBRARY"
)
-func (e MigrationSource) String() string {
- switch e {
- case UI:
- return "UI"
- case VCS:
- return "VCS"
- case LIBRARY:
- return "LIBRARY"
- }
- return "UNKNOWN"
-}
-
// MigrationType is the type of a migration.
type MigrationType string
@@ -200,20 +188,6 @@ const (
Data MigrationType = "DATA"
)
-func (e MigrationType) String() string {
- switch e {
- case Baseline:
- return "BASELINE"
- case Migrate:
- return "MIGRATE"
- case Branch:
- return "BRANCH"
- case Data:
- return "DATA"
- }
- return "UNKNOWN"
-}
-
// MigrationStatus is the status of migration.
type MigrationStatus string
@@ -226,18 +200,6 @@ const (
Failed MigrationStatus = "FAILED"
)
-func (e MigrationStatus) String() string {
- switch e {
- case Pending:
- return "PENDING"
- case Done:
- return "DONE"
- case Failed:
- return "FAILED"
- }
- return "UNKNOWN"
-}
-
// MigrationInfoPayload is the API message for migration info payload.
type MigrationInfoPayload struct {
VCSPushEvent *vcs.PushEvent `json:"pushEvent,omitempty"`
diff --git a/plugin/vcs/gitlab/gitlab.go b/plugin/vcs/gitlab/gitlab.go
index e511b553c5..1f4b96fdfe 100644
--- a/plugin/vcs/gitlab/gitlab.go
+++ b/plugin/vcs/gitlab/gitlab.go
@@ -38,15 +38,6 @@ const (
WebhookPush WebhookType = "push"
)
-func (e WebhookType) String() string {
- switch e {
- case WebhookPush:
- return "push"
- default:
- return "UNKNOWN"
- }
-}
-
// WebhookInfo is the API message for webhook info.
type WebhookInfo struct {
ID int `json:"id"`
@@ -154,26 +145,6 @@ const (
ProjectRoleNoAccess ProjectRole = "NoAccess"
)
-func (e ProjectRole) String() string {
- switch e {
- case ProjectRoleOwner:
- return "Owner"
- case ProjectRoleMaintainer:
- return "Maintainer"
- case ProjectRoleDeveloper:
- return "Developer"
- case ProjectRoleReporter:
- return "Reporter"
- case ProjectRoleGuest:
- return "Guest"
- case ProjectRoleMinimalAccess:
- return "MinimalAccess"
- case ProjectRoleNoAccess:
- return "NoAccess"
- }
- return ""
-}
-
// gitLabRepositoryMember is the API message for repository member
type gitLabRepositoryMember struct {
ID int `json:"id"`
@@ -535,7 +506,7 @@ func (p *Provider) FetchRepositoryActiveMemberList(ctx context.Context, oauthCtx
Name: gitLabMember.Name,
Email: userInfo.PublicEmail,
Role: bytebaseRole,
- VCSRole: gitLabRole.String(),
+ VCSRole: string(gitLabRole),
State: vcs.StateActive,
RoleProvider: vcs.GitLabSelfHost,
}
diff --git a/plugin/vcs/vcs.go b/plugin/vcs/vcs.go
index 1802860f54..abf3cbd3fc 100644
--- a/plugin/vcs/vcs.go
+++ b/plugin/vcs/vcs.go
@@ -18,14 +18,6 @@ const (
GitHubCom Type = "GITHUB_COM"
)
-func (e Type) String() string {
- switch e {
- case GitLabSelfHost, GitHubCom:
- return string(e)
- }
- return "UNKNOWN"
-}
-
// OAuthToken is the API message for OAuthToken.
type OAuthToken struct {
AccessToken string `json:"access_token" `
diff --git a/server/acl.go b/server/acl.go
index db49569250..b0e2fab6b0 100644
--- a/server/acl.go
+++ b/server/acl.go
@@ -76,7 +76,7 @@ func aclMiddleware(s *Server, ce *casbin.Enforcer, next echo.HandlerFunc, readon
role = api.Owner
}
// Performs the ACL check.
- pass, err := ce.Enforce(role.String(), path, method)
+ pass, err := ce.Enforce(string(role), path, method)
if err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to process authorize request.").SetInternal(err)
diff --git a/server/instance.go b/server/instance.go
index 6c3b5ceafe..25658e9c88 100644
--- a/server/instance.go
+++ b/server/instance.go
@@ -145,13 +145,13 @@ func (s *Server) registerInstanceRoutes(g *echo.Group) {
if instancePatch.RowStatus != nil || instancePatch.Name != nil || instancePatch.ExternalLink != nil || instancePatch.Host != nil || instancePatch.Port != nil {
// Users can switch instance status from ARCHIVED to NORMAL.
// So we need to check the current instance count with NORMAL status for quota limitation.
- if instancePatch.RowStatus != nil && *instancePatch.RowStatus == api.Normal.String() {
+ if instancePatch.RowStatus != nil && *instancePatch.RowStatus == string(api.Normal) {
if err := s.instanceCountGuard(ctx); err != nil {
return err
}
}
// Ensure all databases belong to this instance are under the default project before instance is archived.
- if v := instancePatch.RowStatus; v != nil && *v == api.Archived.String() {
+ if v := instancePatch.RowStatus; v != nil && *v == string(api.Archived) {
databases, err := s.store.FindDatabase(ctx, &api.DatabaseFind{InstanceID: &id})
if err != nil {
return echo.NewHTTPError(http.StatusInternalServerError,
diff --git a/server/task_executor.go b/server/task_executor.go
index 2ebd3e21ac..cb553b144e 100644
--- a/server/task_executor.go
+++ b/server/task_executor.go
@@ -139,8 +139,8 @@ func executeMigration(ctx context.Context, pgInstanceDir string, task *api.Task,
log.Debug("Start migration...",
zap.String("instance", task.Instance.Name),
zap.String("database", databaseName),
- zap.String("source", mi.Source.String()),
- zap.String("type", mi.Type.String()),
+ zap.String("source", string(mi.Source)),
+ zap.String("type", string(mi.Type)),
zap.String("statement", statement),
)
diff --git a/store/activity.go b/store/activity.go
index 11697b689e..8aaf0f2ea2 100644
--- a/store/activity.go
+++ b/store/activity.go
@@ -325,7 +325,7 @@ func findActivityImpl(ctx context.Context, tx *sql.Tx, find *api.ActivityFind) (
FROM activity
WHERE ` + strings.Join(where, " AND ")
if v := find.Order; v != nil {
- query += fmt.Sprintf(" ORDER BY created_ts %s", v.String())
+ query += fmt.Sprintf(" ORDER BY created_ts %s", *v)
}
if v := find.Limit; v != nil {
query += fmt.Sprintf(" LIMIT %d", *v)
diff --git a/store/policy.go b/store/policy.go
index 2d7755da8c..148fc3617e 100644
--- a/store/policy.go
+++ b/store/policy.go
@@ -393,7 +393,7 @@ func upsertPolicyImpl(ctx context.Context, tx *sql.Tx, upsert *api.PolicyUpsert)
upsert.Payload = &emptyPayload
}
if upsert.RowStatus == nil {
- rowStatus := api.Normal.String()
+ rowStatus := string(api.Normal)
upsert.RowStatus = &rowStatus
}
diff --git a/tests/schema_system_test.go b/tests/schema_system_test.go
index 4d4368e291..c990727dd6 100644
--- a/tests/schema_system_test.go
+++ b/tests/schema_system_test.go
@@ -340,7 +340,7 @@ func TestSchemaSystem(t *testing.T) {
}
// disable the schema review policy
- disable := api.Archived.String()
+ disable := string(api.Archived)
err = ctl.upsertPolicy(api.PolicyUpsert{
EnvironmentID: prodEnvironment.ID,
Type: api.PolicyTypeSchemaReview,