Skip to content

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

refactor: replace migrate_type with enable_ghost in store layer (#18248)

p0nyb48bcb4f65e9
diff --git a/backend/api/v1/plan_service.go b/backend/api/v1/plan_service.go
index ce63e169c9..d0de29d606 100644
--- a/backend/api/v1/plan_service.go
+++ b/backend/api/v1/plan_service.go
@@ -512,13 +512,12 @@ func (s *PlanService) UpdatePlan(ctx context.Context, request *connect.Request[v
return nil, connect.NewError(connect.CodeInternal, errors.Errorf("failed to get task type from spec, err: %v", err))
}
- // Check if migrate_type changed for DATABASE_MIGRATE tasks
+ // Check if enable_ghost changed for DATABASE_MIGRATE tasks
if newTaskType == storepb.Task_DATABASE_MIGRATE && task.Type == storepb.Task_DATABASE_MIGRATE {
- // Get MigrationType from spec
if config, ok := spec.Config.(*v1pb.Plan_Spec_ChangeDatabaseConfig); ok {
- newMigrateType := getMigrateTypeFromMigrationType(config.ChangeDatabaseConfig.MigrationType)
- if newMigrateType != task.Payload.GetMigrateType() {
- taskPatch.MigrateType = &newMigrateType
+ newEnableGhost := config.ChangeDatabaseConfig.MigrationType == v1pb.MigrationType_GHOST
+ if newEnableGhost != task.Payload.GetEnableGhost() {
+ taskPatch.EnableGhost = &newEnableGhost
doUpdate = true
}
}
@@ -529,8 +528,8 @@ func (s *PlanService) UpdatePlan(ctx context.Context, request *connect.Request[v
// Allow DATABASE_MIGRATE <-> DATABASE_SDL conversion
if newTaskType == storepb.Task_DATABASE_MIGRATE {
if config, ok := spec.Config.(*v1pb.Plan_Spec_ChangeDatabaseConfig); ok {
- newMigrateType := getMigrateTypeFromMigrationType(config.ChangeDatabaseConfig.MigrationType)
- taskPatch.MigrateType = &newMigrateType
+ newEnableGhost := config.ChangeDatabaseConfig.MigrationType == v1pb.MigrationType_GHOST
+ taskPatch.EnableGhost = &newEnableGhost
doUpdate = true
}
}
diff --git a/backend/api/v1/plan_service_converter.go b/backend/api/v1/plan_service_converter.go
index fbf89247e3..fbd1d8b2dd 100644
--- a/backend/api/v1/plan_service_converter.go
+++ b/backend/api/v1/plan_service_converter.go
@@ -117,9 +117,10 @@ func convertToPlanSpecChangeDatabaseConfig(config *storepb.PlanConfig_Spec_Chang
Sheet: c.Sheet,
Release: c.Release,
Type: convertToPlanSpecChangeDatabaseConfigType(c.Type),
- MigrationType: convertToPlanSpecMigrationType(c.MigrateType),
+ MigrationType: convertToV1MigrationType(c.EnableGhost),
GhostFlags: c.GhostFlags,
EnablePriorBackup: c.EnablePriorBackup,
+ EnableGhost: c.EnableGhost,
},
}
}
@@ -137,17 +138,12 @@ func convertToPlanSpecChangeDatabaseConfigType(t storepb.PlanConfig_ChangeDataba
}
}
-func convertToPlanSpecMigrationType(t storepb.MigrationType) v1pb.MigrationType {
- switch t {
- case storepb.MigrationType_DDL:
- return v1pb.MigrationType_DDL
- case storepb.MigrationType_GHOST:
+// convertToV1MigrationType converts store layer enable_ghost to API MigrationType.
+func convertToV1MigrationType(enableGhost bool) v1pb.MigrationType {
+ if enableGhost {
return v1pb.MigrationType_GHOST
- case storepb.MigrationType_DML:
- return v1pb.MigrationType_DML
- default:
- return v1pb.MigrationType_MIGRATION_TYPE_UNSPECIFIED
}
+ return v1pb.MigrationType_DDL
}
func convertToPlanSpecExportDataConfig(config *storepb.PlanConfig_Spec_ExportDataConfig) *v1pb.Plan_Spec_ExportDataConfig {
@@ -261,18 +257,8 @@ func convertPlanSpecChangeDatabaseConfig(config *v1pb.Plan_Spec_ChangeDatabaseCo
storeType = storepb.PlanConfig_ChangeDatabaseConfig_TYPE_UNSPECIFIED
}
- // Convert v1 MigrationType to store MigrateType
- var storeMigrateType storepb.MigrationType
- switch c.MigrationType {
- case v1pb.MigrationType_DDL:
- storeMigrateType = storepb.MigrationType_DDL
- case v1pb.MigrationType_DML:
- storeMigrateType = storepb.MigrationType_DML
- case v1pb.MigrationType_GHOST:
- storeMigrateType = storepb.MigrationType_GHOST
- default:
- storeMigrateType = storepb.MigrationType_MIGRATION_TYPE_UNSPECIFIED
- }
+ // Convert v1 MigrationType to enable_ghost
+ enableGhost := c.MigrationType == v1pb.MigrationType_GHOST
return &storepb.PlanConfig_Spec_ChangeDatabaseConfig{
ChangeDatabaseConfig: &storepb.PlanConfig_ChangeDatabaseConfig{
@@ -280,9 +266,9 @@ func convertPlanSpecChangeDatabaseConfig(config *v1pb.Plan_Spec_ChangeDatabaseCo
Sheet: c.Sheet,
Release: c.Release,
Type: storeType,
- MigrateType: storeMigrateType,
GhostFlags: c.GhostFlags,
EnablePriorBackup: c.EnablePriorBackup,
+ EnableGhost: enableGhost,
},
}
}
diff --git a/backend/api/v1/plan_service_plan_check.go b/backend/api/v1/plan_service_plan_check.go
index b30f8c8924..1e743aeb02 100644
--- a/backend/api/v1/plan_service_plan_check.go
+++ b/backend/api/v1/plan_service_plan_check.go
@@ -88,13 +88,9 @@ func getPlanCheckRunsFromSpec(ctx context.Context, s *store.Store, plan *store.P
func getPlanCheckRunsFromChangeDatabaseConfigDatabaseGroupTarget(ctx context.Context, s *store.Store, plan *store.PlanMessage, config *storepb.PlanConfig_ChangeDatabaseConfig) ([]*store.PlanCheckRunMessage, error) {
switch config.Type {
case storepb.PlanConfig_ChangeDatabaseConfig_MIGRATE:
- // Only DDL, DML, and MIGRATE_TYPE_UNSPECIFIED (treated as DDL) migrate types are supported for database group targets
- switch config.MigrateType {
- case storepb.MigrationType_DDL:
- case storepb.MigrationType_DML:
- case storepb.MigrationType_MIGRATION_TYPE_UNSPECIFIED:
- default:
- return nil, errors.Errorf("unsupported migrate type %q for database group target", config.MigrateType)
+ // Ghost migrations are not supported for database group targets
+ if config.EnableGhost {
+ return nil, errors.Errorf("ghost migration is not supported for database group target")
}
default:
return nil, errors.Errorf("unsupported change database config type %q for database group target", config.Type)
@@ -195,7 +191,7 @@ func getPlanCheckRunsFromChangeDatabaseConfigForDatabase(ctx context.Context, s
Type: store.PlanCheckDatabaseConnect,
Config: &storepb.PlanCheckRunConfig{
SheetUid: int32(sheetUID),
- ChangeDatabaseType: convertToChangeDatabaseType(config.Type, config.MigrateType),
+ ChangeDatabaseType: convertToChangeDatabaseType(config.Type, config.EnableGhost),
InstanceId: instance.ResourceID,
DatabaseName: database.DatabaseName,
},
@@ -207,7 +203,7 @@ func getPlanCheckRunsFromChangeDatabaseConfigForDatabase(ctx context.Context, s
Type: store.PlanCheckDatabaseStatementAdvise,
Config: &storepb.PlanCheckRunConfig{
SheetUid: int32(sheetUID),
- ChangeDatabaseType: convertToChangeDatabaseType(config.Type, config.MigrateType),
+ ChangeDatabaseType: convertToChangeDatabaseType(config.Type, config.EnableGhost),
InstanceId: instance.ResourceID,
DatabaseName: database.DatabaseName,
EnablePriorBackup: config.EnablePriorBackup,
@@ -219,19 +215,19 @@ func getPlanCheckRunsFromChangeDatabaseConfigForDatabase(ctx context.Context, s
Type: store.PlanCheckDatabaseStatementSummaryReport,
Config: &storepb.PlanCheckRunConfig{
SheetUid: int32(sheetUID),
- ChangeDatabaseType: convertToChangeDatabaseType(config.Type, config.MigrateType),
+ ChangeDatabaseType: convertToChangeDatabaseType(config.Type, config.EnableGhost),
InstanceId: instance.ResourceID,
DatabaseName: database.DatabaseName,
},
})
- if config.Type == storepb.PlanConfig_ChangeDatabaseConfig_MIGRATE && config.MigrateType == storepb.MigrationType_GHOST {
+ if config.Type == storepb.PlanConfig_ChangeDatabaseConfig_MIGRATE && config.EnableGhost {
planCheckRuns = append(planCheckRuns, &store.PlanCheckRunMessage{
PlanUID: plan.UID,
Status: store.PlanCheckRunStatusRunning,
Type: store.PlanCheckDatabaseGhostSync,
Config: &storepb.PlanCheckRunConfig{
SheetUid: int32(sheetUID),
- ChangeDatabaseType: convertToChangeDatabaseType(config.Type, config.MigrateType),
+ ChangeDatabaseType: convertToChangeDatabaseType(config.Type, config.EnableGhost),
InstanceId: instance.ResourceID,
DatabaseName: database.DatabaseName,
GhostFlags: config.GhostFlags,
@@ -242,19 +238,13 @@ func getPlanCheckRunsFromChangeDatabaseConfigForDatabase(ctx context.Context, s
return planCheckRuns, nil
}
-func convertToChangeDatabaseType(t storepb.PlanConfig_ChangeDatabaseConfig_Type, migrateType storepb.MigrationType) storepb.PlanCheckRunConfig_ChangeDatabaseType {
+func convertToChangeDatabaseType(t storepb.PlanConfig_ChangeDatabaseConfig_Type, enableGhost bool) storepb.PlanCheckRunConfig_ChangeDatabaseType {
switch t {
case storepb.PlanConfig_ChangeDatabaseConfig_MIGRATE:
- switch migrateType {
- case storepb.MigrationType_DDL:
- return storepb.PlanCheckRunConfig_DDL
- case storepb.MigrationType_GHOST:
+ if enableGhost {
return storepb.PlanCheckRunConfig_DDL_GHOST
- case storepb.MigrationType_DML:
- return storepb.PlanCheckRunConfig_DML
- default:
- return storepb.PlanCheckRunConfig_CHANGE_DATABASE_TYPE_UNSPECIFIED
}
+ return storepb.PlanCheckRunConfig_DDL
case storepb.PlanConfig_ChangeDatabaseConfig_SDL:
return storepb.PlanCheckRunConfig_SDL
default:
diff --git a/backend/api/v1/rollout_service_converter.go b/backend/api/v1/rollout_service_converter.go
index 431c00b87c..7423a88716 100644
--- a/backend/api/v1/rollout_service_converter.go
+++ b/backend/api/v1/rollout_service_converter.go
@@ -306,15 +306,8 @@ func convertToTask(ctx context.Context, s *store.Store, project *store.ProjectMe
case storepb.Task_DATABASE_CREATE:
return convertToTaskFromDatabaseCreate(ctx, s, project, task)
case storepb.Task_DATABASE_MIGRATE:
- // Handle DATABASE_MIGRATE based on migrate_type
- switch task.Payload.GetMigrateType() {
- case storepb.MigrationType_DDL, storepb.MigrationType_GHOST, storepb.MigrationType_MIGRATION_TYPE_UNSPECIFIED:
- return convertToTaskFromSchemaUpdate(ctx, s, project, task)
- case storepb.MigrationType_DML:
- return convertToTaskFromDataUpdate(ctx, s, project, task)
- default:
- return nil, errors.Errorf("unsupported migrate type %v", task.Payload.GetMigrateType())
- }
+ // All DATABASE_MIGRATE tasks are treated as schema updates (DDL or GHOST)
+ return convertToTaskFromSchemaUpdate(ctx, s, project, task)
case storepb.Task_DATABASE_SDL:
return convertToTaskFromSchemaUpdate(ctx, s, project, task)
case storepb.Task_DATABASE_EXPORT:
@@ -380,12 +373,9 @@ func convertToTaskFromSchemaUpdate(ctx context.Context, s *store.Store, project
switch task.Type {
case storepb.Task_DATABASE_MIGRATE:
databaseChangeType = v1pb.DatabaseChangeType_MIGRATE
- switch task.Payload.GetMigrateType() {
- case storepb.MigrationType_DDL:
- migrationType = v1pb.MigrationType_DDL
- case storepb.MigrationType_GHOST:
+ if task.Payload.GetEnableGhost() {
migrationType = v1pb.MigrationType_GHOST
- default:
+ } else {
migrationType = v1pb.MigrationType_DDL
}
case storepb.Task_DATABASE_SDL:
@@ -420,47 +410,6 @@ func convertToTaskFromSchemaUpdate(ctx context.Context, s *store.Store, project
return v1pbTask, nil
}
-func convertToTaskFromDataUpdate(ctx context.Context, s *store.Store, project *store.ProjectMessage, task *store.TaskMessage) (*v1pb.Task, error) {
- if task.DatabaseName == nil {
- return nil, errors.Errorf("data update task database is nil")
- }
- database, err := s.GetDatabaseV2(ctx, &store.FindDatabaseMessage{InstanceID: &task.InstanceID, DatabaseName: task.DatabaseName, ShowDeleted: true})
- if err != nil {
- return nil, errors.Wrapf(err, "failed to get database")
- }
- if database == nil {
- return nil, errors.Errorf("database not found")
- }
-
- stageID := common.FormatStageID(task.Environment)
- v1pbTask := &v1pb.Task{
- Name: common.FormatTask(project.ResourceID, task.PipelineID, stageID, task.ID),
- SpecId: task.Payload.GetSpecId(),
- Type: convertToTaskType(task),
- Status: convertToTaskStatus(task.LatestTaskRunStatus, task.Payload.GetSkipped()),
- SkippedReason: task.Payload.GetSkippedReason(),
- Target: fmt.Sprintf("%s%s/%s%s", common.InstanceNamePrefix, database.InstanceID, common.DatabaseIDPrefix, database.DatabaseName),
- Payload: nil,
- }
- v1pbTaskPayload := &v1pb.Task_DatabaseUpdate_{
- DatabaseUpdate: &v1pb.Task_DatabaseUpdate{
- Sheet: common.FormatSheet(project.ResourceID, int(task.Payload.GetSheetId())),
- SchemaVersion: task.Payload.GetSchemaVersion(),
- DatabaseChangeType: v1pb.DatabaseChangeType_MIGRATE,
- MigrationType: v1pb.MigrationType_DML,
- },
- }
-
- v1pbTask.Payload = v1pbTaskPayload
- if task.UpdatedAt != nil {
- v1pbTask.UpdateTime = timestamppb.New(*task.UpdatedAt)
- }
- if task.RunAt != nil {
- v1pbTask.RunTime = timestamppb.New(*task.RunAt)
- }
- return v1pbTask, nil
-}
-
func convertToTaskFromDatabaseDataExport(ctx context.Context, s *store.Store, project *store.ProjectMessage, task *store.TaskMessage) (*v1pb.Task, error) {
if task.DatabaseName == nil {
return nil, errors.Errorf("data export task database is nil")
@@ -540,20 +489,6 @@ func convertToTaskType(task *store.TaskMessage) v1pb.Task_Type {
}
}
-// getMigrateTypeFromMigrationType converts v1pb.MigrationType to storepb.MigrationType
-func getMigrateTypeFromMigrationType(migrationType v1pb.MigrationType) storepb.MigrationType {
- switch migrationType {
- case v1pb.MigrationType_DDL:
- return storepb.MigrationType_DDL
- case v1pb.MigrationType_GHOST:
- return storepb.MigrationType_GHOST
- case v1pb.MigrationType_DML:
- return storepb.MigrationType_DML
- default:
- return storepb.MigrationType_MIGRATION_TYPE_UNSPECIFIED
- }
-}
-
func convertToTaskRunLog(parent string, logs []*store.TaskRunLog) *v1pb.TaskRunLog {
return &v1pb.TaskRunLog{
Name: fmt.Sprintf("%s/log", parent),
diff --git a/backend/api/v1/rollout_service_task.go b/backend/api/v1/rollout_service_task.go
index cd75e4638e..e183ac6ddd 100644
--- a/backend/api/v1/rollout_service_task.go
+++ b/backend/api/v1/rollout_service_task.go
@@ -301,22 +301,13 @@ func getTaskCreatesFromChangeDatabaseConfigDatabaseTarget(
env = *database.EffectiveEnvironmentID
}
- // Determine task migrate type from plan config migrate type
- var taskMigrateType storepb.MigrationType
+ // Handle ghost flags if ghost migration is enabled
var flags map[string]string
- switch c.MigrateType {
- case storepb.MigrationType_DDL:
- taskMigrateType = storepb.MigrationType_DDL
- case storepb.MigrationType_DML:
- taskMigrateType = storepb.MigrationType_DML
- case storepb.MigrationType_GHOST:
- taskMigrateType = storepb.MigrationType_GHOST
+ if c.EnableGhost {
if _, err := ghost.GetUserFlags(c.GhostFlags); err != nil {
return nil, errors.Wrapf(err, "invalid ghost flags %q", c.GhostFlags)
}
flags = c.GhostFlags
- default:
- taskMigrateType = storepb.MigrationType_DDL
}
taskCreate := &store.TaskMessage{
@@ -329,7 +320,7 @@ func getTaskCreatesFromChangeDatabaseConfigDatabaseTarget(
SheetId: int32(sheetUID),
Flags: flags,
EnablePriorBackup: c.EnablePriorBackup,
- MigrateType: taskMigrateType,
+ EnableGhost: c.EnableGhost,
},
}
return []*store.TaskMessage{taskCreate}, nil
@@ -431,38 +422,27 @@ func getTaskCreatesFromChangeDatabaseConfigWithRelease(
return nil, errors.Wrapf(err, "failed to get sheet id from sheet %q in release file %q", file.Sheet, file.Id)
}
- // Determine migrate type based on file change type
- var migrateType storepb.MigrationType
- switch file.MigrationType {
- case storepb.MigrationType_DDL:
- migrateType = storepb.MigrationType_DDL
- case storepb.MigrationType_GHOST:
- migrateType = storepb.MigrationType_GHOST
- case storepb.MigrationType_DML:
- migrateType = storepb.MigrationType_DML
- case storepb.MigrationType_MIGRATION_TYPE_UNSPECIFIED:
- migrateType = storepb.MigrationType_MIGRATION_TYPE_UNSPECIFIED
- default:
- return nil, errors.Errorf("unsupported release file migration type %q", file.MigrationType)
- }
+ // Determine if ghost migration based on file migration type
+ enableGhost := file.MigrationType == storepb.MigrationType_GHOST
// Create task payload
payload := &storepb.Task{
SpecId: spec.Id,
SheetId: int32(sheetUID),
SchemaVersion: file.Version,
- MigrateType: migrateType,
+ EnableGhost: enableGhost,
TaskReleaseSource: &storepb.TaskReleaseSource{
File: common.FormatReleaseFile(c.Release, file.Id),
},
}
// Add ghost flags if this is a ghost migration
- if migrateType == storepb.MigrationType_GHOST && c.GhostFlags != nil {
+ if enableGhost && c.GhostFlags != nil {
payload.Flags = c.GhostFlags
}
- if migrateType == storepb.MigrationType_DML {
+ // Enable prior backup for DML migrations
+ if file.MigrationType == storepb.MigrationType_DML {
payload.EnablePriorBackup = c.EnablePriorBackup
}
diff --git a/backend/common/risk.go b/backend/common/risk.go
index c7697824fc..2509b6d69f 100644
--- a/backend/common/risk.go
+++ b/backend/common/risk.go
@@ -1,3 +1,4 @@
+//nolint:revive
package common
import (
diff --git a/backend/generated-go/store/plan.pb.go b/backend/generated-go/store/plan.pb.go
index 9bcd791df8..cf7c6d9f11 100644
--- a/backend/generated-go/store/plan.pb.go
+++ b/backend/generated-go/store/plan.pb.go
@@ -355,16 +355,15 @@ type PlanConfig_ChangeDatabaseConfig struct {
Sheet string `protobuf:"bytes,2,opt,name=sheet,proto3" json:"sheet,omitempty"`
// The resource name of the release.
// Format: projects/{project}/releases/{release}
- Release string `protobuf:"bytes,9,opt,name=release,proto3" json:"release,omitempty"`
- Type PlanConfig_ChangeDatabaseConfig_Type `protobuf:"varint,3,opt,name=type,proto3,enum=bytebase.store.PlanConfig_ChangeDatabaseConfig_Type" json:"type,omitempty"`
- // The migration type for imperative schema migration.
- // It is only set when type is MIGRATE.
- MigrateType MigrationType `protobuf:"varint,11,opt,name=migrate_type,json=migrateType,proto3,enum=bytebase.store.MigrationType" json:"migrate_type,omitempty"`
- GhostFlags map[string]string `protobuf:"bytes,7,rep,name=ghost_flags,json=ghostFlags,proto3" json:"ghost_flags,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
+ Release string `protobuf:"bytes,9,opt,name=release,proto3" json:"release,omitempty"`
+ Type PlanConfig_ChangeDatabaseConfig_Type `protobuf:"varint,3,opt,name=type,proto3,enum=bytebase.store.PlanConfig_ChangeDatabaseConfig_Type" json:"type,omitempty"`
+ GhostFlags map[string]string `protobuf:"bytes,7,rep,name=ghost_flags,json=ghostFlags,proto3" json:"ghost_flags,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
// If set, a backup of the modified data will be created automatically before any changes are applied.
EnablePriorBackup bool `protobuf:"varint,8,opt,name=enable_prior_backup,json=enablePriorBackup,proto3" json:"enable_prior_backup,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
+ // Whether to use gh-ost for online schema migration.
+ EnableGhost bool `protobuf:"varint,12,opt,name=enable_ghost,json=enableGhost,proto3" json:"enable_ghost,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
}
func (x *PlanConfig_ChangeDatabaseConfig) Reset() {
@@ -425,13 +424,6 @@ func (x *PlanConfig_ChangeDatabaseConfig) GetType() PlanConfig_ChangeDatabaseCon
return PlanConfig_ChangeDatabaseConfig_TYPE_UNSPECIFIED
}
-func (x *PlanConfig_ChangeDatabaseConfig) GetMigrateType() MigrationType {
- if x != nil {
- return x.MigrateType
- }
- return MigrationType_MIGRATION_TYPE_UNSPECIFIED
-}
-
func (x *PlanConfig_ChangeDatabaseConfig) GetGhostFlags() map[string]string {
if x != nil {
return x.GhostFlags
@@ -446,6 +438,13 @@ func (x *PlanConfig_ChangeDatabaseConfig) GetEnablePriorBackup() bool {
return false
}
+func (x *PlanConfig_ChangeDatabaseConfig) GetEnableGhost() bool {
+ if x != nil {
+ return x.EnableGhost
+ }
+ return false
+}
+
type PlanConfig_ExportDataConfig struct {
state protoimpl.MessageState `protogen:"open.v1"`
// The list of targets.
@@ -634,7 +633,7 @@ var File_store_plan_proto protoreflect.FileDescriptor
const file_store_plan_proto_rawDesc = "" +
"\n" +
- "\x10store/plan.proto\x12\x0ebytebase.store\x1a\x1fgoogle/api/field_behavior.proto\x1a\x12store/common.proto\"\x9d\r\n" +
+ "\x10store/plan.proto\x12\x0ebytebase.store\x1a\x1fgoogle/api/field_behavior.proto\x1a\x12store/common.proto\"\xfe\f\n" +
"\n" +
"PlanConfig\x125\n" +
"\x05specs\x18\x01 \x03(\v2\x1f.bytebase.store.PlanConfig.SpecR\x05specs\x12E\n" +
@@ -655,17 +654,17 @@ const file_store_plan_proto_rawDesc = "" +
"\tcollation\x18\x05 \x01(\tB\x03\xe0A\x01R\tcollation\x12\x1d\n" +
"\acluster\x18\x06 \x01(\tB\x03\xe0A\x01R\acluster\x12\x19\n" +
"\x05owner\x18\a \x01(\tB\x03\xe0A\x01R\x05owner\x12%\n" +
- "\venvironment\x18\t \x01(\tB\x03\xe0A\x01R\venvironment\x1a\xf1\x03\n" +
+ "\venvironment\x18\t \x01(\tB\x03\xe0A\x01R\venvironment\x1a\xd2\x03\n" +
"\x14ChangeDatabaseConfig\x12\x18\n" +
"\atargets\x18\n" +
" \x03(\tR\atargets\x12\x14\n" +
"\x05sheet\x18\x02 \x01(\tR\x05sheet\x12\x18\n" +
"\arelease\x18\t \x01(\tR\arelease\x12H\n" +
- "\x04type\x18\x03 \x01(\x0e24.bytebase.store.PlanConfig.ChangeDatabaseConfig.TypeR\x04type\x12@\n" +
- "\fmigrate_type\x18\v \x01(\x0e2\x1d.bytebase.store.MigrationTypeR\vmigrateType\x12`\n" +
+ "\x04type\x18\x03 \x01(\x0e24.bytebase.store.PlanConfig.ChangeDatabaseConfig.TypeR\x04type\x12`\n" +
"\vghost_flags\x18\a \x03(\v2?.bytebase.store.PlanConfig.ChangeDatabaseConfig.GhostFlagsEntryR\n" +
"ghostFlags\x12.\n" +
- "\x13enable_prior_backup\x18\b \x01(\bR\x11enablePriorBackup\x1a=\n" +
+ "\x13enable_prior_backup\x18\b \x01(\bR\x11enablePriorBackup\x12!\n" +
+ "\fenable_ghost\x18\f \x01(\bR\venableGhost\x1a=\n" +
"\x0fGhostFlagsEntry\x12\x10\n" +
"\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" +
"\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"2\n" +
@@ -712,25 +711,23 @@ var file_store_plan_proto_goTypes = []any{
(*PlanConfig_Deployment)(nil), // 6: bytebase.store.PlanConfig.Deployment
nil, // 7: bytebase.store.PlanConfig.ChangeDatabaseConfig.GhostFlagsEntry
(*PlanConfig_Deployment_DatabaseGroupMapping)(nil), // 8: bytebase.store.PlanConfig.Deployment.DatabaseGroupMapping
- (MigrationType)(0), // 9: bytebase.store.MigrationType
- (ExportFormat)(0), // 10: bytebase.store.ExportFormat
+ (ExportFormat)(0), // 9: bytebase.store.ExportFormat
}
var file_store_plan_proto_depIdxs = []int32{
- 2, // 0: bytebase.store.PlanConfig.specs:type_name -> bytebase.store.PlanConfig.Spec
- 6, // 1: bytebase.store.PlanConfig.deployment:type_name -> bytebase.store.PlanConfig.Deployment
- 3, // 2: bytebase.store.PlanConfig.Spec.create_database_config:type_name -> bytebase.store.PlanConfig.CreateDatabaseConfig
- 4, // 3: bytebase.store.PlanConfig.Spec.change_database_config:type_name -> bytebase.store.PlanConfig.ChangeDatabaseConfig
- 5, // 4: bytebase.store.PlanConfig.Spec.export_data_config:type_name -> bytebase.store.PlanConfig.ExportDataConfig
- 0, // 5: bytebase.store.PlanConfig.ChangeDatabaseConfig.type:type_name -> bytebase.store.PlanConfig.ChangeDatabaseConfig.Type
- 9, // 6: bytebase.store.PlanConfig.ChangeDatabaseConfig.migrate_type:type_name -> bytebase.store.MigrationType
- 7, // 7: bytebase.store.PlanConfig.ChangeDatabaseConfig.ghost_flags:type_name -> bytebase.store.PlanConfig.ChangeDatabaseConfig.GhostFlagsEntry
- 10, // 8: bytebase.store.PlanConfig.ExportDataConfig.format:type_name -> bytebase.store.ExportFormat
- 8, // 9: bytebase.store.PlanConfig.Deployment.database_group_mappings:type_name -> bytebase.store.PlanConfig.Deployment.DatabaseGroupMapping
- 10, // [10:10] is the sub-list for method output_type
- 10, // [10:10] is the sub-list for method input_type
- 10, // [10:10] is the sub-list for extension type_name
- 10, // [10:10] is the sub-list for extension extendee
- 0, // [0:10] is the sub-list for field type_name
+ 2, // 0: bytebase.store.PlanConfig.specs:type_name -> bytebase.store.PlanConfig.Spec
+ 6, // 1: bytebase.store.PlanConfig.deployment:type_name -> bytebase.store.PlanConfig.Deployment
+ 3, // 2: bytebase.store.PlanConfig.Spec.create_database_config:type_name -> bytebase.store.PlanConfig.CreateDatabaseConfig
+ 4, // 3: bytebase.store.PlanConfig.Spec.change_database_config:type_name -> bytebase.store.PlanConfig.ChangeDatabaseConfig
+ 5, // 4: bytebase.store.PlanConfig.Spec.export_data_config:type_name -> bytebase.store.PlanConfig.ExportDataConfig
+ 0, // 5: bytebase.store.PlanConfig.ChangeDatabaseConfig.type:type_name -> bytebase.store.PlanConfig.ChangeDatabaseConfig.Type
+ 7, // 6: bytebase.store.PlanConfig.ChangeDatabaseConfig.ghost_flags:type_name -> bytebase.store.PlanConfig.ChangeDatabaseConfig.GhostFlagsEntry
+ 9, // 7: bytebase.store.PlanConfig.ExportDataConfig.format:type_name -> bytebase.store.ExportFormat
+ 8, // 8: bytebase.store.PlanConfig.Deployment.database_group_mappings:type_name -> bytebase.store.PlanConfig.Deployment.DatabaseGroupMapping
+ 9, // [9:9] is the sub-list for method output_type
+ 9, // [9:9] is the sub-list for method input_type
+ 9, // [9:9] is the sub-list for extension type_name
+ 9, // [9:9] is the sub-list for extension extendee
+ 0, // [0:9] is the sub-list for field type_name
}
func init() { file_store_plan_proto_init() }
diff --git a/backend/generated-go/store/plan_check_run.pb.go b/backend/generated-go/store/plan_check_run.pb.go
index bc843ba2bd..fbca490685 100644
--- a/backend/generated-go/store/plan_check_run.pb.go
+++ b/backend/generated-go/store/plan_check_run.pb.go
@@ -87,8 +87,10 @@ type PlanCheckRunConfig struct {
GhostFlags map[string]string `protobuf:"bytes,6,rep,name=ghost_flags,json=ghostFlags,proto3" json:"ghost_flags,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
// If set, a backup of the modified data will be created automatically before any changes are applied.
EnablePriorBackup bool `protobuf:"varint,7,opt,name=enable_prior_backup,json=enablePriorBackup,proto3" json:"enable_prior_backup,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
+ // Whether to use gh-ost for online schema migration.
+ EnableGhost bool `protobuf:"varint,8,opt,name=enable_ghost,json=enableGhost,proto3" json:"enable_ghost,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
}
func (x *PlanCheckRunConfig) Reset() {
@@ -163,6 +165,13 @@ func (x *PlanCheckRunConfig) GetEnablePriorBackup() bool {
return false
}
+func (x *PlanCheckRunConfig) GetEnableGhost() bool {
+ if x != nil {
+ return x.EnableGhost
+ }
+ return false
+}
+
type PlanCheckRunResult struct {
state protoimpl.MessageState `protogen:"open.v1"`
Results []*PlanCheckRunResult_Result `protobuf:"bytes,1,rep,name=results,proto3" json:"results,omitempty"`
@@ -447,7 +456,7 @@ var File_store_plan_check_run_proto protoreflect.FileDescriptor
const file_store_plan_check_run_proto_rawDesc = "" +
"\n" +
- "\x1astore/plan_check_run.proto\x12\x0ebytebase.store\x1a\x12store/advice.proto\x1a\x15store/changelog.proto\x1a\x12store/common.proto\"\x8a\x04\n" +
+ "\x1astore/plan_check_run.proto\x12\x0ebytebase.store\x1a\x12store/advice.proto\x1a\x15store/changelog.proto\x1a\x12store/common.proto\"\xad\x04\n" +
"\x12PlanCheckRunConfig\x12\x1b\n" +
"\tsheet_uid\x18\x01 \x01(\x05R\bsheetUid\x12g\n" +
"\x14change_database_type\x18\x02 \x01(\x0e25.bytebase.store.PlanCheckRunConfig.ChangeDatabaseTypeR\x12changeDatabaseType\x12\x1f\n" +
@@ -456,7 +465,8 @@ const file_store_plan_check_run_proto_rawDesc = "" +
"\rdatabase_name\x18\x04 \x01(\tR\fdatabaseName\x12S\n" +
"\vghost_flags\x18\x06 \x03(\v22.bytebase.store.PlanCheckRunConfig.GhostFlagsEntryR\n" +
"ghostFlags\x12.\n" +
- "\x13enable_prior_backup\x18\a \x01(\bR\x11enablePriorBackup\x1a=\n" +
+ "\x13enable_prior_backup\x18\a \x01(\bR\x11enablePriorBackup\x12!\n" +
+ "\fenable_ghost\x18\b \x01(\bR\venableGhost\x1a=\n" +
"\x0fGhostFlagsEntry\x12\x10\n" +
"\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" +
"\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"d\n" +
diff --git a/backend/generated-go/store/plan_check_run_equal.pb.go b/backend/generated-go/store/plan_check_run_equal.pb.go
index 6e44c04f23..708c92a652 100644
--- a/backend/generated-go/store/plan_check_run_equal.pb.go
+++ b/backend/generated-go/store/plan_check_run_equal.pb.go
@@ -37,6 +37,9 @@ func (x *PlanCheckRunConfig) Equal(y *PlanCheckRunConfig) bool {
if x.EnablePriorBackup != y.EnablePriorBackup {
return false
}
+ if x.EnableGhost != y.EnableGhost {
+ return false
+ }
return true
}
diff --git a/backend/generated-go/store/plan_equal.pb.go b/backend/generated-go/store/plan_equal.pb.go
index 48965b0f47..dfaff5fcc0 100644
--- a/backend/generated-go/store/plan_equal.pb.go
+++ b/backend/generated-go/store/plan_equal.pb.go
@@ -83,9 +83,6 @@ func (x *PlanConfig_ChangeDatabaseConfig) Equal(y *PlanConfig_ChangeDatabaseConf
if x.Type != y.Type {
return false
}
- if x.MigrateType != y.MigrateType {
- return false
- }
if len(x.GhostFlags) != len(y.GhostFlags) {
return false
}
@@ -101,6 +98,9 @@ func (x *PlanConfig_ChangeDatabaseConfig) Equal(y *PlanConfig_ChangeDatabaseConf
if x.EnablePriorBackup != y.EnablePriorBackup {
return false
}
+ if x.EnableGhost != y.EnableGhost {
+ return false
+ }
return true
}
diff --git a/backend/generated-go/store/task.pb.go b/backend/generated-go/store/task.pb.go
index a6cb201075..b19fe7bca4 100644
--- a/backend/generated-go/store/task.pb.go
+++ b/backend/generated-go/store/task.pb.go
@@ -108,10 +108,10 @@ type Task struct {
EnablePriorBackup bool `protobuf:"varint,11,opt,name=enable_prior_backup,json=enablePriorBackup,proto3" json:"enable_prior_backup,omitempty"`
// Configuration flags for gh-ost migration tool.
Flags map[string]string `protobuf:"bytes,12,rep,name=flags,proto3" json:"flags,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
+ // Whether to use gh-ost for online schema migration.
+ EnableGhost bool `protobuf:"varint,17,opt,name=enable_ghost,json=enableGhost,proto3" json:"enable_ghost,omitempty"`
// Source information if task is created from a release.
TaskReleaseSource *TaskReleaseSource `protobuf:"bytes,13,opt,name=task_release_source,json=taskReleaseSource,proto3" json:"task_release_source,omitempty"`
- // The type of migration (DDL, DML, or GHOST).
- MigrateType MigrationType `protobuf:"varint,16,opt,name=migrate_type,json=migrateType,proto3,enum=bytebase.store.MigrationType" json:"migrate_type,omitempty"`
// Password to encrypt the exported data archive.
Password string `protobuf:"bytes,14,opt,name=password,proto3" json:"password,omitempty"`
// Format of the exported data (SQL, CSV, JSON, etc).
@@ -234,18 +234,18 @@ func (x *Task) GetFlags() map[string]string {
return nil
}
-func (x *Task) GetTaskReleaseSource() *TaskReleaseSource {
+func (x *Task) GetEnableGhost() bool {
if x != nil {
- return x.TaskReleaseSource
+ return x.EnableGhost
}
- return nil
+ return false
}
-func (x *Task) GetMigrateType() MigrationType {
+func (x *Task) GetTaskReleaseSource() *TaskReleaseSource {
if x != nil {
- return x.MigrateType
+ return x.TaskReleaseSource
}
- return MigrationType_MIGRATION_TYPE_UNSPECIFIED
+ return nil
}
func (x *Task) GetPassword() string {
@@ -313,7 +313,7 @@ var File_store_task_proto protoreflect.FileDescriptor
const file_store_task_proto_rawDesc = "" +
"\n" +
- "\x10store/task.proto\x12\x0ebytebase.store\x1a\x12store/common.proto\"\xcd\x06\n" +
+ "\x10store/task.proto\x12\x0ebytebase.store\x1a\x12store/common.proto\"\xae\x06\n" +
"\x04Task\x12\x18\n" +
"\askipped\x18\x01 \x01(\bR\askipped\x12%\n" +
"\x0eskipped_reason\x18\x02 \x01(\tR\rskippedReason\x12\x17\n" +
@@ -328,9 +328,9 @@ const file_store_task_proto_rawDesc = "" +
"\x0eschema_version\x18\n" +
" \x01(\tR\rschemaVersion\x12.\n" +
"\x13enable_prior_backup\x18\v \x01(\bR\x11enablePriorBackup\x125\n" +
- "\x05flags\x18\f \x03(\v2\x1f.bytebase.store.Task.FlagsEntryR\x05flags\x12Q\n" +
- "\x13task_release_source\x18\r \x01(\v2!.bytebase.store.TaskReleaseSourceR\x11taskReleaseSource\x12@\n" +
- "\fmigrate_type\x18\x10 \x01(\x0e2\x1d.bytebase.store.MigrationTypeR\vmigrateType\x12\x1a\n" +
+ "\x05flags\x18\f \x03(\v2\x1f.bytebase.store.Task.FlagsEntryR\x05flags\x12!\n" +
+ "\fenable_ghost\x18\x11 \x01(\bR\venableGhost\x12Q\n" +
+ "\x13task_release_source\x18\r \x01(\v2!.bytebase.store.TaskReleaseSourceR\x11taskReleaseSource\x12\x1a\n" +
"\bpassword\x18\x0e \x01(\tR\bpassword\x124\n" +
"\x06format\x18\x0f \x01(\x0e2\x1c.bytebase.store.ExportFormatR\x06format\x1a8\n" +
"\n" +
@@ -366,19 +366,17 @@ var file_store_task_proto_goTypes = []any{
(*Task)(nil), // 1: bytebase.store.Task
(*TaskReleaseSource)(nil), // 2: bytebase.store.TaskReleaseSource
nil, // 3: bytebase.store.Task.FlagsEntry
- (MigrationType)(0), // 4: bytebase.store.MigrationType
- (ExportFormat)(0), // 5: bytebase.store.ExportFormat
+ (ExportFormat)(0), // 4: bytebase.store.ExportFormat
}
var file_store_task_proto_depIdxs = []int32{
3, // 0: bytebase.store.Task.flags:type_name -> bytebase.store.Task.FlagsEntry
2, // 1: bytebase.store.Task.task_release_source:type_name -> bytebase.store.TaskReleaseSource
- 4, // 2: bytebase.store.Task.migrate_type:type_name -> bytebase.store.MigrationType
- 5, // 3: bytebase.store.Task.format:type_name -> bytebase.store.ExportFormat
- 4, // [4:4] is the sub-list for method output_type
- 4, // [4:4] is the sub-list for method input_type
- 4, // [4:4] is the sub-list for extension type_name
- 4, // [4:4] is the sub-list for extension extendee
- 0, // [0:4] is the sub-list for field type_name
+ 4, // 2: bytebase.store.Task.format:type_name -> bytebase.store.ExportFormat
+ 3, // [3:3] is the sub-list for method output_type
+ 3, // [3:3] is the sub-list for method input_type
+ 3, // [3:3] is the sub-list for extension type_name
+ 3, // [3:3] is the sub-list for extension extendee
+ 0, // [0:3] is the sub-list for field type_name
}
func init() { file_store_task_proto_init() }
diff --git a/backend/generated-go/store/task_equal.pb.go b/backend/generated-go/store/task_equal.pb.go
index 3b0a92f93e..791b532009 100644
--- a/backend/generated-go/store/task_equal.pb.go
+++ b/backend/generated-go/store/task_equal.pb.go
@@ -55,10 +55,10 @@ func (x *Task) Equal(y *Task) bool {
return false
}
}
- if !x.TaskReleaseSource.Equal(y.TaskReleaseSource) {
+ if x.EnableGhost != y.EnableGhost {
return false
}
- if x.MigrateType != y.MigrateType {
+ if !x.TaskReleaseSource.Equal(y.TaskReleaseSource) {
return false
}
if x.Password != y.Password {
diff --git a/backend/generated-go/v1/plan_service.pb.go b/backend/generated-go/v1/plan_service.pb.go
index 60a0cc1472..a73c022e21 100644
--- a/backend/generated-go/v1/plan_service.pb.go
+++ b/backend/generated-go/v1/plan_service.pb.go
@@ -1393,8 +1393,10 @@ type Plan_ChangeDatabaseConfig struct {
GhostFlags map[string]string `protobuf:"bytes,7,rep,name=ghost_flags,json=ghostFlags,proto3" json:"ghost_flags,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
// If set, a backup of the modified data will be created automatically before any changes are applied.
EnablePriorBackup bool `protobuf:"varint,8,opt,name=enable_prior_backup,json=enablePriorBackup,proto3" json:"enable_prior_backup,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
+ // Whether to use gh-ost for online schema migration.
+ EnableGhost bool `protobuf:"varint,12,opt,name=enable_ghost,json=enableGhost,proto3" json:"enable_ghost,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
}
func (x *Plan_ChangeDatabaseConfig) Reset() {
@@ -1476,6 +1478,13 @@ func (x *Plan_ChangeDatabaseConfig) GetEnablePriorBackup() bool {
return false
}
+func (x *Plan_ChangeDatabaseConfig) GetEnableGhost() bool {
+ if x != nil {
+ return x.EnableGhost
+ }
+ return false
+}
+
type Plan_ExportDataConfig struct {
state protoimpl.MessageState `protogen:"open.v1"`
// The list of targets.
@@ -1922,7 +1931,7 @@ const file_v1_plan_service_proto_rawDesc = "" +
"\x04plan\x18\x01 \x01(\v2\x11.bytebase.v1.PlanB\x03\xe0A\x02R\x04plan\x12@\n" +
"\vupdate_mask\x18\x02 \x01(\v2\x1a.google.protobuf.FieldMaskB\x03\xe0A\x02R\n" +
"updateMask\x12#\n" +
- "\rallow_missing\x18\x03 \x01(\bR\fallowMissing\"\x93\x11\n" +
+ "\rallow_missing\x18\x03 \x01(\bR\fallowMissing\"\xb6\x11\n" +
"\x04Plan\x12\x12\n" +
"\x04name\x18\x01 \x01(\tR\x04name\x12(\n" +
"\x05state\x18\x02 \x01(\x0e2\x12.bytebase.v1.StateR\x05state\x12\x19\n" +
@@ -1958,7 +1967,7 @@ const file_v1_plan_service_proto_rawDesc = "" +
"\tcollation\x18\x05 \x01(\tB\x03\xe0A\x01R\tcollation\x12\x1d\n" +
"\acluster\x18\x06 \x01(\tB\x03\xe0A\x01R\acluster\x12\x19\n" +
"\x05owner\x18\a \x01(\tB\x03\xe0A\x01R\x05owner\x12%\n" +
- "\venvironment\x18\t \x01(\tB\x03\xe0A\x01R\venvironment\x1a\xc7\x03\n" +
+ "\venvironment\x18\t \x01(\tB\x03\xe0A\x01R\venvironment\x1a\xea\x03\n" +
"\x14ChangeDatabaseConfig\x12\x18\n" +
"\atargets\x18\n" +
" \x03(\tR\atargets\x12\x14\n" +
@@ -1969,7 +1978,8 @@ const file_v1_plan_service_proto_rawDesc = "" +
"\x0emigration_type\x18\v \x01(\x0e2\x1a.bytebase.v1.MigrationTypeR\rmigrationType\x12W\n" +
"\vghost_flags\x18\a \x03(\v26.bytebase.v1.Plan.ChangeDatabaseConfig.GhostFlagsEntryR\n" +
"ghostFlags\x12.\n" +
- "\x13enable_prior_backup\x18\b \x01(\bR\x11enablePriorBackup\x1a=\n" +
+ "\x13enable_prior_backup\x18\b \x01(\bR\x11enablePriorBackup\x12!\n" +
+ "\fenable_ghost\x18\f \x01(\bR\venableGhost\x1a=\n" +
"\x0fGhostFlagsEntry\x12\x10\n" +
"\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" +
"\x05value\x18\x02 \x01(\tR\x05value:\x028\x01J\x04\b\x05\x10\x06J\x04\b\x06\x10\a\x1a\xa3\x01\n" +
diff --git a/backend/generated-go/v1/plan_service_equal.pb.go b/backend/generated-go/v1/plan_service_equal.pb.go
index 4a5dd6af00..d21b6fe885 100644
--- a/backend/generated-go/v1/plan_service_equal.pb.go
+++ b/backend/generated-go/v1/plan_service_equal.pb.go
@@ -241,6 +241,9 @@ func (x *Plan_ChangeDatabaseConfig) Equal(y *Plan_ChangeDatabaseConfig) bool {
if x.EnablePriorBackup != y.EnablePriorBackup {
return false
}
+ if x.EnableGhost != y.EnableGhost {
+ return false
+ }
return true
}
diff --git a/backend/migrator/migration/3.13/0003##migrate_ghost_type_to_enable_ghost.sql b/backend/migrator/migration/3.13/0003##migrate_ghost_type_to_enable_ghost.sql
new file mode 100644
index 0000000000..ca7632078d
--- /dev/null
+++ b/backend/migrator/migration/3.13/0003##migrate_ghost_type_to_enable_ghost.sql
@@ -0,0 +1,47 @@
+-- Migrate task payloads: convert migrateType="GHOST" to enableGhost=true
+UPDATE task
+SET payload = payload || '{"enableGhost": true}'
+WHERE payload->>'migrateType' = 'GHOST';
+
+-- Migrate plan config: set enableGhost=true in changeDatabaseConfig where migrateType="GHOST"
+UPDATE plan
+SET config = (
+ SELECT jsonb_set(
+ config,
+ '{steps}',
+ (
+ SELECT jsonb_agg(
+ CASE
+ WHEN step->'specs' IS NOT NULL THEN
+ jsonb_set(
+ step,
+ '{specs}',
+ (
+ SELECT jsonb_agg(
+ CASE
+ WHEN spec->'changeDatabaseConfig'->>'migrateType' = 'GHOST' THEN
+ jsonb_set(
+ spec,
+ '{changeDatabaseConfig,enableGhost}',
+ 'true'::jsonb
+ )
+ ELSE spec
+ END
+ )
+ FROM jsonb_array_elements(step->'specs') AS spec
+ )
+ )
+ ELSE step
+ END
+ )
+ FROM jsonb_array_elements(config->'steps') AS step
+ )
+ )
+)
+WHERE config->'steps' IS NOT NULL
+ AND EXISTS (
+ SELECT 1
+ FROM jsonb_array_elements(config->'steps') AS step,
+ jsonb_array_elements(step->'specs') AS spec
+ WHERE spec->'changeDatabaseConfig'->>'migrateType' = 'GHOST'
+);
diff --git a/backend/migrator/migrator_test.go b/backend/migrator/migrator_test.go
index cbafbaa0ef..d2fc906acc 100644
--- a/backend/migrator/migrator_test.go
+++ b/backend/migrator/migrator_test.go
@@ -12,7 +12,7 @@ import (
func TestLatestVersion(t *testing.T) {
files, err := getSortedVersionedFiles()
require.NoError(t, err)
- require.Equal(t, semver.MustParse("3.13.2"), *files[len(files)-1].version)
+ require.Equal(t, semver.MustParse("3.13.3"), *files[len(files)-1].version)
}
func TestVersionUnique(t *testing.T) {
diff --git a/backend/runner/approval/runner.go b/backend/runner/approval/runner.go
index 19363c0b76..02da96f70e 100644
--- a/backend/runner/approval/runner.go
+++ b/backend/runner/approval/runner.go
@@ -675,23 +675,12 @@ func (r *Runner) getDatabaseMap(ctx context.Context, databases []string) (map[st
// This is used after the risk layer removal to directly filter approval rules by source.
func getApprovalSourceFromPlan(config *storepb.PlanConfig) storepb.WorkspaceApprovalSetting_Rule_Source {
for _, spec := range config.GetSpecs() {
- switch v := spec.Config.(type) {
+ switch spec.Config.(type) {
case *storepb.PlanConfig_Spec_CreateDatabaseConfig:
return storepb.WorkspaceApprovalSetting_Rule_CREATE_DATABASE
case *storepb.PlanConfig_Spec_ChangeDatabaseConfig:
- switch v.ChangeDatabaseConfig.Type {
- case storepb.PlanConfig_ChangeDatabaseConfig_MIGRATE:
- switch v.ChangeDatabaseConfig.MigrateType {
- case storepb.MigrationType_DML:
- return storepb.WorkspaceApprovalSetting_Rule_DML
- default:
- return storepb.WorkspaceApprovalSetting_Rule_DDL
- }
- case storepb.PlanConfig_ChangeDatabaseConfig_SDL:
- return storepb.WorkspaceApprovalSetting_Rule_DDL
- default:
- return storepb.WorkspaceApprovalSetting_Rule_DDL
- }
+ // All DATABASE_MIGRATE and SDL operations use DDL approval rules
+ return storepb.WorkspaceApprovalSetting_Rule_DDL
case *storepb.PlanConfig_Spec_ExportDataConfig:
return storepb.WorkspaceApprovalSetting_Rule_EXPORT_DATA
}
diff --git a/backend/runner/taskrun/database_migrate_executor.go b/backend/runner/taskrun/database_migrate_executor.go
index a15d51e8b5..1501c4aabd 100644
--- a/backend/runner/taskrun/database_migrate_executor.go
+++ b/backend/runner/taskrun/database_migrate_executor.go
@@ -55,17 +55,10 @@ type DatabaseMigrateExecutor struct {
// RunOnce will run the database migration task executor once.
func (exec *DatabaseMigrateExecutor) RunOnce(ctx context.Context, driverCtx context.Context, task *store.TaskMessage, taskRunUID int) (bool, *storepb.TaskRunResult, error) {
- migrateType := task.Payload.GetMigrateType()
-
- //exhaustive:enforce
- switch migrateType {
- case storepb.MigrationType_DDL, storepb.MigrationType_DML, storepb.MigrationType_MIGRATION_TYPE_UNSPECIFIED:
- return exec.runMigrationWithPriorBackup(ctx, driverCtx, task, taskRunUID)
- case storepb.MigrationType_GHOST:
+ if task.Payload.GetEnableGhost() {
return exec.runGhostMigration(ctx, driverCtx, task, taskRunUID)
- default:
- return false, nil, errors.Errorf("unsupported migrate type: %v", migrateType)
}
+ return exec.runMigrationWithPriorBackup(ctx, driverCtx, task, taskRunUID)
}
func (exec *DatabaseMigrateExecutor) runMigrationWithPriorBackup(ctx context.Context, driverCtx context.Context, task *store.TaskMessage, taskRunUID int) (bool, *storepb.TaskRunResult, error) {
diff --git a/backend/runner/taskrun/executor.go b/backend/runner/taskrun/executor.go
index 2f27fabe36..d67e104d24 100644
--- a/backend/runner/taskrun/executor.go
+++ b/backend/runner/taskrun/executor.go
@@ -624,19 +624,11 @@ func convertTaskType(t *store.TaskMessage) (storepb.ChangelogPayload_Type, store
//exhaustive:enforce
switch t.Type {
case storepb.Task_DATABASE_MIGRATE:
- // Determine migration type based on migrate_type
- switch t.Payload.GetMigrateType() {
- case storepb.MigrationType_DML:
- return storepb.ChangelogPayload_MIGRATE, storepb.MigrationType_DML
- case storepb.MigrationType_DDL:
- return storepb.ChangelogPayload_MIGRATE, storepb.MigrationType_DDL
- case storepb.MigrationType_GHOST:
+ // Determine migration type based on enable_ghost
+ if t.Payload.GetEnableGhost() {
return storepb.ChangelogPayload_MIGRATE, storepb.MigrationType_GHOST
- case storepb.MigrationType_MIGRATION_TYPE_UNSPECIFIED:
- return storepb.ChangelogPayload_MIGRATE, storepb.MigrationType_MIGRATION_TYPE_UNSPECIFIED
- default:
- return storepb.ChangelogPayload_MIGRATE, storepb.MigrationType_MIGRATION_TYPE_UNSPECIFIED
}
+ return storepb.ChangelogPayload_MIGRATE, storepb.MigrationType_DDL
case storepb.Task_DATABASE_SDL:
return storepb.ChangelogPayload_SDL, storepb.MigrationType_MIGRATION_TYPE_UNSPECIFIED
case
@@ -664,12 +656,7 @@ func isChangeDatabaseTask(task *store.TaskMessage) bool {
}
}
-func needDump(task *store.TaskMessage, instance *store.InstanceMessage) bool {
- // Skip dump for TiDB DML operations
- if task.Type == storepb.Task_DATABASE_MIGRATE && task.Payload.GetMigrateType() == storepb.MigrationType_DML && instance.Metadata.GetEngine() == storepb.Engine_TIDB {
- return false
- }
-
+func needDump(task *store.TaskMessage, _ *store.InstanceMessage) bool {
//exhaustive:enforce
switch task.Type {
case storepb.Task_DATABASE_MIGRATE,
diff --git a/backend/runner/taskrun/schedulerv2.go b/backend/runner/taskrun/schedulerv2.go
index 38a5466e27..afd9131164 100644
--- a/backend/runner/taskrun/schedulerv2.go
+++ b/backend/runner/taskrun/schedulerv2.go
@@ -1020,15 +1020,8 @@ func isSequentialTask(task *store.TaskMessage) bool {
//exhaustive:enforce
switch task.Type {
case storepb.Task_DATABASE_MIGRATE:
- // DDL, GHOST, and MIGRATE_TYPE_UNSPECIFIED (treated as DDL) operations should be sequential
- switch task.Payload.GetMigrateType() {
- case storepb.MigrationType_DDL, storepb.MigrationType_GHOST, storepb.MigrationType_MIGRATION_TYPE_UNSPECIFIED:
- return true
- case storepb.MigrationType_DML:
- return false
- default:
- return true
- }
+ // All DATABASE_MIGRATE operations (DDL/GHOST) should be sequential
+ return true
case storepb.Task_DATABASE_SDL:
// SDL operations should be sequential
return true
diff --git a/backend/store/task.go b/backend/store/task.go
index 4b52d6551a..aec6958199 100644
--- a/backend/store/task.go
+++ b/backend/store/task.go
@@ -83,7 +83,7 @@ type TaskPatch struct {
ExportFormat *storepb.ExportFormat
ExportPassword *string
EnablePriorBackup *bool
- MigrateType *storepb.MigrationType
+ EnableGhost *bool
// Flags for gh-ost.
Flags *map[string]string
@@ -415,8 +415,8 @@ func (s *Store) UpdateTaskV2(ctx context.Context, patch *TaskPatch) (*TaskMessag
if v := patch.EnablePriorBackup; v != nil {
payloadParts.Join(" || ", "jsonb_build_object('enablePriorBackup', ?::BOOLEAN)", *v)
}
- if v := patch.MigrateType; v != nil {
- payloadParts.Join(" || ", "jsonb_build_object('migrateType', ?::TEXT)", v.String())
+ if v := patch.EnableGhost; v != nil {
+ payloadParts.Join(" || ", "jsonb_build_object('enableGhost', ?::BOOLEAN)", *v)
}
if v := patch.Flags; v != nil {
jsonb, err := json.Marshal(v)
diff --git a/backend/tests/schema_update_test.go b/backend/tests/schema_update_test.go
index 94b025a193..2b873f51c5 100644
--- a/backend/tests/schema_update_test.go
+++ b/backend/tests/schema_update_test.go
@@ -98,7 +98,7 @@ func TestSchemaAndDataUpdate(t *testing.T) {
wantChangelogs := []*v1pb.Changelog{
{
Type: v1pb.Changelog_MIGRATE,
- MigrationType: v1pb.Changelog_DML,
+ MigrationType: v1pb.Changelog_DDL, // DML no longer tracked separately, all non-GHOST are DDL
Status: v1pb.Changelog_DONE,
Schema: dumpedSchema,
PrevSchema: dumpedSchema,
diff --git a/frontend/src/types/proto-es/v1/plan_service_pb.d.ts b/frontend/src/types/proto-es/v1/plan_service_pb.d.ts
index a6fcc3575f..3c1ad43ac7 100644
--- a/frontend/src/types/proto-es/v1/plan_service_pb.d.ts
+++ b/frontend/src/types/proto-es/v1/plan_service_pb.d.ts
@@ -520,6 +520,13 @@ export declare type Plan_ChangeDatabaseConfig = Message<"bytebase.v1.Plan.Change
* @generated from field: bool enable_prior_backup = 8;
*/
enablePriorBackup: boolean;
+
+ /**
+ * Whether to use gh-ost for online schema migration.
+ *
+ * @generated from field: bool enable_ghost = 12;
+ */
+ enableGhost: boolean;
};
/**
diff --git a/frontend/src/types/proto-es/v1/plan_service_pb.js b/frontend/src/types/proto-es/v1/plan_service_pb.js
index 24298d4a6e..eb0f411240 100644
--- a/frontend/src/types/proto-es/v1/plan_service_pb.js
+++ b/frontend/src/types/proto-es/v1/plan_service_pb.js
@@ -18,7 +18,7 @@ import { file_v1_sql_service } from "./sql_service_pb";
* Describes the file v1/plan_service.proto.
*/
export const file_v1_plan_service = /*@__PURE__*/
- fileDesc("ChV2MS9wbGFuX3NlcnZpY2UucHJvdG8SC2J5dGViYXNlLnYxIjkKDkdldFBsYW5SZXF1ZXN0EicKBG5hbWUYASABKAlCGeBBAvpBEwoRYnl0ZWJhc2UuY29tL1BsYW4iZwoQTGlzdFBsYW5zUmVxdWVzdBIsCgZwYXJlbnQYASABKAlCHOBBAvpBFgoUYnl0ZWJhc2UuY29tL1Byb2plY3QSEQoJcGFnZV9zaXplGAIgASgFEhIKCnBhZ2VfdG9rZW4YAyABKAkiTgoRTGlzdFBsYW5zUmVzcG9uc2USIAoFcGxhbnMYASADKAsyES5ieXRlYmFzZS52MS5QbGFuEhcKD25leHRfcGFnZV90b2tlbhgCIAEoCSJgChJTZWFyY2hQbGFuc1JlcXVlc3QSEwoGcGFyZW50GAEgASgJQgPgQQISEQoJcGFnZV9zaXplGAIgASgFEhIKCnBhZ2VfdG9rZW4YAyABKAkSDgoGZmlsdGVyGAQgASgJIlAKE1NlYXJjaFBsYW5zUmVzcG9uc2USIA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UudjEuQmF0Y2hDYW5jZWxQbGFuQ2hlY2tSdW5zUmVzcG9uc2UiadpBBnBhcmVudIrqMBRiYi5wbGFuQ2hlY2tSdW5zLnJ1bpDqMAGC0+STAj46ASoiOS92MS97cGFyZW50PXByb2plY3RzLyovcGxhbnMvKn0vcGxhbkNoZWNrUnVuczpiYXRjaENhbmNlbEKmAQoPY29tLmJ5dGViYXNlLnYxQhBQbGFuU2VydmljZVByb3RvUAFaNGdpdGh1Yi5jb20vYnl0ZWJhc2UvYnl0ZWJhc2UvYmFja2VuZC9nZW5lcmF0ZWQtZ28vdjGiAgNCWFiqAgtCeXRlYmFzZS5WMcoCC0J5dGViYXNlXFYx4gIXQnl0ZWJhc2VcVjFcR1BCTWV0YWRhdGHqAgxCeXRlYmFzZTo6VjFiBnByb3RvMw", [file_buf_validate_validate, file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_field_mask, file_google_protobuf_timestamp, file_v1_annotation, file_v1_common, file_v1_database_service, file_v1_sql_service]);
+ fileDesc("ChV2MS9wbGFuX3NlcnZpY2UucHJvdG8SC2J5dGViYXNlLnYxIjkKDkdldFBsYW5SZXF1ZXN0EicKBG5hbWUYASABKAlCGeBBAvpBEwoRYnl0ZWJhc2UuY29tL1BsYW4iZwoQTGlzdFBsYW5zUmVxdWVzdBIsCgZwYXJlbnQYASABKAlCHOBBAvpBFgoUYnl0ZWJhc2UuY29tL1Byb2plY3QSEQoJcGFnZV9zaXplGAIgASgFEhIKCnBhZ2VfdG9rZW4YAyABKAkiTgoRTGlzdFBsYW5zUmVzcG9uc2USIAoFcGxhbnMYASADKAsyES5ieXRlYmFzZS52MS5QbGFuEhcKD25leHRfcGFnZV90b2tlbhgCIAEoCSJgChJTZWFyY2hQbGFuc1JlcXVlc3QSEwoGcGFyZW50GAEgASgJQgPgQQISEQoJcGFnZV9zaXplGAIgASgFEhIKCnBhZ2VfdG9rZW4YAyABKAkSDgoGZmlsdGVyGAQgASgJIlAK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2hlY2tSdW5zUmVxdWVzdBotLmJ5dGViYXNlLnYxLkJhdGNoQ2FuY2VsUGxhbkNoZWNrUnVuc1Jlc3BvbnNlImnaQQZwYXJlbnSK6jAUYmIucGxhbkNoZWNrUnVucy5ydW6Q6jABgtPkkwI+OgEqIjkvdjEve3BhcmVudD1wcm9qZWN0cy8qL3BsYW5zLyp9L3BsYW5DaGVja1J1bnM6YmF0Y2hDYW5jZWxCpgEKD2NvbS5ieXRlYmFzZS52MUIQUGxhblNlcnZpY2VQcm90b1ABWjRnaXRodWIuY29tL2J5dGViYXNlL2J5dGViYXNlL2JhY2tlbmQvZ2VuZXJhdGVkLWdvL3YxogIDQlhYqgILQnl0ZWJhc2UuVjHKAgtCeXRlYmFzZVxWMeICF0J5dGViYXNlXFYxXEdQQk1ldGFkYXRh6gIMQnl0ZWJhc2U6OlYxYgZwcm90bzM", [file_buf_validate_validate, file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_field_mask, file_google_protobuf_timestamp, file_v1_annotation, file_v1_common, file_v1_database_service, file_v1_sql_service]);
/**
* Describes the message bytebase.v1.GetPlanRequest.
diff --git a/proto/gen/grpc-doc/openapi.yaml b/proto/gen/grpc-doc/openapi.yaml
index 30d192df8a..7845549a85 100644
--- a/proto/gen/grpc-doc/openapi.yaml
+++ b/proto/gen/grpc-doc/openapi.yaml
@@ -11697,6 +11697,9 @@ components:
enablePriorBackup:
type: boolean
description: If set, a backup of the modified data will be created automatically before any changes are applied.
+ enableGhost:
+ type: boolean
+ description: Whether to use gh-ost for online schema migration.
Plan_CreateDatabaseConfig:
required:
- target
diff --git a/proto/gen/grpc-doc/store/README.md b/proto/gen/grpc-doc/store/README.md
index 01d179876c..f6d30b4429 100644
--- a/proto/gen/grpc-doc/store/README.md
+++ b/proto/gen/grpc-doc/store/README.md
@@ -3117,9 +3117,9 @@ Status represents the current execution state of a task run.
| sheet | [string](#string) | | The resource name of the sheet. Format: projects/{project}/sheets/{sheet} |
| release | [string](#string) | | The resource name of the release. Format: projects/{project}/releases/{release} |
| type | [PlanConfig.ChangeDatabaseConfig.Type](#bytebase-store-PlanConfig-ChangeDatabaseConfig-Type) | | |
-| migrate_type | [MigrationType](#bytebase-store-MigrationType) | | The migration type for imperative schema migration. It is only set when type is MIGRATE. |
| ghost_flags | [PlanConfig.ChangeDatabaseConfig.GhostFlagsEntry](#bytebase-store-PlanConfig-ChangeDatabaseConfig-GhostFlagsEntry) | repeated | |
| enable_prior_backup | [bool](#bool) | | If set, a backup of the modified data will be created automatically before any changes are applied. |
+| enable_ghost | [bool](#bool) | | Whether to use gh-ost for online schema migration. |
@@ -3275,6 +3275,7 @@ Type is the database change type.
| database_name | [string](#string) | | |
| ghost_flags | [PlanCheckRunConfig.GhostFlagsEntry](#bytebase-store-PlanCheckRunConfig-GhostFlagsEntry) | repeated | |
| enable_prior_backup | [bool](#bool) | | If set, a backup of the modified data will be created automatically before any changes are applied. |
+| enable_ghost | [bool](#bool) | | Whether to use gh-ost for online schema migration. |
@@ -4900,8 +4901,8 @@ Task is the metadata for database operation tasks.
| schema_version | [string](#string) | | Schema version after migration is applied. |
| enable_prior_backup | [bool](#bool) | | Whether to create an automatic backup before applying changes. |
| flags | [Task.FlagsEntry](#bytebase-store-Task-FlagsEntry) | repeated | Configuration flags for gh-ost migration tool. |
+| enable_ghost | [bool](#bool) | | Whether to use gh-ost for online schema migration. |
| task_release_source | [TaskReleaseSource](#bytebase-store-TaskReleaseSource) | | Source information if task is created from a release. |
-| migrate_type | [MigrationType](#bytebase-store-MigrationType) | | The type of migration (DDL, DML, or GHOST). |
| password | [string](#string) | | Password to encrypt the exported data archive. |
| format | [ExportFormat](#bytebase-store-ExportFormat) | | Format of the exported data (SQL, CSV, JSON, etc). |
diff --git a/proto/gen/grpc-doc/store/index.html b/proto/gen/grpc-doc/store/index.html
index 6284dc5144..25f750a124 100644
--- a/proto/gen/grpc-doc/store/index.html
+++ b/proto/gen/grpc-doc/store/index.html
@@ -8909,14 +8909,6 @@ Format: projects/{project}/releases/{release} </p></td>
<td><p> </p></td>
</tr>
- <tr>
- <td>migrate_type</td>
- <td><a href="#bytebase.store.MigrationType">MigrationType</a></td>
- <td></td>
- <td><p>The migration type for imperative schema migration.
-It is only set when type is MIGRATE. </p></td>
- </tr>
-
<tr>
<td>ghost_flags</td>
<td><a href="#bytebase.store.PlanConfig.ChangeDatabaseConfig.GhostFlagsEntry">PlanConfig.ChangeDatabaseConfig.GhostFlagsEntry</a></td>
@@ -8931,6 +8923,13 @@ It is only set when type is MIGRATE. </p></td>
<td><p>If set, a backup of the modified data will be created automatically before any changes are applied. </p></td>
</tr>
+ <tr>
+ <td>enable_ghost</td>
+ <td><a href="#bool">bool</a></td>
+ <td></td>
+ <td><p>Whether to use gh-ost for online schema migration. </p></td>
+ </tr>
+
</tbody>
</table>
@@ -9296,6 +9295,13 @@ Leave it empty if there is no need to encrypt the zip file. </p></td>
<td><p>If set, a backup of the modified data will be created automatically before any changes are applied. </p></td>
</tr>
+ <tr>
+ <td>enable_ghost</td>
+ <td><a href="#bool">bool</a></td>
+ <td></td>
+ <td><p>Whether to use gh-ost for online schema migration. </p></td>
+ </tr>
+
</tbody>
</table>
@@ -12918,17 +12924,17 @@ Default to this mode.</p></td>
</tr>
<tr>
- <td>task_release_source</td>
- <td><a href="#bytebase.store.TaskReleaseSource">TaskReleaseSource</a></td>
+ <td>enable_ghost</td>
+ <td><a href="#bool">bool</a></td>
<td></td>
- <td><p>Source information if task is created from a release. </p></td>
+ <td><p>Whether to use gh-ost for online schema migration. </p></td>
</tr>
<tr>
- <td>migrate_type</td>
- <td><a href="#bytebase.store.MigrationType">MigrationType</a></td>
+ <td>task_release_source</td>
+ <td><a href="#bytebase.store.TaskReleaseSource">TaskReleaseSource</a></td>
<td></td>
- <td><p>The type of migration (DDL, DML, or GHOST). </p></td>
+ <td><p>Source information if task is created from a release. </p></td>
</tr>
<tr>
diff --git a/proto/gen/grpc-doc/v1/README.md b/proto/gen/grpc-doc/v1/README.md
index 9da5ba7acb..abf7a020b1 100644
--- a/proto/gen/grpc-doc/v1/README.md
+++ b/proto/gen/grpc-doc/v1/README.md
@@ -8394,6 +8394,7 @@ When paginating, all other parameters provided to `ListPlans` must match the cal
| migration_type | [MigrationType](#bytebase-v1-MigrationType) | | migration_type is the migration type for imperative schema migration. It is only set when type is MIGRATE. |
| ghost_flags | [Plan.ChangeDatabaseConfig.GhostFlagsEntry](#bytebase-v1-Plan-ChangeDatabaseConfig-GhostFlagsEntry) | repeated | |
| enable_prior_backup | [bool](#bool) | | If set, a backup of the modified data will be created automatically before any changes are applied. |
+| enable_ghost | [bool](#bool) | | Whether to use gh-ost for online schema migration. |
diff --git a/proto/gen/grpc-doc/v1/index.html b/proto/gen/grpc-doc/v1/index.html
index 9c72e4d831..3d40dbc749 100644
--- a/proto/gen/grpc-doc/v1/index.html
+++ b/proto/gen/grpc-doc/v1/index.html
@@ -23652,6 +23652,13 @@ It is only set when type is MIGRATE. </p></td>
<td><p>If set, a backup of the modified data will be created automatically before any changes are applied. </p></td>
</tr>
+ <tr>
+ <td>enable_ghost</td>
+ <td><a href="#bool">bool</a></td>
+ <td></td>
+ <td><p>Whether to use gh-ost for online schema migration. </p></td>
+ </tr>
+
</tbody>
</table>
diff --git a/proto/store/store/plan.proto b/proto/store/store/plan.proto
index 5e45dd83a0..f6fdc5aa96 100644
--- a/proto/store/store/plan.proto
+++ b/proto/store/store/plan.proto
@@ -66,14 +66,13 @@ message PlanConfig {
}
Type type = 3;
- // The migration type for imperative schema migration.
- // It is only set when type is MIGRATE.
- MigrationType migrate_type = 11;
-
map<string, string> ghost_flags = 7;
// If set, a backup of the modified data will be created automatically before any changes are applied.
bool enable_prior_backup = 8;
+
+ // Whether to use gh-ost for online schema migration.
+ bool enable_ghost = 12;
}
message ExportDataConfig {
diff --git a/proto/store/store/plan_check_run.proto b/proto/store/store/plan_check_run.proto
index 0c90d77ef8..e648a5bb63 100644
--- a/proto/store/store/plan_check_run.proto
+++ b/proto/store/store/plan_check_run.proto
@@ -19,6 +19,9 @@ message PlanCheckRunConfig {
// If set, a backup of the modified data will be created automatically before any changes are applied.
bool enable_prior_backup = 7;
+ // Whether to use gh-ost for online schema migration.
+ bool enable_ghost = 8;
+
// ChangeDatabaseType extends MigrationType with additional execution contexts.
// Note: DDL, DML, and DDL_GHOST values align with MigrationType enum values.
enum ChangeDatabaseType {
diff --git a/proto/store/store/task.proto b/proto/store/store/task.proto
index c010cfff60..ada3fb8322 100644
--- a/proto/store/store/task.proto
+++ b/proto/store/store/task.proto
@@ -47,10 +47,10 @@ message Task {
bool enable_prior_backup = 11;
// Configuration flags for gh-ost migration tool.
map<string, string> flags = 12;
+ // Whether to use gh-ost for online schema migration.
+ bool enable_ghost = 17;
// Source information if task is created from a release.
TaskReleaseSource task_release_source = 13;
- // The type of migration (DDL, DML, or GHOST).
- MigrationType migrate_type = 16;
// Password to encrypt the exported data archive.
string password = 14;
diff --git a/proto/v1/v1/plan_service.proto b/proto/v1/v1/plan_service.proto
index 08860853fa..e86b767a55 100644
--- a/proto/v1/v1/plan_service.proto
+++ b/proto/v1/v1/plan_service.proto
@@ -335,6 +335,9 @@ message Plan {
// If set, a backup of the modified data will be created automatically before any changes are applied.
bool enable_prior_backup = 8;
+
+ // Whether to use gh-ost for online schema migration.
+ bool enable_ghost = 12;
}
message ExportDataConfig {