Forum OpenACS Development: Re: Howto: Expand and Use acs-subsite Based Member Roles - uninstalling
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.
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...