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

Remove default tablePrefix tbl_ from db\Connection #2911

Closed
schmunk42 opened this issue Mar 28, 2014 · 18 comments
Closed

Remove default tablePrefix tbl_ from db\Connection #2911

schmunk42 opened this issue Mar 28, 2014 · 18 comments
Assignees
Milestone

Comments

@schmunk42
Copy link
Contributor

Why should we have such a default?
And if, because of some reasons yet unknown to me, I'd say it should be named app_.

@mikehaertl
Copy link
Contributor

Agree. Following this logic, we could also prefix all columns with col_. Or even all variables with var_ or all functions with fn_ (you get the idea).

@Sammaye
Copy link

Sammaye commented Mar 28, 2014

tbl_ is a very common, if not defacto, prefix for tables whereas the examples you mention are not.

It stems back from having to tell the difference easily in a console envo between tables and other elements in a list, i.e. views.

@schmunk42
Copy link
Contributor Author

tbl_ is a very common, if not defacto, prefix for tables

Honestly, I've only seen them in a Yii 1 extension and it was - let's say - a bit uncomfortable.

A good summary is given here IMHO http:https://stackoverflow.com/questions/324163/should-we-use-prefixes-in-our-database-table-naming-conventions

I looked also for tbl_ table prefix on Google ... must be a Yii thing, 3 of the first 5 answers are Yii related 😄

@Sammaye
Copy link

Sammaye commented Mar 28, 2014

Hmm maybe it is something that can be removed, I have just always been
taught, even in uni to use tbl_

On 28 March 2014 16:44, Tobias Munk [email protected] wrote:

tbl_ is a very common, if not defacto, prefix for tables

Honestly, I've only seen them in a Yii 1 extension and it was - let's say

  • a bit uncomfortable.

A good summary is given here IMHO
http:https://stackoverflow.com/questions/324163/should-we-use-prefixes-in-our-database-table-naming-conventions

I looked also for tbl_ table prefix on Googlehttps://www.google.de/search?client=safari&rls=en&q=tbl_+table+prefix&ie=UTF-8&oe=UTF-8&gfe_rd=cr&ei=FaU1U_OFLcmK8QfxjIBg... must be a Yii thing, 3 of the first 5 answers are Yii related [image:
😄]

Reply to this email directly or view it on GitHubhttps://github.com//issues/2911#issuecomment-38940827
.

@bryglen
Copy link

bryglen commented Mar 29, 2014

i dont like it too having tbl prefix but there is a good reason too in my opinion..

when i see tbl_ in my database. I see it this was belong to Yii related stuff, but i prefer to have yii_ as a prefix instead of tbl_ like yii_migrations table instead of tbl_migrations so I know that this table is yii stuffs

@Sammaye
Copy link

Sammaye commented Mar 29, 2014

That is one thing too, I had two apps that pointed to the same db (partially rewritten in Yii1 at the time) and tbl did tell me the difference between old and new.

@mikehaertl
Copy link
Contributor

I still see no really convincing argument why this should be default. This is a kind of hungarian notation. But we don't use this anywhere else so what exactly makes table names so special that we would need it there? We should aim for simple and human readable names by default.

If someone really thinks, he prefers to have the tbl_ prefix, she can still configure it in their Connection component.

@Sammaye
Copy link

Sammaye commented Mar 29, 2014

Yeah it does seem sane to do that

@schmunk42
Copy link
Contributor Author

@samdark You could just move this setting to the apps.

@samdark
Copy link
Member

samdark commented Mar 29, 2014

You mean advanced app?

@schmunk42
Copy link
Contributor Author

Yes, basic app also, if it has a db connection.

@samdark samdark self-assigned this Mar 29, 2014
@qiangxue qiangxue added this to the 2.0 Beta milestone Mar 29, 2014
@qiangxue
Copy link
Member

I'm fine removing the prefix. If we do so, the apps should not use prefix either for consistency. Can someone prepare a PR for this? All occurrence of tbl_ should be removed.

@Ragazzo
Copy link
Contributor

Ragazzo commented Mar 30, 2014

so how then use prefix ? i know some projects including yupe that actually use prefix, also this is just a good reason to not get yourself in trouble with rdbms reserved words. I dont think we should remove this feature.

@mikehaertl
Copy link
Contributor

@Ragazzo It won't get removed. It's just the default value that will be changed. You can always configure a table prefix in your db component:

'db' => [
    ...
    'tablePrefix' => 'tbl_',
]

@Ragazzo
Copy link
Contributor

Ragazzo commented Mar 30, 2014

Ok )

@samdark
Copy link
Member

samdark commented Mar 30, 2014

I'll create a pull request if noone has started it.

@schmunk42
Copy link
Contributor Author

I haven't so far.

@Sammaye
Copy link

Sammaye commented Mar 30, 2014

I haven't

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants