[LRUG] Multiple databases, migration, integration...
Riccardo Tacconi
rtacconi at gmail.com
Fri Feb 5 03:18:37 PST 2010
Andrew,
I started to use prefix for table name but when I run rake db:test:prepare I
get all tables with two times the prefix appended. For instance, in
development _categories table becomes __categories table, with two
underscore. For a blog I understand that this is a bug abd there is a patch
four year old. Why they should not integrated that patch in Rails?
I am trying to apply the patch but I did not now how to do it.
Have you had a similar problem?
On Fri, Jan 8, 2010 at 10:51 AM, Andrew Stewart
<boss at airbladesoftware.com>wrote:
>
> On 8 Jan 2010, at 10:33, Riccardo Tacconi wrote:
>
>> Yesterday I decided to refactor a page developed in PHP with Rails. I am
>> using two MySql databases, one for the PHP, one for Rails. Now I am not sure
>> if I should use only one database or two. The DB for PHP has name in the
>> singular form (dept, user, article...), the primary keys are something like
>> 'deptID', 'user_id', in few words is an old rubbish inherited DB.
>>
>
> I am working in a similar situation where I am running an old Mambo (PHP)
> site alongside a new Rails site, while slowly moving functionality from the
> former to the latter.
>
> I have a single MySQL database containing both the PHP system's tables and
> the Rails app's tables. This way I only need to connect to a single
> database, which is the way Rails likes it. To avoid table name clashes I
> prefixed all the Rails app's tables with a simple prefix, configuring
> ActiveRecord appropriately (c.f. the table_name_prefix method).
>
> Have a class for each PHP table you need to use, and use ActiveRecord's
> table_name and primary_key methods to cope with the old table names. I do
> this and it all works perfectly.
>
> When I want to move functionality and data from PHP-land to Rails-land, I
> use Tim Riley's marvellous acts_as_importable plugin. He came up with an
> excellent pattern for migrating data, and for my system it works very well.
>
> http://github.com/timriley/acts-as-importable
>
> Regards,
>
> Andy Stewart
> -------
> http://airbladesoftware.com
>
> _______________________________________________
> Chat mailing list
> Chat at lists.lrug.org
> http://lists.lrug.org/listinfo.cgi/chat-lrug.org
>
--
Riccardo Tacconi
Web developer at Wolseley UK
VIRTUELOGIC LIMITED (Director)
http://www.linkedin.com/in/riccardotacconi
http://riccardotacconi.blogspot.com/
http://twitter.com/rtacconi
Linux user: #400461
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lrug.org/pipermail/chat-lrug.org/attachments/20100205/4972fbd2/attachment-0003.html>
More information about the Chat
mailing list