gabordemooij / redbean

ORM layer that creates models, config and database on the fly
https://www.redbeanphp.com
2.31k stars 279 forks source link

Improved table naming scheme #510

Closed SusanthCom closed 7 years ago

SusanthCom commented 8 years ago

Hi,

Currently ReadBean defaults, reserves _ to represent many to many mapping and don't allow _ to be used in table names.

Though this limitation could be bypassed by following this

An improved default naming scheme would be :

Hai @gabordemooij and team members, my humble opinion is that, making this suggested behaviour as default by keeping backward compatibility, makes ReadBean more beautiful ( especially for early ReadBean adopters ).

Hats off to ❤️RedBeanPHP❤️ team, for your wonderful work !!!

Those who support this view, please up vote 👍 to let the team know how important it is 😄

Thnak you all Susanth

devthejo commented 8 years ago

+1

SusanthCom commented 8 years ago

@surikat through you, I reached RedBean Inspired DataMap, which is part of RedCat. Thank You 😸

gabordemooij commented 8 years ago

Thanks SusanthCom for your comment. I know the naming scheme is a bit controversial. However many database already use the single underscore for linking tables. In my experience it's always possible to avoid using the '_' for regular tables, it just takes a little more imagination sometimes to come up with a good name for the bean.

SusanthCom commented 8 years ago

Hi @gabordemooij,

Thank you Very much for fast response.

I respect your view wholeheartedly and like RedBeanPHP. Will try single word naming OR follow the alternative : Prefixes

But from an ORM user's perspective, One can see, many of leading open source projects are using _ in table names extensively.

If you still opt to stick to the current implementation as default. Thats fine 👍 From the clean source code, documentation and RoadMap its clear that : you and team, invested much time and effort in coding and filtering out the user requests. Hats off 🎩🎩


At least a flag based implementation, roughly, something like below, will be a big help !!!

R::setup( string $dsn = NULL, string $username = NULL, string $password = NULL, boolean $frozen = FALSE, string $fancyTableName = FALSE ) if $fancyTableName is TRUE.

  • _ is allowed in table names.
  • ___ is used in table names when mapping many to many relations.

Advantages of Implementation :


ThankYou Susanth