At 3:11 PM -0800 3/5/08, Hiroki Terashima wrote: >Hi SDS folks, > > I'd like to copy all the data in > <http://saildataservice.concord.org/14>http://saildataservice.concord.org/14 > to a new portal, like > <http://saildataservice.concord.org/17>http://saildataservice.concord.org/17. > Can this be done easily?
There is no task that automates this and it gets a bit involved. First the jnlps, curnits, and sail_users are copied + then for each offering copied also copy ++ the workgroups for the offering +++ the workgroup_memberships for each workgroup +++ the bundles and bundle_contents (if any) associated with each workgroup_membership version + Now for each new bundle ++ regenerate the pods, rims, and sock_entries and the Pod derived type information ++ Create all the Model Activity Data from the pods and socks I think that would do it but I've probably forgotten something and it would probably need to go through several iterations until it worked right. How hard is it to duplicate the data in one of your Portal instances and then ask it to regenerate all the SDS resources? We often use one of the following DIY rake tasks rake diy:delete_local_sds_attributes Delete local DIY references to external SDS resources: this will cause them to be regenerated. rake diy:delete_copy_and_convert_db Delete current database, copy from stable, convert tables ... rake diy:migrate_sds_data Migrate the DIY data stored in an SDS from one SDS to another. See the code here: http://trac.cosmos.concord.org/teemss2/browser/branches/diy_rails_2.0.2/lib/tasks/diy.rake *** Also *** You have a bunch of duplicate resource in portal realm 14. For example you have 49 duplicates of this curnit defined: http://www.encorewiki.org/download/attachments/2113/converted-wise-dev.berkeley.edu-16704.jar and 74 duplicates of this jnlp: http://www.encorewiki.org/download/attachments/2114/plr-everything-jdic-snapshot.jnlp You only need one of each. If the curnit and jnlp already exist in a Portal Realm it is a waste of space to make duplicates. How about setting up your own SDS for development where you can easily get problems like this duplication ironed out? You can run a bunch of portal code and then just clean out the SDS when you have fixed something and want to try again. If you really want the functionality for copying from one realm to another you could take this start I made of the rake task to do it -- get it working and tested on a local SDS and then commit it back. Or maybe Aaron has another idea. You can see the current SDS rake tasks here: http://trac.cosmos.concord.org/sds/browser/trunk/lib/tasks/sds.rake Here's the task I started writing ... desc "Copy all the data from one Portal Realm to another in the same SDS. The destination Portal Realm must be both created and empty." task :copy_portal_realm => :environment do puts "This task will copy all the data from one Portal Realm to another in the same SDS." puts "The destination Portal Realm must have been created and also be empty." puts print "Source Portal Realm: " source = Portal.find(STDIN.gets.chomp) print "Destination Portal Realm: " destination = Portal.find(STDIN.gets.chomp) check = destination.jnlps.count + destination.curnits.count + destination.offerings.count + destination.workgroups.count + destination.sail_users.count if check > 0 puts "Copy cancelled, destination Portal Realm: #{destination.id} not empty." else puts "Copy all the data from Portal Realm: #{source.id} (#{source.name}) to Portal Realm: #{destination.id} (#{destination.name})" print "Would you like to proceed? [y/N] " response = STDIN.gets.chomp puts "" case response when "y", "Y", "yes", "Yes" # continue when "n", "N", "no", "No", "" puts "Aborting." return else puts "Invalid response. Aborting." return end jnlp_mapping = {} source.jnlps.each do |original| clone = original.clone clone.portal = destination clone.save jnlp_mapping.update({original.id => clone.id}) end curnit_mapping = {} source.curnits.each do |original| clone = original.clone clone.portal = destination clone.save curnit_mapping.update({original.id => clone.id} end sail_user_mapping = {} source.sail_users.each do |original| clone = original.clone clone.portal = destination clone.save sail_user_mapping.update({original.id => clone.id} end offering_mapping = {} source.offerings.each do |original| clone = original.clone clone.portal = destination clone.jnlp_id = jnlp_mapping[original.jnlp_id] clone.curnit_id = curnit_mapping[original.curnit_id] clone.save workgroup_mapping = {} original.workgroups do |wg_original| wg_clone = wg_original.clone wg_original.sail_users.each do |su_original| ... and so on ... end --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "SAIL-Dev" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/SAIL-Dev?hl=en -~----------~----~----~----~------~----~------~--~---
