Skip to content

Commit

Permalink
Replace IDataMigrationManager.UpdateAsync(string) with IDataMigration…
Browse files Browse the repository at this point in the history
…Manager.UpdateAsync(IEnumerable<string>) (#15909)

Co-authored-by: Zoltán Lehóczky <[email protected]>
  • Loading branch information
2 people authored and MikeAlhayek committed May 2, 2024
1 parent f6019c6 commit 2c35277
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;

Expand All @@ -22,13 +23,14 @@ public interface IDataMigrationManager
/// Updates the database to the latest version for the specified feature.
/// </summary>
/// <param name="feature">The feature to be uninstalled.</param>
Task UpdateAsync(string feature);
[Obsolete("This method has been deprecated, please use UpdateAsync(string[] features) instead.")]
Task UpdateAsync(string feature) => UpdateAsync([feature]);

/// <summary>
/// Updates the database to the latest version for the specified features.
/// Updates the database to the latest version for the specified feature(s).
/// </summary>
/// <param name="features">The features to be updated.</param>
Task UpdateAsync(IEnumerable<string> features);
/// <param name="features">The feature(s) to be updated.</param>
Task UpdateAsync(params string[] features);

/// <summary>
/// Execute a script to delete any information relative to the feature.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public async Task Uninstall(string feature)
}
}

public async Task UpdateAsync(IEnumerable<string> featureIds)
public async Task UpdateAsync(params string[] featureIds)
{
foreach (var featureId in featureIds)
{
Expand All @@ -134,7 +134,7 @@ public async Task UpdateAsync(IEnumerable<string> featureIds)
}
}

public async Task UpdateAsync(string featureId)
private async Task UpdateAsync(string featureId)
{
if (_processedFeatures.Contains(featureId))
{
Expand All @@ -152,7 +152,10 @@ public async Task UpdateAsync(string featureId)
.Where(x => x.Id != featureId)
.Select(x => x.Id);

await UpdateAsync(dependencies);
foreach (var dependency in dependencies)
{
await UpdateAsync(dependency);
}

var migrations = GetDataMigrations(featureId);

Expand Down

0 comments on commit 2c35277

Please sign in to comment.