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

How can PHP framework propose a table naming convention in a database (SQL, NoSQL)? #79

Closed
vanyabrovary opened this issue Jul 12, 2020 · 3 comments

Comments

@vanyabrovary
Copy link

vanyabrovary commented Jul 12, 2020

Does it make sense to recommend database naming in context of PHP framework?
May be this is confusing for less experienced developers?
And implies violation of best practices, if database is already designed using singular naming style?

Are these practices of database naming possible, if database is already designed using singular naming style?
https://github.com/alexeymezenin/laravel-best-practices#follow-laravel-naming-conventions

Does it means that singular naming at database is not good for Laravel?

@spekulatius
Copy link
Contributor

Hey @vanyabrovary

thanks for your message. Best practices aren't about excluding options but to guide when in doubt. You can still have singular table names if this is needed or by choice. It's purely seen as a recommendation (and default, if auto-generated via the framework).

Cheers,
Peter

@cmora-pe
Copy link

It makes absolutely sense. There is a principle to follow, "Convention over Configuration", meaning there are certain practices in naming that are spected in case of no other requirements. That is translated, among other benefits, to avoid the need of being absolutely declarative, because of the standarized spected defaults in naming of every artifact involved in the database schema, keeping you DRY.
Anyway, as @spekulatius said, the framework allows to override those conventions.

about "Does it means that singular naming at database is not good for Laravel?"... Laravel can handle that case without issues, but you have to be declarative giving the table name in the model declaration, so it's not bad for Laravel. If there is a convention in the DB Schema different from the used by Laravel, probably the behavoir of models can be patched if you know the basics of the model's implementation.

@spekulatius
Copy link
Contributor

Exactly, it's taken care of and you've got the option to change it if needed.

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

No branches or pull requests

3 participants