From 9ca7ae050eefe4efd68d705f746fce6f92943948 Mon Sep 17 00:00:00 2001 From: Christian Boltz Date: Sat, 4 Apr 2015 14:20:57 +0000 Subject: [PATCH] Two upgrades for FetchmailHandler: - upgrade_1762: add 'domain', 'active', 'created' and 'modified' fields to fetchmail table (used by FetchmailHandler) - upgrade_1763: fill fetchmail.domain based on mailbox git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1763 a1433add-5e2c-0410-b055-b7f2511e0802 --- upgrade.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/upgrade.php b/upgrade.php index 978cf6ec..9f5437e5 100644 --- a/upgrade.php +++ b/upgrade.php @@ -1369,6 +1369,18 @@ function upgrade_1685_pgsql() { db_query_parsed("UPDATE $table SET domain=SPLIT_PART(domain, '@', 2) WHERE domain=data;"); } +function upgrade_1762() { + _db_add_field('fetchmail', 'domain', "VARCHAR(255) {LATIN1} DEFAULT ''", 'id'); + _db_add_field('fetchmail', 'active', '{BOOLEAN}', 'date'); + _db_add_field('fetchmail', 'created', '{DATE}', 'date'); + _db_add_field('fetchmail', 'modified', '{DATECURRENT}', 'created'); +} + +function upgrade_1763() { + $table = table_by_key('fetchmail'); + db_query_parsed("UPDATE $table SET domain=SUBSTRING_INDEX(mailbox, '@', -1) WHERE domain='';"); +} + # TODO MySQL: # - various varchar fields do not have a default value