]> gitweb.michael.orlitzky.com - mailshears.git/commitdiff
Remove unnecessary queries from the Roundcube plugin.
authorMichael Orlitzky <michael@orlitzky.com>
Tue, 19 Mar 2013 15:38:12 +0000 (11:38 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Tue, 19 Mar 2013 15:38:12 +0000 (11:38 -0400)
lib/mailshears/plugins/roundcube_db.rb

index d563a244fcaa3fd3c25beb45f093bc7d2486352d..7d1a037623ecf75092162d7cdf77c30897b7c092 100644 (file)
@@ -40,28 +40,16 @@ class RoundcubeDb
     # belonging to it.
     user_id = self.get_user_id(account)
 
     # 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:
+    # 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
     #
     #
     #  ...
     #  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 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;'
+    # This query is of course necessary with any DBMS:
+    sql_queries = ['DELETE FROM users WHERE user_id = $1::int;']
 
     begin
       connection = PGconn.connect(@db_host,
 
     begin
       connection = PGconn.connect(@db_host,