Dear Frienz, In one of my project i need to implement archiving of logs. I have two database called people_development and archive_development. I have used all my development in people_development database. development: adapter: mysql database: people_development host: localhost I have used reports about people like their attendences in logs module. So daily atleast 100s of reports will be updated in the database. Now i need to implement archiving of such logs into another database like archive_development. How this could be done in rails? I need to do the same manually, ie my application should have option to move selected logs to archive database. Could any one plz suggest on this? Thanks in advance, Regards, Rose Martin -- Posted via http://www.ruby-forum.com/.
dare ruby wrote:> Dear Frienz, > > In one of my project i need to implement archiving of logs. > > I have two database called people_development and archive_development. I > have used all my development in people_development database. > > development: > adapter: mysql > database: people_development > host: localhost > > I have used reports about people like their attendences in logs module. > So daily atleast 100s of reports will be updated in the database. Now i > need to implement archiving of such logs into another database like > archive_development. > > How this could be done in rails? I need to do the same manually, ie my > application should have option to move selected logs to archive > database.Rails will deal with multiple databases. But why do you need a separate DB for your archives? That seems pointless. You should just be able to put the archive table in the same DB. That''s if you even *need* an archive table -- you may not.> > Could any one plz suggest on this? > > Thanks in advance, > > Regards, > Rose MartinBest, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- Posted via http://www.ruby-forum.com/.
Thanks maren for your suggestion> Rails will deal with multiple databases. But why do you need a separate > DB for your archives? That seems pointless.I need to reduce the huge load in the same db and i want the archives in a seperate DB so that i can take regular backups seperately the live content and archived content.> You should just be able to > put the archive table in the same DB. That''s if you even *need* an > archive table -- you may not.I have a controller logs, a models student_logs and methods like list and archive. When i call list page, the page should fetch lists of logs from student_logs table, i have option to select all those logs now i need to move these selected logs into another database. I have used the method archive to do this under logs controller. I have used active_delegate plugin, but my list page itself fetches record from the archive database and not from original database. I need to list logs from original database and need to move the selected logs to archive database. In model i have used , delegates_connection_to :archive_log, :on => [:archive] and in database.yml file i have, development: adapter: mysql host: localhost database: people_development archive_log: adapter: mysql host: localhost database: archive_development So the using the above i was not able to the same, Could anyone please suggest on the above scenario. Is it possible to do using active_delegate or is there any other plugin which satisfies my requirement. Thanks in advance Regards, Jose martin -- Posted via http://www.ruby-forum.com/.
dare ruby wrote:> Thanks maren for your suggestion > >> Rails will deal with multiple databases. But why do you need a separate >> DB for your archives? That seems pointless. > > I need to reduce the huge load in the same dbI don''t see why. Tables are pretty much independent when it comes to load.> and i want the archives in > a seperate DB so that i can take regular backups seperately the live > content and archived content.I *think* you can do this with one DB, but I might well be wrong. Best, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- Posted via http://www.ruby-forum.com/.
I *think* you can do this with one DB, but I might well be wrong. Thanks marnen for your support. I fixed this issue by using establish_connection where ever necessary to switch my database. It works fine with establish_connection method. Thanks Regards, Martin -- Posted via http://www.ruby-forum.com/.