--
-- pa_collection__delete/1
--
create or replace function pa_collection__delete(
  integer
) returns int4 as $$

declare
  p_collection_id                             alias for $1;
begin
    delete from acs_permissions
           where object_id = p_collection_id;

    delete from pa_collections
           where collection_id = p_collection_id;

    raise NOTICE 'Deleting photo_collection...';
    PERFORM acs_object__delete(p_collection_id);

    return 0;

end;$$ language plpgsql;