Forum OpenACS Development: Re: Can't delete unmounted ETP instance
Trying to delete the instance, I get an error like this:
Database operation "0or1row" failed (exception NSDB, "Query was not a statement returning rows.")
ERROR: cr_fldr_pkg_id_fk referential integrity violation - key in apm_packages still referenced from cr_folders
SQL:
select apm_package__delete('2272');
Then I go to say:
openacs-4-6=# select etp__get_folder_id(2272);
etp__get_folder_id
--------------------
2277
(1 row)
Then you know the folder_id. You'll delete that one after you've deleted all the contents.
openacs-4-6=# select * from cr_items where parent_id = 2277;
item_id | parent_id | name | locale | live_revision | latest_revision | publish_status | content_type | storage_type | storage_area_key | tree_sortkey
---------+-----------+-------+--------+---------------+-----------------+----------------+-------------------+--------------+------------------+--------------------------
2282 | 2277 | 2 | | 2284 | 2284 | | news_item | text | CR_FILES | 000000100000010000000001
2278 | 2277 | index | | 2279 | 2285 | | etp_page_revision | text | CR_FILES | 000000100000010000000000
(2 rows)
So we delete those:
openacs-4-6=# select content_item__delete(2282);
NOTICE: Deleting symlinks...
NOTICE: Unscheduling item...
NOTICE: Deleting associated revisions...
NOTICE: Deleting associated item templates...
NOTICE: Deleting item relationships...
NOTICE: Deleting child relationships...
NOTICE: Deleting parent relationships...
NOTICE: Deleting associated permissions...
NOTICE: Deleting keyword associations...
NOTICE: Deleting associated comments...
NOTICE: Deleting content item...
content_item__delete
----------------------
0
(1 row)
openacs-4-6=# select content_item__delete(2278);
NOTICE: Deleting symlinks...
NOTICE: Unscheduling item...
NOTICE: Deleting associated revisions...
NOTICE: Deleting associated item templates...
NOTICE: Deleting item relationships...
NOTICE: Deleting child relationships...
NOTICE: Deleting parent relationships...
NOTICE: Deleting associated permissions...
NOTICE: Deleting keyword associations...
NOTICE: Deleting associated comments...
NOTICE: Deleting content item...
content_item__delete
----------------------
0
(1 row)
Then we can delete the folder:
openacs-4-6=# select content_folder__delete(2277);
NOTICE: Deleting symlinks...
NOTICE: Unscheduling item...
NOTICE: Deleting associated revisions...
NOTICE: Deleting associated item templates...
NOTICE: Deleting item relationships...
NOTICE: Deleting child relationships...
NOTICE: Deleting parent relationships...
NOTICE: Deleting associated permissions...
NOTICE: Deleting keyword associations...
NOTICE: Deleting associated comments...
NOTICE: Deleting content item...
content_folder__delete
------------------------
0
(1 row)
Now if you hit reload on the delete instance page that we started with.
With the new APM enhancements that we've done recently, we shuold include this in an before_uninstantiate procedure.
/Lars