pgsql/update_tables_0.5.x-0.6.pgsql
branchv0.6.x
changeset 500 5ccc9c6e5193
parent 437 9823548b2717
child 502 e1b32377032f
--- a/pgsql/update_tables_0.5.x-0.6.pgsql	Sun Apr 08 13:18:02 2012 +0200
+++ b/pgsql/update_tables_0.5.x-0.6.pgsql	Sun Apr 08 16:20:43 2012 +0000
@@ -36,11 +36,16 @@
 \.
 
 -- ---
--- Make room for different mailbox formats and longer password hashes.
+-- Drop the obsolete VIEWs, we've functions now.
 -- ---
 DROP VIEW dovecot_user;
 DROP VIEW dovecot_password;
+DROP VIEW postfix_alias;
 DROP VIEW postfix_maildir;
+DROP VIEW postfix_relocated;
+DROP VIEW postfix_transport;
+DROP VIEW postfix_uid;
+-- the vmm_domain_info view will be restored later
 DROP VIEW vmm_domain_info;
 
 CREATE SEQUENCE mailboxformat_id;
@@ -138,34 +143,8 @@
     FOREIGN KEY (ssid) REFERENCES service_set (ssid);
 
 -- ---
--- Restore views
+-- Restore view
 -- ---
-CREATE VIEW dovecot_user AS
-    SELECT local_part || '@' || domain_name.domainname AS userid,
-           uid, gid, domain_data.domaindir || '/' || uid AS home,
-           mailboxformat.format || ':~/' || maillocation.directory AS mail
-      FROM users
-           LEFT JOIN domain_data USING (gid)
-           LEFT JOIN domain_name USING (gid)
-           LEFT JOIN maillocation USING (mid)
-           LEFT JOIN mailboxformat USING (fid);
-
-CREATE OR REPLACE VIEW dovecot_password AS
-    SELECT local_part || '@' || domainname AS "user",
-           passwd AS "password", smtp, pop3, imap, managesieve
-      FROM users
-           LEFT JOIN domain_name USING (gid)
-           LEFT JOIN service_set USING (ssid);
-
-CREATE VIEW postfix_maildir AS
-    SELECT local_part || '@' || domain_name.domainname AS address,
-           domain_data.domaindir||'/'||uid||'/'||maillocation.directory||'/'
-           AS maildir
-      FROM users
-           LEFT JOIN domain_data USING (gid)
-           LEFT JOIN domain_name USING (gid)
-           LEFT JOIN maillocation USING (mid);
-
 CREATE VIEW vmm_domain_info AS
     SELECT gid, count(uid) AS accounts,
            (SELECT count(DISTINCT address)