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

Conversation

hishamco
Copy link
Member

Fixes #4917

No breaking changes, but we should remove the obsolete method before a major release

Copy link
Contributor

coderabbitai bot commented Apr 29, 2024

Warning

Rate Limit Exceeded

@Piedone has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 2 minutes and 14 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.
Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.
Please see our FAQ for further information.

Commits Files that changed from the base of the PR and between 2ce8c06 and 3443c3c.

Walkthrough

The update involves refactoring the UpdateAsync method in OrchardCore's data migration management. The method has been moved from the IDataMigrationManager interface to an extension method, enhancing modularity and clarity. Changes include marking the original method as obsolete and modifying the implementation in DataMigrationManager to handle dependencies iteratively.

Changes

File Path Change Summary
src/OrchardCore/OrchardCore.Data.Abstractions/.../IDataMigrationManager.cs The UpdateAsync method is marked as obsolete and updated. It has been refactored to handle dependencies iteratively.
src/OrchardCore/OrchardCore.Data.Abstractions/.../Extensions/DataMigrationManagerExtensions.cs Introduces UpdateAsync as an extension method for IDataMigrationManager.

Assessment against linked issues

Objective Addressed Explanation
Move IDataMigrationManager.UpdateAsync() to an extension method (#4917) The UpdateAsync method has been successfully moved to an extension method, enhancing the codebase's modularity.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

@hishamco hishamco requested a review from Piedone April 29, 2024 01:04
Piedone

This comment was marked as duplicate.

Copy link
Member

@Piedone Piedone left a comment

Choose a reason for hiding this comment

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

This should be the other way around: #4917 (comment)

@hishamco
Copy link
Member Author

Do you mean leave UpdateAsync(IEnumerable<string>) and remove UpdateAsync()? if yes I might go with params string[] instead, this will support both

@Piedone
Copy link
Member

Piedone commented Apr 29, 2024

Do you mean leave UpdateAsync(IEnumerable<string>) and remove UpdateAsync()? if yes I might go with params string[] instead, this will support both

Yes.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

@hishamco hishamco requested a review from Piedone April 29, 2024 17:31
@Piedone
Copy link
Member

Piedone commented Apr 29, 2024

How did you test this?

@hishamco
Copy link
Member Author

If you look closely nothing changes because the UpdateAsync(string) calling UpdateAsync(string[]), both are well tested before, but I can do manual testing quickly

@Piedone
Copy link
Member

Piedone commented Apr 29, 2024

Please, and I've asked for this multiple times before, test your code. Don't ask for a review before that. The change might be trivial, or it might seem trivial but actually break something, but testing your code is step 0 of QA. You're not finished until you've run your code and are sure that it does what it should. This is your responsibility as the PR author.

@hishamco
Copy link
Member Author

This is your responsibility as the PR author.

I know what you mean Zoltan, but if you look at the change I didn't add anything fancy, just deprecate the UpdateAsync(string), anyway I tested both, and everything working as expected

FYI no unit tests were added here, I just did a manual test

@hishamco hishamco changed the title Move IDataMigrationManager.UpdateAsync(IEnumerable<string>) to extension method Replace IDataMigrationManager.UpdateAsync(string) with IDataMigrationManager.UpdateAsync(IEnumerable<string>) Apr 29, 2024
@Piedone
Copy link
Member

Piedone commented Apr 30, 2024

And how did you do the manual test? I'm asking this because I'd like to try that too.

@hishamco
Copy link
Member Author

  1. Create few migrations (even empty)
  2. Create a razor page that injects IDataMigrationManager and call UpdateAsync(string)
  3. Run the app and access the created page
  4. Check your migrations record in database

Try the above step with UpdateAsync(string[]) and don't forgot to disable the AutomaticDataMigration registration before the test to ensure your code is the only place to update the migration

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

@Piedone Piedone merged commit 9c541cf into main May 1, 2024
6 checks passed
@Piedone Piedone deleted the hishamco/data-migrations branch May 1, 2024 23:04
MikeAlhayek pushed a commit that referenced this pull request May 2, 2024
…Manager.UpdateAsync(IEnumerable<string>) (#15909)

Co-authored-by: Zoltán Lehóczky <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Move IDataMigrationManager.UpdateAsync() to an extension method
3 participants