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

Check table names before creating them #52

Closed
JJ opened this issue Oct 6, 2018 · 8 comments
Closed

Check table names before creating them #52

JJ opened this issue Oct 6, 2018 · 8 comments

Comments

@JJ
Copy link
Contributor

JJ commented Oct 6, 2018

Some table names are not acceptable, like the ones with - or, for some reason, "commit". Document acceptable table names and check for them in the create-table meta-method.

@FCO
Copy link
Owner

FCO commented Oct 6, 2018

That’s a good idea, but maybe that should be a driver logic, once there’s didiferente reserved words for different databases.

@JJ
Copy link
Contributor Author

JJ commented Oct 7, 2018 via email

@FCO
Copy link
Owner

FCO commented Oct 7, 2018

Sure, but that should be extensible for specific drivers... but today the “-“ on a model type name is converted to “_”... it will only happens a table with “-“ on its name if some one do:

model Bla is table<name-with-dash> {...}

@JJ
Copy link
Contributor Author

JJ commented Oct 7, 2018

In my example, Git-commit gets translated to:

CREATE TABLE git-commit(
   subject varchar(255) NULL,
   hash varchar(255) NULL,
   body varchar(255) NULL,
   email varchar(255) NULL,
   created varchar(255) NULL
)

@JJ
Copy link
Contributor Author

JJ commented Oct 7, 2018

The regex only works if the letter behind the dash is in caps, apparently.

@FCO
Copy link
Owner

FCO commented Oct 7, 2018

You are right! camel-to-snake-case doesn’t treaty -, I’m going to fix that!

FCO added a commit that referenced this issue Oct 7, 2018
@FCO
Copy link
Owner

FCO commented Oct 7, 2018

I think this fixes the principal problem, but it would be great to test the reserved words for each driver.

Thanks!

@FCO FCO closed this as completed in a70cf1c Oct 12, 2018
@FCO
Copy link
Owner

FCO commented Oct 12, 2018

Done! thanks!

@FCO FCO added this to backlog in Documenting Mar 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

No branches or pull requests

2 participants