Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace IDataMigrationManager.UpdateAsync(string) with IDataMigrationManager.UpdateAsync(IEnumerable<string>) #15909

Merged
merged 7 commits into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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]);
hishamco marked this conversation as resolved.
Show resolved Hide resolved

/// <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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI this is a breaking change, but it's not something that anybody should actually notice.


/// <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