[ckan-dev] purging revisions

Haq, Salman Salman.Haq at neustar.biz
Fri Jul 13 21:24:51 UTC 2012


Given an extension ("myextension") that introduces it's own revisioned
model entities, how can I ensure that the associated revisions are
returned by Package.all_related_revisions?

The issue I'm running into is that when I delete and purge a package, I
receive the following errors:

Problem purging revision fe09a50b-3f65-4bda-a555-6ba39cf6f3f2:
(IntegrityError) update or delete on table "revision" violates foreign key
constraint "myextension_group_revision_id_fkey" on table
"myextension_group" DETAIL: Key
(id)=(fe09a50b-3f65-4bda-a555-6ba39cf6f3f2) is still referenced from table
"myextension_group". 'DELETE FROM revision WHERE revision.id = %(id)s'
{'id': u'fe09a50b-3f65-4bda-a555-6ba39cf6f3f2'}


Note that all_related_revision is a read-only property of
ckan.model.package.Package. Monkey patching comes to mind but I don't want
to go there.

Initially I had expected to define the delete method of my
IPackageController to clean up before the package entity gets deleted in
ckan.actions.delete.package_delete but it turns out that action is not
called from the ckan.controller.admin.delete. Hope that makes sense.

Thanks,
Salman





More information about the ckan-dev mailing list