update_tables_0.3.x-0.4.py
changeset 15 1607f7b2dba9
parent 13 1d9bf63a86f7
child 20 55146c78b3fb
--- a/update_tables_0.3.x-0.4.py	Sun Apr 06 21:36:00 2008 +0000
+++ b/update_tables_0.3.x-0.4.py	Thu Apr 10 03:24:12 2008 +0000
@@ -108,12 +108,16 @@
             LEFT JOIN maillocation USING (mid)""")
 dbh.commit()
 
-# Update VIEW dovecot_user
+# Replace VIEW dovecot_user
+dbc.execute("DROP VIEW dovecot_user")
+dbh.commit()
 dbc.execute("""CREATE OR REPLACE VIEW dovecot_user AS
     SELECT local_part || '@' || domains.domainname AS userid,
-           domains.domaindir || '/' || uid AS home, uid, gid
+           uid, gid, domains.domaindir || '/' || uid AS home,
+           '~/' || maillocation.maillocation AS mail
       FROM users
-           LEFT JOIN domains USING (gid)""")
+           LEFT JOIN domains USING (gid)
+           LEFT JOIN maillocation USING (mid);""")
 dbh.commit()
 
 # fix table users (Part II)