pgsql: Updated view vmm_domain_info. No longer select data we have already. v0.6.x
authorPascal Volk <neverseen@users.sourceforge.net>
Thu, 10 Feb 2011 23:33:57 +0000
branchv0.6.x
changeset 391 8217ddd5220d
parent 390 660b42391c8e
child 392 ffce67e3c6eb
pgsql: Updated view vmm_domain_info. No longer select data we have already.
pgsql/create_tables-dovecot-1.2.x.pgsql
pgsql/create_tables.pgsql
pgsql/update_tables_0.5.x-0.6-dovecot-1.2.x.pgsql
pgsql/update_tables_0.5.x-0.6.pgsql
--- a/pgsql/create_tables-dovecot-1.2.x.pgsql	Thu Feb 10 20:10:28 2011 +0000
+++ b/pgsql/create_tables-dovecot-1.2.x.pgsql	Thu Feb 10 23:33:57 2011 +0000
@@ -192,8 +192,7 @@
            LEFT JOIN domain_name USING (gid);
 
 CREATE OR REPLACE VIEW vmm_domain_info AS
-    SELECT gid, domainname, transport, domaindir,
-           count(uid) AS accounts,
+    SELECT gid, count(uid) AS accounts,
            (SELECT count(DISTINCT address)
               FROM alias
              WHERE alias.gid = domain_data.gid) AS aliases,
@@ -203,15 +202,12 @@
            (SELECT count(gid)
               FROM domain_name
              WHERE domain_name.gid = domain_data.gid
-               AND NOT domain_name.is_primary) AS aliasdomains,
-           bytes, messages
+               AND NOT domain_name.is_primary) AS aliasdomains
       FROM domain_data
            LEFT JOIN domain_name USING (gid)
-           LEFT JOIN quotalimit USING (qid)
-           LEFT JOIN transport USING (tid)
            LEFT JOIN users USING (gid)
      WHERE domain_name.is_primary
-  GROUP BY gid, domainname, transport, domaindir, bytes, messages;
+  GROUP BY gid;
 
 
 CREATE LANGUAGE plpgsql;
--- a/pgsql/create_tables.pgsql	Thu Feb 10 20:10:28 2011 +0000
+++ b/pgsql/create_tables.pgsql	Thu Feb 10 23:33:57 2011 +0000
@@ -192,8 +192,7 @@
            LEFT JOIN domain_name USING (gid);
 
 CREATE OR REPLACE VIEW vmm_domain_info AS
-    SELECT gid, domainname, transport, domaindir,
-           count(uid) AS accounts,
+    SELECT gid, count(uid) AS accounts,
            (SELECT count(DISTINCT address)
               FROM alias
              WHERE alias.gid = domain_data.gid) AS aliases,
@@ -203,15 +202,12 @@
            (SELECT count(gid)
               FROM domain_name
              WHERE domain_name.gid = domain_data.gid
-               AND NOT domain_name.is_primary) AS aliasdomains,
-           bytes, messages
+               AND NOT domain_name.is_primary) AS aliasdomains
       FROM domain_data
            LEFT JOIN domain_name USING (gid)
-           LEFT JOIN quotalimit USING (qid)
-           LEFT JOIN transport USING (tid)
            LEFT JOIN users USING (gid)
      WHERE domain_name.is_primary
-  GROUP BY gid, domainname, transport, domaindir, bytes, messages;
+  GROUP BY gid;
 
 
 CREATE LANGUAGE plpgsql;
--- a/pgsql/update_tables_0.5.x-0.6-dovecot-1.2.x.pgsql	Thu Feb 10 20:10:28 2011 +0000
+++ b/pgsql/update_tables_0.5.x-0.6-dovecot-1.2.x.pgsql	Thu Feb 10 23:33:57 2011 +0000
@@ -20,6 +20,7 @@
 -- ---
 DROP VIEW dovecot_user;
 DROP VIEW postfix_maildir;
+DROP VIEW vmm_domain_info;
 
 CREATE SEQUENCE mailboxformat_id;
 CREATE SEQUENCE quotalimit_id;
@@ -136,9 +137,8 @@
            LEFT JOIN domain_name USING (gid)
            LEFT JOIN maillocation USING (mid);
 
-CREATE OR REPLACE VIEW vmm_domain_info AS
-    SELECT gid, domainname, transport, domaindir,
-           count(uid) AS accounts,
+CREATE VIEW vmm_domain_info AS
+    SELECT gid, count(uid) AS accounts,
            (SELECT count(DISTINCT address)
               FROM alias
              WHERE alias.gid = domain_data.gid) AS aliases,
@@ -148,12 +148,9 @@
            (SELECT count(gid)
               FROM domain_name
              WHERE domain_name.gid = domain_data.gid
-               AND NOT domain_name.is_primary) AS aliasdomains,
-           bytes, messages
+               AND NOT domain_name.is_primary) AS aliasdomains
       FROM domain_data
            LEFT JOIN domain_name USING (gid)
-           LEFT JOIN quotalimit USING (qid)
-           LEFT JOIN transport USING (tid)
            LEFT JOIN users USING (gid)
      WHERE domain_name.is_primary
-  GROUP BY gid, domainname, transport, domaindir, bytes, messages;
+  GROUP BY gid;
--- a/pgsql/update_tables_0.5.x-0.6.pgsql	Thu Feb 10 20:10:28 2011 +0000
+++ b/pgsql/update_tables_0.5.x-0.6.pgsql	Thu Feb 10 23:33:57 2011 +0000
@@ -20,6 +20,7 @@
 -- ---
 DROP VIEW dovecot_user;
 DROP VIEW postfix_maildir;
+DROP VIEW vmm_domain_info;
 
 CREATE SEQUENCE mailboxformat_id;
 CREATE SEQUENCE quotalimit_id;
@@ -114,9 +115,8 @@
            LEFT JOIN domain_name USING (gid)
            LEFT JOIN maillocation USING (mid);
 
-CREATE OR REPLACE VIEW vmm_domain_info AS
-    SELECT gid, domainname, transport, domaindir,
-           count(uid) AS accounts,
+CREATE VIEW vmm_domain_info AS
+    SELECT gid, count(uid) AS accounts,
            (SELECT count(DISTINCT address)
               FROM alias
              WHERE alias.gid = domain_data.gid) AS aliases,
@@ -126,12 +126,9 @@
            (SELECT count(gid)
               FROM domain_name
              WHERE domain_name.gid = domain_data.gid
-               AND NOT domain_name.is_primary) AS aliasdomains,
-           bytes, messages
+               AND NOT domain_name.is_primary) AS aliasdomains
       FROM domain_data
            LEFT JOIN domain_name USING (gid)
-           LEFT JOIN quotalimit USING (qid)
-           LEFT JOIN transport USING (tid)
            LEFT JOIN users USING (gid)
      WHERE domain_name.is_primary
-  GROUP BY gid, domainname, transport, domaindir, bytes, messages;
+  GROUP BY gid;