While developing the TELS/Pas Portal, the unit tests can quickly fill up the test portal with the SDS causing the tests to run more and more slowly over time. The easiest way to fix this, is to clean out the test portal.
Here's the procedure:
- At the command-line, navigate to your SDS root folder
- Run 'script/console' to start up an interactive ruby console
- Run the following commands in the console (replacing the 4 in the first line with the portal id of the portal you wish to clean):
p = Portal.find(4); nil p.workgroups.each {|w| w.destroy}; nil p.offerings.each {|o| o.destroy}; nil p.sail_users.each {|u| u.destroy}; nil p.jnlps.each {|j| j.destroy}; nil p.curnits.each {|c| c.destroy}; nil
This code loads Portal 4 and then deletes each of the workgroups, offerings, users, jnlps, and curnits within that portal. This ordering is the best way to delete things. The '; nil' on the end of each line just reduces the amount of data that will get printed out to you when you run it.