I was about to add this ticket when it occurred to me to check and make sure this feature wasn''t already there. In reading about Rails and reading the docs, I haven''t seen this. Feel free to throw URL''s at me if I''ve missed something. In some hosting environments, you are confined to one database per account. However, you may be running multiple rails apps with possibly overlapping table names. In the configuration for your rails application it would be nice to be able to specify a prefix with which all your tables start. This way, for example, you could run both a wiki and a blog out of one database even though they might have a table named "pages" because you would specify a prefix of blg_ for the blog, and wk_ for the wiki, with table names blg_pages and wk_pages, respectively. Models and the like would still use the "unprefixed" names, but when tables are referenced, the prefixes would be automatically added to queries, and the like. As more rails apps proliferate there are bound to be "name space" collisions. Since not all users have the luxury of running multiple databases, this could prove very helpful. This could also be extended to devel/test/prod databases: devel_tablename, test_tablename, prod_tablename. j----- k----- -- Joshua J. Kugler -- Fairbanks, Alaska -- ICQ#:13706295 Every knee shall bow, and every tongue confess, in heaven, on earth, and under the earth, that Jesus Christ is LORD -- Count on it!
Adelle Hartley
2005-Mar-25 13:22 UTC
RE: Selectable tablename prefix in Rails configuration
> In some hosting environments, you are confined to one > database per account. However, you may be running multiple > rails apps with possibly overlapping table names. In the > configuration for your rails application it would be nice to > be able to specify a prefix with which all your tables start. > This way, for example, you could run both a wiki and a blog > out of one database even though they might have a table named > "pages" because you would specify a prefix of blg_ for the > blog, and wk_ for the wiki, with table names blg_pages and > wk_pages, respectively. Models and the like would still use > the "unprefixed" > names,ActiveRecord::Base::table_name_prefix = "wk_" Some people have reported problems, YMV. Adelle.
On Fri, 25 Mar 2005 23:22:57 +1000, Adelle Hartley <adelle-JNHwCBCQwwtx3z9c7Zyw2w@public.gmane.org> wrote:> ActiveRecord::Base::table_name_prefix = "wk_" > > Some people have reported problems, YMV.It''s also possible to specify the table name manually for each model, though that''s not as sexy of a solution. -- Urban Artography http://artography.ath.cx
Joshua J. Kugler
2005-Mar-26 07:37 UTC
Re: Selectable tablename prefix in Rails configuration
On Friday 25 March 2005 04:22, Adelle Hartley said something like:> > In some hosting environments, you are confined to one > > database per account. However, you may be running multiple > > rails apps with possibly overlapping table names. In the > > configuration for your rails application it would be nice to > > be able to specify a prefix with which all your tables start. > > This way, for example, you could run both a wiki and a blog > > out of one database even though they might have a table named > > "pages" because you would specify a prefix of blg_ for the > > blog, and wk_ for the wiki, with table names blg_pages and > > wk_pages, respectively. Models and the like would still use > > the "unprefixed" > > names, > > ActiveRecord::Base::table_name_prefix = "wk_" > > Some people have reported problems, YMV. > > Adelle.OK, that''s spiffy. But can that be pulled in automatically from Rails config, or must it be set in code? If set in code, then at best, the developer has custom config that the app pulls from and sets that or at worst the user has to edit the code and put in the prefix. It would be nice, from a "packaged" point of view if this could be in the Rails config for the app...that way, it''s all pretty much self contained: all the info for the database is in the same config file. When someone downloads and deploys an app, they can edit one file, import the tables, and go. j----- k----- -- Joshua J. Kugler -- Fairbanks, Alaska -- ICQ#:13706295 Every knee shall bow, and every tongue confess, in heaven, on earth, and under the earth, that Jesus Christ is LORD -- Count on it!