[ckan-dev] Deleting revisions & 'current' flag

David Read david.read at hackneyworkshop.com
Tue Jul 17 14:48:00 UTC 2012


In tracking down this problem it appears to be because of a ropey
migration script that amended the member_revision table.

Lesson to learn: avoid using SQL when safer higher level functions
exist for manipulating the model.

David

On 17 July 2012 13:47, David Read <david.read at hackneyworkshop.com> wrote:
> John & other CKAN devs,
>
> I think our CKAN database is getting confused by deleted group
> memberships. For example I have a dataset whose membership of a group
> was deleted (and maybe some other operations by the user) but when
> CKAN indexes the dataset (i.e. package_show), it still thinks it is in
> the group. I'm wondering if the 'current' column of the revision table
> was ever tested with deleted objects?
>
> I'm a bit hazy on this part of the model, so I've copied below the
> table in question. There seems to be two 'current' revisions, which
> seems wrong to me. Can you confirm if this is wrong, or have I missed
> something?
>
> David
>
> select revision_timestamp, expired_timestamp, current, state  from
> member_revision where table_id =
> '1cfcf936-5b1b-4726-9930-0fe004aab27d' and group_id =
> '036abab4-15ed-485a-8e14-9a599ea1619e' order by revision_timestamp
> asc;
>
>      revision_timestamp     |     expired_timestamp      | current |  state
> ----------------------------+----------------------------+---------+---------
>  2012-02-17 00:00:00        | 9999-12-31 00:00:00        | t       | active
>  2012-07-13 11:46:19.354614 | 2012-07-16 15:23:42.908261 | f       | deleted
>  2012-07-16 15:23:42.908261 | 2012-07-16 15:45:26.147981 | f       | active
>  2012-07-16 15:45:26.147981 | 9999-12-31 00:00:00        | t       | deleted
> (4 rows)




More information about the ckan-dev mailing list