From: Michael Orlitzky Date: Sat, 14 Jan 2012 20:43:24 +0000 (-0500) Subject: Update the RoundcubeDb plugin for v0.7. X-Git-Tag: 0.0.1~121 X-Git-Url: https://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=6ea85440cad9212639af782bd758a8eccd55f90e;p=mailshears.git Update the RoundcubeDb plugin for v0.7. --- diff --git a/src/plugins/roundcube_db.rb b/src/plugins/roundcube_db.rb index 94fe14a..cb2e055 100644 --- a/src/plugins/roundcube_db.rb +++ b/src/plugins/roundcube_db.rb @@ -39,12 +39,27 @@ class RoundcubeDb # belonging to it. user_id = self.get_user_id(account) + # This is mostly unnecessary when using Postgres. The Roundcube + # developers were nice enough to include DBMS-specific install and + # upgrade scripts, so Postgres can take advantage of ON DELETE + # triggers. Here's an example: + # + # ... + # user_id integer NOT NULL + # REFERENCES users (user_id) ON DELETE CASCADE ON UPDATE CASCADE + # sql_queries = ['DELETE FROM cache WHERE user_id = $1::int;'] + sql_queries << 'DELETE FROM cache_index WHERE user_id = $1::int;' + sql_queries << 'DELETE FROM cache_messages WHERE user_id = $1::int;' + sql_queries << 'DELETE FROM cache_thread WHERE user_id = $1::int;' sql_queries << 'DELETE FROM contactgroupmembers WHERE contactgroup_id IN (SELECT contactgroup_id FROM contactgroups WHERE user_id = $1::int);' sql_queries << 'DELETE FROM contactgroups WHERE user_id = $1::int;' sql_queries << 'DELETE FROM contacts WHERE user_id = $1::int;' sql_queries << 'DELETE FROM identities WHERE user_id = $1::int;' - sql_queries << 'DELETE FROM messages WHERE user_id = $1::int;' + sql_queries << 'DELETE FROM dictionary WHERE user_id = $1::int;' + sql_queries << 'DELETE FROM searches WHERE user_id = $1::int;' + + # This one is of course necessary with any DBMS. sql_queries << 'DELETE FROM users WHERE user_id = $1::int;' begin