Problem with Creating table With MYSQL

32 views
Skip to first unread message

Sasi Raju

unread,
Jul 13, 2015, 8:24:05 AM7/13/15
to rubyonra...@googlegroups.com
I have one question

Shall I create a table with uppercase in Mysql from ruby on rails.

becoz whatever iam giving the tablename only table creation format like
1.lowercase
2.underscore
3.plural

example

tab_names .

shall i change tab_names--->TABNAME....??

is it rails default or possible to change???

please provide the answer....

--
Posted via http://www.ruby-forum.com/.

Colin Law

unread,
Jul 13, 2015, 8:55:37 AM7/13/15
to rubyonra...@googlegroups.com
On 13 July 2015 at 13:23, Sasi Raju <li...@ruby-forum.com> wrote:
> I have one question
>
> Shall I create a table with uppercase in Mysql from ruby on rails.
>
> becoz whatever iam giving the tablename only table creation format like
> 1.lowercase
> 2.underscore
> 3.plural
>
> example
>
> tab_names .
>
> shall i change tab_names--->TABNAME....??
>
> is it rails default or possible to change???

If you are using Rails why would you want to do that? Rails performs
a lot of its magic by having default rules that allow it to work out
what you want without you having to tell it all the details. For
example, if you want to handle comments then the model class is
Comment, the table name is comments, the controller is
CommentsController, etc. It is possible to override all these but if
you want to get the maximum out of Rails then don't, unless you have a
specific problem that you need to address.

Colin

Sasi Raju

unread,
Jul 13, 2015, 9:41:33 AM7/13/15
to rubyonra...@googlegroups.com
becoz my client asking need to set all the database tablename with
uppercase letter thats'y we are asking.

Colin Law

unread,
Jul 13, 2015, 10:02:05 AM7/13/15
to rubyonra...@googlegroups.com
On 13 July 2015 at 14:40, Sasi Raju <li...@ruby-forum.com> wrote:
> becoz my client asking need to set all the database tablename with
> uppercase letter thats'y we are asking.

When replying please quote the previous message so that we can see
what you are replying to. This is a mailing list not a forum, though
you may be accessing it via a forum like interface. Thanks.

Have you asked why he/she wants to do that?

As far as I know you can just use, in the migration,
create_table :ANYNAMEYOULIKE
but I have not tried it.

Colin

Elizabeth McGurty

unread,
Jul 13, 2015, 10:54:32 AM7/13/15
to rubyonra...@googlegroups.com

9.2.2 Identifier Case Sensitivity (MySQL documentation)

https://dev.mysql.com/doc/refman/5.0/en/identifier-case-sensitivity.html
Read about 'lower_case_table_names'

Sasi Raju

unread,
Jul 14, 2015, 12:33:24 AM7/14/15
to rubyonra...@googlegroups.com
ok thanks

Vineeth B S

unread,
Jul 14, 2015, 1:37:44 AM7/14/15
to rubyonra...@googlegroups.com

Maybe, table name aliasing might come in handy. The main problem that I foresee is that when migrating from mysql to some other,  you have to be conscious about the aliases. The same holds true when you are creating a table. But then,  rails migration dsl might provide you with a consistent way of doing this.
Hope this helps.

Vineeth.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
To post to this group, send email to rubyonra...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/27d3972aa47b47f777d9376c29791dfa%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages