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

GetCreateTablesScriptAsync in Sql Server provider table name splitting issue #69

Open
ErikEJ opened this issue Jun 7, 2024 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@ErikEJ
Copy link

ErikEJ commented Jun 7, 2024

var splittedTableNames = tables.Select(t =>
{
    var parts = t.Split('.', StringSplitOptions.TrimEntries);
    var schema = parts[0].TrimStart('[').TrimEnd(']');
    var name = parts[1].TrimStart('[').TrimEnd(']');
    return new { Schema = schema, Name = name };
});

This can "easily" break, as this is a valid CREATE TABLE statement:

CREATE TABLE "[.[Ew!l💩]"
(
	Id int
)

One possible solution could be to create an abstraction like:

public class Table
{
   string? Schema { get; set;}
   string Name { get; set;}
}

Happy to create a PR if interested?

@marcominerva marcominerva added the bug Something isn't working label Jun 7, 2024
@marcominerva
Copy link
Owner

Of course, feel free to make a PR for this improvement. Thank you for your contribution!

@ErikEJ ErikEJ closed this as not planned Won't fix, can't repro, duplicate, stale Jan 19, 2025
@marcominerva
Copy link
Owner

I reopen and assign to me this issue because I think it is an important improvement.

@marcominerva marcominerva reopened this Jan 20, 2025
@marcominerva marcominerva self-assigned this Jan 20, 2025
@ErikEJ
Copy link
Author

ErikEJ commented Jan 20, 2025

@marcominerva Cool, I looked at it and it snowballed.. 😆

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants