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

Provide a way to limit the chars to store in each column. #499

Merged
merged 10 commits into from
Oct 11, 2023

Conversation

MikeAlhayek
Copy link
Collaborator

Fix for the issue exampled here: OrchardCMS/OrchardCore#14338

running the PR pipeline to see if tests will pass.

@MikeAlhayek
Copy link
Collaborator Author

@sebastienros please approve running this PR so I can see the tests results.

image

@MikeAlhayek
Copy link
Collaborator Author

@sebastienros this sucks. With every commit someone has to approve the run :) If there a way to avoid this? meanwhile, can you please approve it one more time?

/// </summary>
/// <param name="name"></param>
/// <returns></returns>
protected virtual string GetRawColumnName(string name)
Copy link
Owner

Choose a reason for hiding this comment

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

I would prefer to see the Run method rewritten using a local function. GetRawColumnName doesn't make sense on the base class. And the name doesn't even match what it's used for.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@sebastienros I override the run function. Please approve the PR Pipeline to run so we can see the result.

@MikeAlhayek
Copy link
Collaborator Author

@sebastienros it looks like all tests passed. If you are good with this, you may want to merge it and do a quick release. I can then take it from there and apply it in OC so we can ship OC 1.7.1 soon (hopefully during triage)

@MikeAlhayek
Copy link
Collaborator Author

@sebastienros I can always merge this, and release 3.3.1 which should push the new release to nuget. Would you like me to do that? Or do you want to wait or do it yourself?

);
}

private static readonly Regex ColumnNamePattern = new(@"([a-zA-Z_][a-zA-Z0-9_]+)\s*(\(\s*(\d+)\s*\))?");
Copy link
Owner

Choose a reason for hiding this comment

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

Just split the string with '(', ')', ' ' with the RemoveEmptyEntries options, and take the second result. I think Regexes are overkill here (and prone to issues).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@sebastienros done.

Let me know about merging and releasing


private string GetColumName(string name)
{
var parts = name.Split(new[] { '(', ')', ' ' }, StringSplitOptions.RemoveEmptyEntries);
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be better to store the separators into a static field

@sebastienros sebastienros merged commit a50a4e6 into sebastienros:main Oct 11, 2023
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.

3 participants