Skip to content

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

chore: consolidate feature matrix between frontend and backend @tianzhou (#3119)

Tianzhou (天舟)06ffc9d5dd62
diff --git a/api/plan.go b/api/plan.go
index 2b11be0b0c..da6d064051 100644
--- a/api/plan.go
+++ b/api/plan.go
@@ -34,29 +34,27 @@ func (p PlanType) String() string {
type FeatureType string
const (
- // Change Workflow.
+ // Admin & Security.
- // FeatureSchemaDrift detects if there occurs schema drift.
- // See https://bytebase.com/docs/features/drift-detection
- FeatureSchemaDrift FeatureType = "bb.feature.schema-drift"
- // FeatureTaskScheduleTime allows user to run task at a scheduled time.
- FeatureTaskScheduleTime FeatureType = "bb.feature.task-schedule-time"
- // FeatureLGTM checks LGTM comments.
- FeatureLGTM FeatureType = "bb.feature.lgtm"
- // FeatureMultiTenancy allows user to enable tenant mode for the project.
+ // Feature3rdPartyAuth allows user to authenticate (login) and authorize (sync project member)
//
- // Tenant mode allows user to track a group of homogeneous database changes together.
- // e.g. A game studio may deploy many servers, each server is fully isolated with its
- // own database. When a new game version is released, it may require to upgrade the
- // underlying database schema, then tenant mode will help the studio to track the
- // schema change across all databases.
- FeatureMultiTenancy FeatureType = "bb.feature.multi-tenancy"
- // FeatureDBAWorkflow enforces the DBA workflow.
+ // Currently, we only support GitLab EE/CE auth.
+ Feature3rdPartyAuth FeatureType = "bb.feature.3rd-party-auth"
+ // FeatureRBAC enables RBAC.
//
- // - Developers can't create and view instances since they are exclusively by DBA, they can
- // only access database.
- // - Developers can submit troubleshooting issue.
- FeatureDBAWorkflow FeatureType = "bb.feature.dba-workflow"
+ // - Workspace level RBAC
+ // - Project level RBAC.
+ FeatureRBAC FeatureType = "bb.feature.rbac"
+
+ // Branding.
+
+ // FeatureBranding enables customized branding.
+ //
+ // Currently, we only support customizing the logo.
+ FeatureBranding FeatureType = "bb.feature.branding"
+
+ // Change Workflow.
+
// FeatureDataSource exposes the data source concept.
//
// Currently, we DO NOT expose this feature.
@@ -68,15 +66,43 @@ const (
// in turns belongs to the instance.
// - Support defining extra data source for a database and exposing the related data source UI.
FeatureDataSource FeatureType = "bb.feature.data-source"
+ // FeatureDBAWorkflow enforces the DBA workflow.
+ //
+ // - Developers can't create and view instances since they are exclusively by DBA, they can
+ // only access database.
+ // - Developers can submit troubleshooting issue.
+ FeatureDBAWorkflow FeatureType = "bb.feature.dba-workflow"
+ // FeatureLGTM checks LGTM comments.
+ FeatureLGTM FeatureType = "bb.feature.lgtm"
+ // FeatureMultiTenancy allows user to enable tenant mode for the project.
+ //
+ // Tenant mode allows user to track a group of homogeneous database changes together.
+ // e.g. A game studio may deploy many servers, each server is fully isolated with its
+ // own database. When a new game version is released, it may require to upgrade the
+ // underlying database schema, then tenant mode will help the studio to track the
+ // schema change across all databases.
+ FeatureMultiTenancy FeatureType = "bb.feature.multi-tenancy"
+ // FeatureOnlineMigration allows user to perform online-migration.
+ FeatureOnlineMigration FeatureType = "bb.feature.online-migration"
+ // FeatureSchemaDrift detects if there occurs schema drift.
+ // See https://bytebase.com/docs/features/drift-detection
+ FeatureSchemaDrift FeatureType = "bb.feature.schema-drift"
+ // FeatureSQLReview allows user to specify schema policy for the environment
+ //
+ // e.g. One can configure rules for database schema or SQL query.
+ FeatureSQLReview FeatureType = "bb.feature.sql-review"
+ // FeatureTaskScheduleTime allows user to run task at a scheduled time.
+ FeatureTaskScheduleTime FeatureType = "bb.feature.task-schedule-time"
// FeatureVCSSQLReviewWorkflow allows user to enable the SQL review CI in VCS workflow.
FeatureVCSSQLReviewWorkflow FeatureType = "bb.feature.vcs-sql-review"
- // FeatureGhost allows user to use gh-ost for MySQL database migration.
- FeatureGhost FeatureType = "bb.feature.ghost"
+ // Database management.
// FeaturePITR allows user to perform point-in-time recovery for databases.
FeaturePITR FeatureType = "bb.feature.pitr"
-
+ // FeatureReadReplicaConnection allows user to set a read replica connection
+ // including host and port to data source.
+ FeatureReadReplicaConnection FeatureType = "bb.feature.read-replica-connection"
// FeatureSyncSchema allows user to sync the base database schema into target database.
FeatureSyncSchema FeatureType = "bb.feature.sync-schema"
@@ -92,79 +118,56 @@ const (
// e.g. One can configure to NOT require backup for dev environment while require
// weekly backup for staging and daily backup for production.
FeatureBackupPolicy FeatureType = "bb.feature.backup-policy"
- // FeatureSQLReviewPolicy allows user to specify schema policy for the environment
- //
- // e.g. One can configure rules for database schema or SQL query.
- FeatureSQLReviewPolicy FeatureType = "bb.feature.sql-review"
// FeatureEnvironmentTierPolicy allows user to set the tier of an environment.
//
// e.g. set the tier to "PROTECTED" for the production environment.
- FeatureEnvironmentTierPolicy FeatureType = "bb.feature.environment-tier"
-
- // Admin & Security.
-
- // FeatureRBAC enables RBAC.
- //
- // - Workspace level RBAC
- // - Project level RBAC.
- FeatureRBAC FeatureType = "bb.feature.rbac"
-
- // Feature3rdPartyAuth allows user to authenticate (login) and authorize (sync project member)
- //
- // Currently, we only support GitLab EE/CE auth.
- Feature3rdPartyAuth FeatureType = "bb.feature.3rd-party-auth"
-
- // FeatureReadReplicaConnection allows user to set a read replica connection
- // including host and port to data source.
- FeatureReadReplicaConnection FeatureType = "bb.feature.read-replica-connection"
-
- // Branding.
-
- // FeatureBranding enables customized branding.
- //
- // Currently, we only support customizing the logo.
- FeatureBranding FeatureType = "bb.feature.branding"
+ FeatureEnvironmentTierPolicy FeatureType = "bb.feature.environment-tier-policy"
)
// Name returns a readable name of the feature.
func (e FeatureType) Name() string {
switch e {
- case FeatureSchemaDrift:
- return "Schema drift"
- case FeatureTaskScheduleTime:
- return "Task schedule time"
+ // Admin & Security
+ case Feature3rdPartyAuth:
+ return "3rd party auth"
+ case FeatureRBAC:
+ return "RBAC"
+ // Branding
+ case FeatureBranding:
+ return "Branding"
+ // Change Workflow
+ case FeatureDataSource:
+ return "Data source"
+ case FeatureDBAWorkflow:
+ return "DBA workflow"
case FeatureLGTM:
return "LGTM"
case FeatureMultiTenancy:
return "Multi-tenancy"
- case FeatureDBAWorkflow:
- return "DBA workflow"
- case FeatureDataSource:
- return "Data source"
- case FeatureGhost:
- return "gh-ost integration"
+ case FeatureOnlineMigration:
+ return "Online schema migration"
+ case FeatureSchemaDrift:
+ return "Schema drift"
+ case FeatureSQLReview:
+ return "SQL review"
+ case FeatureTaskScheduleTime:
+ return "Task schedule time"
+ case FeatureVCSSQLReviewWorkflow:
+ return "VCS SQL review workflow"
+ // Database management
case FeaturePITR:
return "Point-in-time Recovery"
+ case FeatureReadReplicaConnection:
+ return "Read replica connection"
case FeatureSyncSchema:
return "Synchronize Schema"
+ // Policy Control
case FeatureApprovalPolicy:
return "Approval policy"
case FeatureBackupPolicy:
return "Backup policy"
- case FeatureSQLReviewPolicy:
- return "SQL review policy"
- case FeatureRBAC:
- return "RBAC"
- case Feature3rdPartyAuth:
- return "3rd party auth"
- case FeatureReadReplicaConnection:
- return "Read replica connection"
- case FeatureBranding:
- return "Branding"
case FeatureEnvironmentTierPolicy:
return "Environment tier"
- case FeatureVCSSQLReviewWorkflow:
- return "VCS SQL review workflow"
}
return ""
}
@@ -188,24 +191,29 @@ 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{
- FeatureSchemaDrift: {false, true, true},
- FeatureTaskScheduleTime: {false, true, true},
- FeatureLGTM: {false, false, true},
- FeatureMultiTenancy: {false, false, true},
- FeatureDBAWorkflow: {false, false, true},
- FeatureDataSource: {false, false, false},
- FeatureGhost: {false, true, true},
+ // Admin & Security
+ Feature3rdPartyAuth: {false, true, true},
+ FeatureRBAC: {false, true, true},
+ // Branding
+ FeatureBranding: {false, false, true},
+ // Change Workflow
+ FeatureDataSource: {false, false, false},
+ FeatureDBAWorkflow: {false, false, true},
+ FeatureLGTM: {false, false, true},
+ FeatureMultiTenancy: {false, false, true},
+ FeatureOnlineMigration: {false, true, true},
+ FeatureSchemaDrift: {false, true, true},
+ FeatureSQLReview: {false, true, true},
+ FeatureTaskScheduleTime: {false, true, true},
+ FeatureVCSSQLReviewWorkflow: {false, false, true},
+ // Database management
FeaturePITR: {false, true, true},
+ FeatureReadReplicaConnection: {false, false, true},
FeatureSyncSchema: {false, false, true},
+ // Policy Control
FeatureApprovalPolicy: {false, true, true},
FeatureBackupPolicy: {false, true, true},
- FeatureSQLReviewPolicy: {false, true, true},
- FeatureRBAC: {false, true, true},
- Feature3rdPartyAuth: {false, true, true},
- FeatureReadReplicaConnection: {false, false, true},
- FeatureBranding: {false, false, true},
FeatureEnvironmentTierPolicy: {false, false, true},
- FeatureVCSSQLReviewWorkflow: {false, false, true},
}
// FeatureFlight is the flight map for features.
diff --git a/frontend/src/components/BackupTable.vue b/frontend/src/components/BackupTable.vue
index 7752f2be84..6ecd0072c0 100644
--- a/frontend/src/components/BackupTable.vue
+++ b/frontend/src/components/BackupTable.vue
@@ -148,7 +148,7 @@
<FeatureModal
v-if="state.showFeatureModal"
- feature="bb.feature.disaster-recovery-pitr"
+ feature="bb.feature.pitr"
@cancel="state.showFeatureModal = false"
/>
</template>
@@ -223,7 +223,7 @@ export default defineComponent({
return props.database.instance.engine === "POSTGRES";
});
- const hasPITRFeature = featureToRef("bb.feature.disaster-recovery-pitr");
+ const hasPITRFeature = featureToRef("bb.feature.pitr");
const EDIT_COLUMN_LIST: BBTableColumn[] = [
{
diff --git a/frontend/src/components/DatabaseBackup/RestoreTargetForm.vue b/frontend/src/components/DatabaseBackup/RestoreTargetForm.vue
index 93f98f2f00..45b2bfa44a 100644
--- a/frontend/src/components/DatabaseBackup/RestoreTargetForm.vue
+++ b/frontend/src/components/DatabaseBackup/RestoreTargetForm.vue
@@ -24,7 +24,7 @@
{{ $t("database.pitr.restore-to-in-place") }}
<FeatureBadge
- feature="bb.feature.disaster-recovery-pitr"
+ feature="bb.feature.pitr"
class="text-accent ml-1"
/>
</span>
diff --git a/frontend/src/components/DatabaseDetail/PITRRestoreButton.vue b/frontend/src/components/DatabaseDetail/PITRRestoreButton.vue
index 0bc573a7ed..faee301a23 100644
--- a/frontend/src/components/DatabaseDetail/PITRRestoreButton.vue
+++ b/frontend/src/components/DatabaseDetail/PITRRestoreButton.vue
@@ -18,7 +18,7 @@
<template #default="{ action }">
<span>{{ action.text }}</span>
<FeatureBadge
- feature="bb.feature.disaster-recovery-pitr"
+ feature="bb.feature.pitr"
class="text-accent ml-2 -mr-1"
/>
</template>
@@ -175,7 +175,7 @@
<FeatureModal
v-if="state.showFeatureModal"
- feature="bb.feature.disaster-recovery-pitr"
+ feature="bb.feature.pitr"
@cancel="state.showFeatureModal = false"
/>
</template>
@@ -238,7 +238,7 @@ const state = reactive<LocalState>({
const createDatabaseForm = ref<InstanceType<typeof CreatePITRDatabaseForm>>();
-const hasPITRFeature = featureToRef("bb.feature.disaster-recovery-pitr");
+const hasPITRFeature = featureToRef("bb.feature.pitr");
const timezone = computed(() => "UTC" + dayjs().format("ZZ"));
diff --git a/frontend/src/types/plan.ts b/frontend/src/types/plan.ts
index 1a061b069c..32b23c5cfd 100644
--- a/frontend/src/types/plan.ts
+++ b/frontend/src/types/plan.ts
@@ -3,29 +3,29 @@ import planData from "./plan.yaml";
// Check api/plan.go to understand what each feature means.
export type FeatureType =
- // Database management
- | "bb.feature.disaster-recovery-pitr"
- | "bb.feature.sync-schema"
+ // Admin & Security
+ | "bb.feature.3rd-party-auth"
+ | "bb.feature.rbac"
+ // Branding
+ | "bb.feature.branding"
// Change Workflow
- | "bb.feature.sql-review"
- | "bb.feature.schema-drift"
- | "bb.feature.task-schedule-time"
- | "bb.feature.multi-tenancy"
- | "bb.feature.dba-workflow"
| "bb.feature.data-source"
+ | "bb.feature.dba-workflow"
+ | "bb.feature.lgtm"
+ | "bb.feature.multi-tenancy"
| "bb.feature.online-migration"
+ | "bb.feature.schema-drift"
+ | "bb.feature.sql-review"
+ | "bb.feature.task-schedule-time"
| "bb.feature.vcs-sql-review"
+ // Database management
+ | "bb.feature.pitr"
+ | "bb.feature.read-replica-connection"
+ | "bb.feature.sync-schema"
// Policy Control
| "bb.feature.approval-policy"
| "bb.feature.backup-policy"
- | "bb.feature.environment-tier-policy"
- | "bb.feature.lgtm"
- // Admin & Security
- | "bb.feature.rbac"
- | "bb.feature.3rd-party-auth"
- | "bb.feature.read-replica-connection"
- // Branding
- | "bb.feature.branding";
+ | "bb.feature.environment-tier-policy";
export enum PlanType {
FREE = 0,
@@ -73,29 +73,29 @@ export interface Plan {
// TODO: fetch the matrix from the backend instead of duplicating it here or use a JSON/YAML file
// so that it can be shared between frontend/backend.
export const FEATURE_MATRIX: Map<FeatureType, boolean[]> = new Map([
- // Database management
- ["bb.feature.disaster-recovery-pitr", [false, true, true]],
- ["bb.feature.sync-schema", [false, false, true]],
+ // Admin & Security
+ ["bb.feature.3rd-party-auth", [false, true, true]],
+ ["bb.feature.rbac", [false, true, true]],
+ // Branding
+ ["bb.feature.branding", [false, false, true]],
// Change Workflow
- ["bb.feature.sql-review", [false, true, true]],
- ["bb.feature.schema-drift", [false, true, true]],
- ["bb.feature.task-schedule-time", [false, true, true]],
- ["bb.feature.multi-tenancy", [false, false, true]],
- ["bb.feature.dba-workflow", [false, false, true]],
["bb.feature.data-source", [false, false, false]],
+ ["bb.feature.dba-workflow", [false, false, true]],
+ ["bb.feature.lgtm", [false, false, true]],
+ ["bb.feature.multi-tenancy", [false, false, true]],
["bb.feature.online-migration", [false, true, true]],
+ ["bb.feature.schema-drift", [false, true, true]],
+ ["bb.feature.sql-review", [false, true, true]],
+ ["bb.feature.task-schedule-time", [false, true, true]],
["bb.feature.vcs-sql-review", [false, false, true]],
+ // Database management
+ ["bb.feature.pitr", [false, true, true]],
+ ["bb.feature.read-replica-connection", [false, false, true]],
+ ["bb.feature.sync-schema", [false, false, true]],
// Policy Control
["bb.feature.approval-policy", [false, true, true]],
["bb.feature.backup-policy", [false, true, true]],
["bb.feature.environment-tier-policy", [false, false, true]],
- ["bb.feature.lgtm", [false, false, true]],
- // Admin & Security
- ["bb.feature.rbac", [false, true, true]],
- ["bb.feature.3rd-party-auth", [false, true, true]],
- ["bb.feature.read-replica-connection", [false, false, true]],
- // Branding
- ["bb.feature.branding", [false, false, true]],
]);
export const FEATURE_SECTIONS: { type: string; featureList: string[] }[] =
diff --git a/server/issue.go b/server/issue.go
index 22d91f6a4c..f3080d645f 100644
--- a/server/issue.go
+++ b/server/issue.go
@@ -771,8 +771,8 @@ func (s *Server) getPipelineCreateForDatabaseSchemaAndDataUpdate(ctx context.Con
}
func (s *Server) getPipelineCreateForDatabaseSchemaUpdateGhost(ctx context.Context, issueCreate *api.IssueCreate) (*api.PipelineCreate, error) {
- if !s.feature(api.FeatureGhost) {
- return nil, echo.NewHTTPError(http.StatusForbidden, api.FeatureGhost.AccessErrorMessage())
+ if !s.feature(api.FeatureOnlineMigration) {
+ return nil, echo.NewHTTPError(http.StatusForbidden, api.FeatureOnlineMigration.AccessErrorMessage())
}
c := api.UpdateSchemaGhostContext{}
if err := json.Unmarshal([]byte(issueCreate.CreateContext), &c); err != nil {