Skip to content

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

chore(schema system): remove the backward compatibility task (#1333)

ecmadaoff85f6a10246
diff --git a/api/plan.go b/api/plan.go
index c808cedf1f..0c92a9a814 100644
--- a/api/plan.go
+++ b/api/plan.go
@@ -33,12 +33,6 @@ type FeatureType string
const (
// Change Workflow
- // FeatureBackwardCompatibility checks if a DDL change is backward compatible.
- // See https://bytebase.com/docs/features/sql-advisor/backward-compatibility-migration-check
- //
- // Currently, we only support MySQL/TiDB thanks to github.com/pingcap/parser
- // TODO(ed): remove this after TaskCheckDatabaseStatementCompatibility is entirely moved into schema review policy
- FeatureBackwardCompatibility FeatureType = "bb.feature.backward-compatibility"
// FeatureSchemaDrift detects if there occurs schema drift.
// See https://bytebase.com/docs/features/drift-detection
FeatureSchemaDrift FeatureType = "bb.feature.schema-drift"
@@ -110,8 +104,6 @@ const (
func (e FeatureType) String() string {
switch e {
- case FeatureBackwardCompatibility:
- return "bb.feature.backward-compatibility"
case FeatureSchemaDrift:
return "bb.feature.schema-drift"
case FeatureTaskScheduleTime:
@@ -141,8 +133,6 @@ func (e FeatureType) String() string {
// Name returns a readable name of the feature
func (e FeatureType) Name() string {
switch e {
- case FeatureBackwardCompatibility:
- return "Backward compatibility"
case FeatureSchemaDrift:
return "Schema drift"
case FeatureTaskScheduleTime:
@@ -188,18 +178,17 @@ func (e FeatureType) minimumSupportedPlan() PlanType {
// FeatureMatrix is a map from the a particular feature to the respective enablement of a particular plan
var FeatureMatrix = map[FeatureType][3]bool{
- "bb.feature.backward-compatibility": {false, true, true},
- "bb.feature.schema-drift": {false, true, true},
- "bb.feature.task-schedule-time": {false, true, true},
- "bb.feature.multi-tenancy": {false, true, true},
- "bb.feature.dba-workflow": {false, false, true},
- "bb.feature.data-source": {false, false, false},
- "bb.feature.approval-policy": {false, true, true},
- "bb.feature.backup-policy": {false, true, true},
- "bb.feature.schema-review-policy": {false, true, true},
- "bb.feature.rbac": {false, true, true},
- "bb.feature.3rd-party-auth": {false, true, true},
- "bb.feature.branding": {false, true, true},
+ "bb.feature.schema-drift": {false, true, true},
+ "bb.feature.task-schedule-time": {false, true, true},
+ "bb.feature.multi-tenancy": {false, true, true},
+ "bb.feature.dba-workflow": {false, false, true},
+ "bb.feature.data-source": {false, false, false},
+ "bb.feature.approval-policy": {false, true, true},
+ "bb.feature.backup-policy": {false, true, true},
+ "bb.feature.schema-review-policy": {false, true, true},
+ "bb.feature.rbac": {false, true, true},
+ "bb.feature.3rd-party-auth": {false, true, true},
+ "bb.feature.branding": {false, true, true},
}
// Plan is the API message for a plan.
diff --git a/frontend/src/components/Issue/IssueDetailLayout.vue b/frontend/src/components/Issue/IssueDetailLayout.vue
index cf7a53c2d1..1278250dbf 100644
--- a/frontend/src/components/Issue/IssueDetailLayout.vue
+++ b/frontend/src/components/Issue/IssueDetailLayout.vue
@@ -14,16 +14,13 @@
</IssueHighlightPanel>
</div>
- <!-- Remind banner for bb.feature.backward-compatibility -->
+ <!-- Remind banner for bb.feature.schema-review-policy -->
<FeatureAttention
- v-if="
- !hasBackwardCompatibilityFeature &&
- supportBackwardCompatibilityFeature
- "
+ v-if="!hasSchemaReviewPolicyFeature"
custom-class="m-5 mt-0"
- feature="bb.feature.backward-compatibility"
+ feature="bb.feature.schema-review-policy"
:description="
- $t('subscription.features.bb-feature-backward-compatibility.desc')
+ $t('subscription.features.bb-feature-schema-review-policy.desc')
"
/>
@@ -296,15 +293,10 @@ onMounted(() => {
document.getElementById("issue-detail-top")!.scrollIntoView();
});
-const hasBackwardCompatibilityFeature = featureToRef(
- "bb.feature.backward-compatibility"
+const hasSchemaReviewPolicyFeature = featureToRef(
+ "bb.feature.schema-review-policy"
);
-const supportBackwardCompatibilityFeature = computed((): boolean => {
- const engine = database.value?.instance.engine;
- return engine === "MYSQL" || engine === "TIDB";
-});
-
watch(
[create, issue, () => route.query.sql as string, issueLogic],
([create, issue, sql, provider]) => {
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.json
index b0cd8ab428..543170f770 100644
--- a/frontend/src/locales/en-US.json
+++ b/frontend/src/locales/en-US.json
@@ -1253,9 +1253,9 @@
"title": "Backup policy",
"desc": "Backup policy will auto-backup your database based on the schedule."
},
- "bb-feature-backward-compatibility": {
- "title": "Backward compatibility",
- "desc": "MySQL and TiDB support checking whether the schema change is backward compatible. @:{'subscription.upgrade'} to unlock this feature."
+ "bb-feature-schema-review-policy": {
+ "title": "Schema review policy",
+ "desc": "Customize the schema review policy for different environments. @:{'subscription.upgrade'} to unlock this feature."
},
"bb-feature-rbac": {
"title": "Role management",
@@ -1292,7 +1292,7 @@
"sql-check-basic": "Basic",
"sql-check-basic-tooltip": "Syntax check, connection check",
"sql-check-advanced": "Advanced",
- "sql-check-advanced-tooltip": "Basic + Backward compatibility check",
+ "sql-check-advanced-tooltip": "Basic + Customized schema review rules",
"anomaly-detection": "Anomaly detection",
"anomaly-detection-basic": "Basic",
"anomaly-detection-basic-tooltip": "Connection failure, missing backup",
diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.json
index 4cac906989..1bb7eeb7cf 100644
--- a/frontend/src/locales/zh-CN.json
+++ b/frontend/src/locales/zh-CN.json
@@ -1253,9 +1253,9 @@
"title": "备份策略",
"desc": "「备份策略」可以根据指定的周期自动备份数据库"
},
- "bb-feature-backward-compatibility": {
- "title": "向后兼容",
- "desc": "MySQL 和 TiDB 支持检测 schema 变更是否向后兼容,可以通过@:{'subscription.upgrade'}来开启该功能。"
+ "bb-feature-schema-review-policy": {
+ "title": "Schema 审核策略",
+ "desc": "给不同的环境定制 schema 审核策略,可以通过@:{'subscription.upgrade'}来开启该功能。"
},
"bb-feature-rbac": {
"title": "角色管理",
@@ -1292,7 +1292,7 @@
"sql-check-basic": "基础",
"sql-check-basic-tooltip": "语法检查、数据库连接检查",
"sql-check-advanced": "高级",
- "sql-check-advanced-tooltip": "基础版功能 + 向后兼容性检查",
+ "sql-check-advanced-tooltip": "基础版功能 + 自定义 schema 审核规则",
"anomaly-detection": "异常检测",
"anomaly-detection-basic": "基础",
"anomaly-detection-basic-tooltip": "数据库连接异常、备份缺失",
diff --git a/frontend/src/types/plan.ts b/frontend/src/types/plan.ts
index 3c103ed716..c8c143b172 100644
--- a/frontend/src/types/plan.ts
+++ b/frontend/src/types/plan.ts
@@ -1,7 +1,7 @@
// Check api/plan.go to understand what each feature means.
export type FeatureType =
// Change Workflow
- | "bb.feature.backward-compatibility"
+ | "bb.feature.schema-review-policy"
| "bb.feature.schema-drift"
| "bb.feature.task-schedule-time"
| "bb.feature.multi-tenancy"
@@ -46,7 +46,7 @@ export interface Plan {
// so that it can be shared between frontend/backend.
export const FEATURE_MATRIX: Map<FeatureType, boolean[]> = new Map([
// Change Workflow
- ["bb.feature.backward-compatibility", [false, true, true]],
+ ["bb.feature.schema-review-policy", [false, true, true]],
["bb.feature.schema-drift", [false, true, true]],
["bb.feature.task-schedule-time", [false, true, true]],
["bb.feature.multi-tenancy", [false, true, true]],
@@ -100,9 +100,7 @@ export const FEATURE_SECTIONS = [
},
{
id: "branding",
- features: [
- "branding-logo",
- ],
+ features: ["branding-logo"],
},
];
diff --git a/server/server.go b/server/server.go
index e9fbd28ff5..ed62b0a867 100644
--- a/server/server.go
+++ b/server/server.go
@@ -203,8 +203,6 @@ func NewServer(ctx context.Context, prof Profile, logger *zap.Logger, loggerLeve
statementSimpleExecutor := NewTaskCheckStatementAdvisorSimpleExecutor(logger)
taskCheckScheduler.Register(string(api.TaskCheckDatabaseStatementFakeAdvise), statementSimpleExecutor)
taskCheckScheduler.Register(string(api.TaskCheckDatabaseStatementSyntax), statementSimpleExecutor)
- // TODO(ed): remove this after TaskCheckDatabaseStatementCompatibility is entirely moved into schema review policy
- taskCheckScheduler.Register(string(api.TaskCheckDatabaseStatementCompatibility), statementSimpleExecutor)
statementCompositeExecutor := NewTaskCheckStatementAdvisorCompositeExecutor(logger)
taskCheckScheduler.Register(string(api.TaskCheckDatabaseStatementAdvise), statementCompositeExecutor)
diff --git a/server/task.go b/server/task.go
index 278a28247e..3fe6c762e2 100644
--- a/server/task.go
+++ b/server/task.go
@@ -190,24 +190,6 @@ func (s *Server) registerTaskRoutes(g *echo.Group) {
)
}
- if s.feature(api.FeatureBackwardCompatibility) {
- _, err = s.store.CreateTaskCheckRunIfNeeded(ctx, &api.TaskCheckRunCreate{
- CreatorID: api.SystemBotID,
- TaskID: task.ID,
- Type: api.TaskCheckDatabaseStatementCompatibility,
- Payload: string(payload),
- SkipIfAlreadyTerminated: false,
- })
- if err != nil {
- // It's OK if we failed to trigger a check, just emit an error log
- s.l.Error("Failed to trigger compatibility check after changing task statement",
- zap.Int("task_id", task.ID),
- zap.String("task_name", task.Name),
- zap.Error(err),
- )
- }
- }
-
if s.feature(api.FeatureSchemaReviewPolicy) {
if err := s.triggerDatabaseStatementAdviseTask(ctx, *taskPatch.Statement, taskPatched); err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, fmt.Errorf("failed to trigger database statement advise task, err: %w", err)).SetInternal(err)
diff --git a/server/task_check_executor_statement_advisor_simple.go b/server/task_check_executor_statement_advisor_simple.go
index 85f38f15be..9d90d01305 100644
--- a/server/task_check_executor_statement_advisor_simple.go
+++ b/server/task_check_executor_statement_advisor_simple.go
@@ -31,12 +31,6 @@ func (exec *TaskCheckStatementAdvisorSimpleExecutor) Run(ctx context.Context, se
advisorType = advisor.Fake
case api.TaskCheckDatabaseStatementSyntax:
advisorType = advisor.MySQLSyntax
- case api.TaskCheckDatabaseStatementCompatibility:
- // TODO(ed): remove this after TaskCheckDatabaseStatementCompatibility is entirely moved into schema review policy
- if !server.feature(api.FeatureBackwardCompatibility) {
- return nil, common.Errorf(common.NotAuthorized, fmt.Errorf(api.FeatureBackwardCompatibility.AccessErrorMessage()))
- }
- advisorType = advisor.MySQLMigrationCompatibility
}
payload := &api.TaskCheckDatabaseStatementAdvisePayload{}
diff --git a/server/task_check_scheduler.go b/server/task_check_scheduler.go
index 141d44d699..e8f64047fd 100644
--- a/server/task_check_scheduler.go
+++ b/server/task_check_scheduler.go
@@ -315,20 +315,6 @@ func (s *TaskCheckScheduler) ScheduleCheckIfNeeded(ctx context.Context, task *ap
if err != nil {
return nil, err
}
-
- // TODO(ed): remove this after TaskCheckDatabaseStatementCompatibility is entirely moved into schema review policy
- if s.server.feature(api.FeatureBackwardCompatibility) {
- _, err = s.server.store.CreateTaskCheckRunIfNeeded(ctx, &api.TaskCheckRunCreate{
- CreatorID: creatorID,
- TaskID: task.ID,
- Type: api.TaskCheckDatabaseStatementCompatibility,
- Payload: string(payload),
- SkipIfAlreadyTerminated: skipIfAlreadyTerminated,
- })
- if err != nil {
- return nil, err
- }
- }
}
if s.server.feature(api.FeatureSchemaReviewPolicy) &&
diff --git a/server/task_scheduler.go b/server/task_scheduler.go
index c70b430483..5074a6fbdf 100644
--- a/server/task_scheduler.go
+++ b/server/task_scheduler.go
@@ -282,17 +282,6 @@ func (s *TaskScheduler) ScheduleIfNeeded(ctx context.Context, task *api.Task) (*
return task, nil
}
- // TODO(ed): remove this after TaskCheckDatabaseStatementCompatibility is entirely moved into schema review policy
- if s.server.feature(api.FeatureBackwardCompatibility) {
- pass, err = s.server.passCheck(ctx, s.server, task, api.TaskCheckDatabaseStatementCompatibility)
- if err != nil {
- return nil, err
- }
- if !pass {
- return task, nil
- }
- }
-
if s.server.feature(api.FeatureSchemaReviewPolicy) {
pass, err = s.server.passCheck(ctx, s.server, task, api.TaskCheckDatabaseStatementAdvise)
if err != nil {