[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-users] Deleting addressbook contact of one user

From: Massimiliano Mirra
Subject: [Phpgroupware-users] Deleting addressbook contact of one user
Date: Mon, 02 Aug 2004 10:58:03 +0200
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux)

...or "migration woes".

Users are importing several contacts from Outlook CSV at once before
realizing that the result is less than optimal.  So I had to put
together some SQL for cleanup, that deletes all contact owned by a
certain account_id (e.g. `100'):

    create temporary table ids
        select contact_id from phpgw_contact
        where owner=100 and contact_type_id=1;
    delete from phpgw_contact_person
        using ids, phpgw_contact_person
        where ids.contact_id = phpgw_contact_person.person_id;
    [ the same for phpgw_contact_addr, phpgw_contact_comm,
    phpgw_contact_note, phpgw_contact_others...]
    delete from phpgw_contact
        using ids, phpgw_contact
        where ids.contact_id = phpgw_contact.contact_id;
    drop table ids;

I'm not very familiar with phpgw db schema, did I miss anything?

Massimiliano (bard)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]