Skip to content

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

If restore from a db backup belonged to a different instance, then we add the instance name to the branch migration history description as well

天舟c17dad2e4743
diff --git a/server/task_executor_database_restore.go b/server/task_executor_database_restore.go
index eaf82faf1b..e6f5b0ca63 100644
--- a/server/task_executor_database_restore.go
+++ b/server/task_executor_database_restore.go
@@ -164,6 +164,10 @@ func branchMigrationHistoryIfNeeded(ctx context.Context, server *Server, sourceD
if issue != nil {
issueId = strconv.Itoa(issue.ID)
}
+ description := fmt.Sprintf("Branched from backup %q of database %q.", backup.Name, sourceDatabase.Name)
+ if sourceDatabase.InstanceId != targetDatabase.InstanceId {
+ description = fmt.Sprintf("Branched from backup %q of database %q in instance %q.", backup.Name, sourceDatabase.Name, sourceDatabase.Instance.Name)
+ }
m := &db.MigrationInfo{
Version: defaultMigrationVersionFromTaskId(task.ID),
Namespace: targetDatabase.Name,
@@ -171,7 +175,7 @@ func branchMigrationHistoryIfNeeded(ctx context.Context, server *Server, sourceD
Environment: targetDatabase.Instance.Environment.Name,
Engine: db.MigrationEngine(targetDatabase.Project.WorkflowType),
Type: db.Branch,
- Description: fmt.Sprintf("Branched from backup %q of database %q.", backup.Name, sourceDatabase.Name),
+ Description: description,
Creator: task.Creator.Name,
IssueId: issueId,
Payload: "",