Forum OpenACS Development: Re: Howto: Expand and Use acs-subsite Based Member Roles - uninstalling

Randy,

Thank you very much for the research and the write-up. It sure saved me a tremendous amount of effort (working on my first OACS package).

I would like to add that there is a bit of a problem when uninstalling a package and the relationship type must be removed. There is no TCL API opposite to rel_types::new and the SQL API acs_rel_type__drop_type function does not remove the table that is created by rel_types::new.

After some tinkering, I came up with the following. It should uninstall the relationship type cleanly if nothing else is triggered by rel_types::new. I have only had time to test this briefly by repeatedly installing/uninstalling an otherwise unused package. So far, it seems to work OK.

set ext "_ext"
rel_types::remove_permissible application_group $m_rel_type
set rel_type_ext $m_rel_type$ext
db_exec_plsql drop_table "drop table $rel_type_ext"
db_exec_plsql drop_rel_type "select acs_rel_type__drop_type(:m_rel_type, false);"

This is not very clean, but my first attempt to embed everything in pgplsql code in a single query failed. I couldn't figure out how to pass a variable to "drop table" and I didn't want to hardcode the type name in the query.

You are very welcome. And thanks for adding your notes on cleanup.

In general, once a package ties itself into oacs by adding system objects, types, and permissions, removing the package is like extracting teeth. It requires brute-force.

I hope someone corrects me on the previous statement...

Brute force? No no, it requires a fileting knife, and much persistance and testing. It's not that bad if you write your drop scripts as you develop the package - that's when you may actually want to drop and recreate it over and over again, wiping out all data every time you drop it. If you leave the drop scripts till later, well, I dunno. Get to work with the filet knife, I guess. (I've never had rel types I needed to drop though.)