Skip to content

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

chore: remove unused policy resource (#16407)

Danny Xu1c453d6ed731
diff --git a/CLAUDE.md b/CLAUDE.md
index f6b711b74d..60bcd254db 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -4,7 +4,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
## Project Architecture
- The database schema is defined in `./backend/migrator/migration/LATEST.sql`
-- The database migration files are in `./backend/migrator/<<version>>/`. `TestLatestVersion` in `./backend/migrator/migrator_test.go` needs update after new migration files are added.
+- The database migration files are in `./backend/migrator/<<version>>/`. `TestLatestVersion` in `./backend/migrator/migrator_test.go` and `./backend/migrator/migration/LATEST.sql` needs update after new migration files are added.
- Files in `./backend/store` are mappings to the database tables.
## Build/Test Commands
diff --git a/backend/api/v1/org_policy_service.go b/backend/api/v1/org_policy_service.go
index a44314ce11..e126172686 100644
--- a/backend/api/v1/org_policy_service.go
+++ b/backend/api/v1/org_policy_service.go
@@ -259,18 +259,6 @@ func getPolicyResourceTypeAndResource(requestName string) (base.PolicyResourceTy
return base.PolicyResourceTypeEnvironment, &requestName, nil
}
- if strings.HasPrefix(requestName, common.InstanceNamePrefix) {
- // instance policy request name should be instances/{instance id}
- instanceID, err := common.GetInstanceID(requestName)
- if err != nil {
- return base.PolicyResourceTypeUnknown, nil, status.Error(codes.InvalidArgument, err.Error())
- }
- if instanceID == "-" {
- return base.PolicyResourceTypeInstance, nil, nil
- }
- return base.PolicyResourceTypeInstance, &requestName, nil
- }
-
return base.PolicyResourceTypeUnknown, nil, status.Errorf(codes.InvalidArgument, "unknown request name %s", requestName)
}
@@ -501,8 +489,6 @@ func (s *OrgPolicyService) convertToPolicy(ctx context.Context, policyMessage *s
resourceType = v1pb.PolicyResourceType_ENVIRONMENT
case base.PolicyResourceTypeProject:
resourceType = v1pb.PolicyResourceType_PROJECT
- case base.PolicyResourceTypeInstance:
- resourceType = v1pb.PolicyResourceType_INSTANCE
}
policy := &v1pb.Policy{
InheritFromParent: policyMessage.InheritFromParent,
diff --git a/backend/base/policy.go b/backend/base/policy.go
index 151fccb8ac..d47da2430d 100644
--- a/backend/base/policy.go
+++ b/backend/base/policy.go
@@ -1,23 +1,9 @@
package base
-// PipelineApprovalValue is value for approval policy.
-type PipelineApprovalValue string
-
// PolicyResourceType is the resource type for a policy.
type PolicyResourceType string
-// ReservedTag is the reserved tags for bb.policy.tag.
-type ReservedTag string
-
const (
- // DefaultPolicyID is the ID of the default policy.
- DefaultPolicyID int = 0
-
- // PipelineApprovalValueManualNever means the pipeline will automatically be approved without user intervention.
- PipelineApprovalValueManualNever PipelineApprovalValue = "MANUAL_APPROVAL_NEVER"
- // PipelineApprovalValueManualAlways means the pipeline should be manually approved by user to proceed.
- PipelineApprovalValueManualAlways PipelineApprovalValue = "MANUAL_APPROVAL_ALWAYS"
-
// PolicyResourceTypeUnknown is the unknown resource type.
PolicyResourceTypeUnknown PolicyResourceType = ""
// PolicyResourceTypeWorkspace is the resource type for workspaces.
@@ -26,9 +12,7 @@ const (
PolicyResourceTypeEnvironment PolicyResourceType = "ENVIRONMENT"
// PolicyResourceTypeProject is the resource type for projects.
PolicyResourceTypeProject PolicyResourceType = "PROJECT"
- // PolicyResourceTypeInstance is the resource type for instances.
- PolicyResourceTypeInstance PolicyResourceType = "INSTANCE"
// ReservedTagReviewConfig is the tag for review config.
- ReservedTagReviewConfig ReservedTag = "bb.tag.review_config"
+ ReservedTagReviewConfig string = "bb.tag.review_config"
)
diff --git a/frontend/src/store/modules/v1/policy.ts b/frontend/src/store/modules/v1/policy.ts
index ca0c3bc44c..dc48302567 100644
--- a/frontend/src/store/modules/v1/policy.ts
+++ b/frontend/src/store/modules/v1/policy.ts
@@ -1,16 +1,11 @@
-import { Status, type ServerError } from "nice-grpc-common";
-import { defineStore } from "pinia";
-import { computed, unref, watchEffect, ref } from "vue";
import { policyServiceClient } from "@/grpcweb";
import { policyNamePrefix } from "@/store/modules/v1/common";
import type { MaybeRef } from "@/types";
import { UNKNOWN_USER_NAME } from "@/types";
-import { Policy } from "@/types/proto/v1/org_policy_service";
-import {
- PolicyType,
- PolicyResourceType,
- policyTypeToJSON,
-} from "@/types/proto/v1/org_policy_service";
+import { Policy, PolicyResourceType, PolicyType, policyTypeToJSON } from "@/types/proto/v1/org_policy_service";
+import { Status, type ServerError } from "nice-grpc-common";
+import { defineStore } from "pinia";
+import { computed, ref, unref, watchEffect } from "vue";
import { useCurrentUserV1 } from "../auth";
interface PolicyState {
@@ -39,10 +34,6 @@ const getPolicyParentByResourceType = (
return "projects/-";
case PolicyResourceType.ENVIRONMENT:
return "environments/-";
- case PolicyResourceType.INSTANCE:
- return "instances/-";
- case PolicyResourceType.DATABASE:
- return "instances/-/databases/-";
default:
return "";
}
diff --git a/frontend/src/types/proto/v1/org_policy_service.ts b/frontend/src/types/proto/v1/org_policy_service.ts
index e2210eaa60..ddae6ba23d 100644
--- a/frontend/src/types/proto/v1/org_policy_service.ts
+++ b/frontend/src/types/proto/v1/org_policy_service.ts
@@ -129,8 +129,6 @@ export enum PolicyResourceType {
WORKSPACE = "WORKSPACE",
ENVIRONMENT = "ENVIRONMENT",
PROJECT = "PROJECT",
- INSTANCE = "INSTANCE",
- DATABASE = "DATABASE",
UNRECOGNIZED = "UNRECOGNIZED",
}
@@ -148,12 +146,6 @@ export function policyResourceTypeFromJSON(object: any): PolicyResourceType {
case 3:
case "PROJECT":
return PolicyResourceType.PROJECT;
- case 4:
- case "INSTANCE":
- return PolicyResourceType.INSTANCE;
- case 5:
- case "DATABASE":
- return PolicyResourceType.DATABASE;
case -1:
case "UNRECOGNIZED":
default:
@@ -171,10 +163,6 @@ export function policyResourceTypeToJSON(object: PolicyResourceType): string {
return "ENVIRONMENT";
case PolicyResourceType.PROJECT:
return "PROJECT";
- case PolicyResourceType.INSTANCE:
- return "INSTANCE";
- case PolicyResourceType.DATABASE:
- return "DATABASE";
case PolicyResourceType.UNRECOGNIZED:
default:
return "UNRECOGNIZED";
@@ -191,10 +179,6 @@ export function policyResourceTypeToNumber(object: PolicyResourceType): number {
return 2;
case PolicyResourceType.PROJECT:
return 3;
- case PolicyResourceType.INSTANCE:
- return 4;
- case PolicyResourceType.DATABASE:
- return 5;
case PolicyResourceType.UNRECOGNIZED:
default:
return -1;
diff --git a/proto/gen/grpc-doc/openapi.yaml b/proto/gen/grpc-doc/openapi.yaml
index 538b9ce42d..84744fd7a8 100644
--- a/proto/gen/grpc-doc/openapi.yaml
+++ b/proto/gen/grpc-doc/openapi.yaml
@@ -11529,8 +11529,6 @@ components:
- WORKSPACE
- ENVIRONMENT
- PROJECT
- - INSTANCE
- - DATABASE
type: string
description: The resource type for the policy.
format: enum
diff --git a/proto/gen/grpc-doc/v1/README.md b/proto/gen/grpc-doc/v1/README.md
index 8201241aab..d3bfafe383 100644
--- a/proto/gen/grpc-doc/v1/README.md
+++ b/proto/gen/grpc-doc/v1/README.md
@@ -7099,8 +7099,6 @@ The policy&#39;s `name` field is used to identify the instance to update. Format
| WORKSPACE | 1 | |
| ENVIRONMENT | 2 | |
| PROJECT | 3 | |
-| INSTANCE | 4 | |
-| DATABASE | 5 | |
diff --git a/proto/gen/grpc-doc/v1/index.html b/proto/gen/grpc-doc/v1/index.html
index 4ddc74f2f5..682d76f62e 100644
--- a/proto/gen/grpc-doc/v1/index.html
+++ b/proto/gen/grpc-doc/v1/index.html
@@ -19682,18 +19682,6 @@ In this situation, `update_mask` is ignored. </p></td>
<td><p></p></td>
</tr>
- <tr>
- <td>INSTANCE</td>
- <td>4</td>
- <td><p></p></td>
- </tr>
-
- <tr>
- <td>DATABASE</td>
- <td>5</td>
- <td><p></p></td>
- </tr>
-
</tbody>
</table>
diff --git a/proto/generated-go/v1/org_policy_service.pb.go b/proto/generated-go/v1/org_policy_service.pb.go
index d74cb77c8f..492dbabc03 100644
--- a/proto/generated-go/v1/org_policy_service.pb.go
+++ b/proto/generated-go/v1/org_policy_service.pb.go
@@ -103,8 +103,6 @@ const (
PolicyResourceType_WORKSPACE PolicyResourceType = 1
PolicyResourceType_ENVIRONMENT PolicyResourceType = 2
PolicyResourceType_PROJECT PolicyResourceType = 3
- PolicyResourceType_INSTANCE PolicyResourceType = 4
- PolicyResourceType_DATABASE PolicyResourceType = 5
)
// Enum value maps for PolicyResourceType.
@@ -114,16 +112,12 @@ var (
1: "WORKSPACE",
2: "ENVIRONMENT",
3: "PROJECT",
- 4: "INSTANCE",
- 5: "DATABASE",
}
PolicyResourceType_value = map[string]int32{
"RESOURCE_TYPE_UNSPECIFIED": 0,
"WORKSPACE": 1,
"ENVIRONMENT": 2,
"PROJECT": 3,
- "INSTANCE": 4,
- "DATABASE": 5,
}
)
@@ -1716,14 +1710,12 @@ const file_v1_org_policy_service_proto_rawDesc = "" +
"\x11DATA_SOURCE_QUERY\x10\x0e\x12\x0f\n" +
"\vDATA_EXPORT\x10\x0f\x12\x0e\n" +
"\n" +
- "DATA_QUERY\x10\x10\"\x04\b\x02\x10\x02\"\x04\b\x04\x10\x04\"\x04\b\x06\x10\x06\"\x04\b\x05\x10\x05\"\x04\b\a\x10\a*|\n" +
+ "DATA_QUERY\x10\x10\"\x04\b\x02\x10\x02\"\x04\b\x04\x10\x04\"\x04\b\x06\x10\x06\"\x04\b\x05\x10\x05\"\x04\b\a\x10\a*`\n" +
"\x12PolicyResourceType\x12\x1d\n" +
"\x19RESOURCE_TYPE_UNSPECIFIED\x10\x00\x12\r\n" +
"\tWORKSPACE\x10\x01\x12\x0f\n" +
"\vENVIRONMENT\x10\x02\x12\v\n" +
- "\aPROJECT\x10\x03\x12\f\n" +
- "\bINSTANCE\x10\x04\x12\f\n" +
- "\bDATABASE\x10\x05*Q\n" +
+ "\aPROJECT\x10\x03*Q\n" +
"\x12SQLReviewRuleLevel\x12\x15\n" +
"\x11LEVEL_UNSPECIFIED\x10\x00\x12\t\n" +
"\x05ERROR\x10\x01\x12\v\n" +
diff --git a/proto/v1/v1/org_policy_service.proto b/proto/v1/v1/org_policy_service.proto
index 28a00cedab..fe0d5a6c5a 100644
--- a/proto/v1/v1/org_policy_service.proto
+++ b/proto/v1/v1/org_policy_service.proto
@@ -274,8 +274,6 @@ enum PolicyResourceType {
WORKSPACE = 1;
ENVIRONMENT = 2;
PROJECT = 3;
- INSTANCE = 4;
- DATABASE = 5;
}
message RolloutPolicy {