Skip to content

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

feat(PITR): PITR feature gate (#1702)

Yilong Li1489843ffbf4
diff --git a/api/plan.go b/api/plan.go
index af485b6e5a..072c7047b8 100644
--- a/api/plan.go
+++ b/api/plan.go
@@ -67,6 +67,9 @@ const (
// FeatureGhost allows user to use gh-ost for MySQL database migration.
FeatureGhost FeatureType = "bb.feature.ghost"
+ // FeaturePITR allows user to perform point-in-time recovery for databases.
+ FeaturePITR FeatureType = "bb.feature.pitr"
+
// Policy Control
// FeatureApprovalPolicy allows user to specify approval policy for the environment
@@ -119,6 +122,8 @@ func (e FeatureType) String() string {
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:
@@ -150,6 +155,8 @@ func (e FeatureType) Name() string {
return "Data source"
case FeatureGhost:
return "gh-ost integration"
+ case FeaturePITR:
+ return "Point-in-time Recovery"
case FeatureApprovalPolicy:
return "Approval policy"
case FeatureBackupPolicy:
@@ -191,6 +198,7 @@ var FeatureMatrix = map[FeatureType][3]bool{
"bb.feature.dba-workflow": {false, false, true},
"bb.feature.data-source": {false, false, false},
"bb.feature.ghost": {false, true, true},
+ "bb.feature.pitr": {false, true, true},
"bb.feature.approval-policy": {false, true, true},
"bb.feature.backup-policy": {false, true, true},
"bb.feature.schema-review-policy": {false, true, true},
diff --git a/server/issue.go b/server/issue.go
index a81dd062b4..88d9b32d03 100644
--- a/server/issue.go
+++ b/server/issue.go
@@ -608,6 +608,9 @@ func (s *Server) getPipelineCreate(ctx context.Context, issueCreate *api.IssueCr
}, nil
case api.IssueDatabasePITR:
+ if !s.feature(api.FeaturePITR) {
+ return nil, echo.NewHTTPError(http.StatusForbidden, api.FeaturePITR.AccessErrorMessage())
+ }
c := api.PITRContext{}
if err := json.Unmarshal([]byte(issueCreate.CreateContext), &c); err != nil {
return nil, err