Skip to content

Commit

Permalink
chore: patch logic
Browse files Browse the repository at this point in the history
  • Loading branch information
giautm committed Apr 25, 2024
1 parent 2d1f95b commit da0555f
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions controllers/atlasmigration_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,10 +313,6 @@ func (r *AtlasMigrationReconciler) reconcile(ctx context.Context, wd *atlas.Work
case len(status.Pending) == 0 && len(status.Applied) > 0 && len(status.Available) < len(status.Applied):
// Migration is downgraded
log.Info("downgrading migration detected", "migrateDown", migrateDown)
if migrateDown && (data.Cloud == nil || data.Cloud.RemoteDir == nil) {
migrateDown = false
log.Info("downgrade only supported with cloud directory", "migrateDown", migrateDown)
}
if migrateDown {
// The downgrade is allowed, apply the last migration version
last := status.Available[len(status.Available)-1]
Expand Down Expand Up @@ -364,7 +360,7 @@ func (r *AtlasMigrationReconciler) reconcile(ctx context.Context, wd *atlas.Work
case StateApplied, StateApproved:
return &dbv1alpha1.AtlasMigrationStatus{
LastApplied: run.Start.Unix(),
LastAppliedVersion: run.Current,
LastAppliedVersion: run.Target,
}, nil
}
}
Expand Down Expand Up @@ -416,6 +412,7 @@ func (r *AtlasMigrationReconciler) extractData(ctx context.Context, res *dbv1alp
RevisionsSchema: s.RevisionsSchema,
Baseline: s.Baseline,
ExecOrder: string(s.ExecOrder),
MigrateDown: s.AllowedMigrateDown,
}
)
if env := s.EnvName; env != "" {
Expand Down

0 comments on commit da0555f

Please sign in to comment.