add password expiry stuff to the db schema upgrade script

pull/200/head
David Goodwin 7 years ago
parent 8115d8d047
commit a455916a6b

@ -88,11 +88,11 @@ function _upgrade_filter_function($name) {
return preg_match('/upgrade_[\d]+(_mysql|_pgsql|_sqlite|_mysql_pgsql)?$/', $name) == 1; return preg_match('/upgrade_[\d]+(_mysql|_pgsql|_sqlite|_mysql_pgsql)?$/', $name) == 1;
} }
function _db_add_field($table, $field, $fieldtype, $after) { function _db_add_field($table, $field, $fieldtype, $after = '') {
global $CONF; global $CONF;
$query = "ALTER TABLE " . table_by_key($table) . " ADD COLUMN $field $fieldtype"; $query = "ALTER TABLE " . table_by_key($table) . " ADD COLUMN $field $fieldtype";
if ($CONF['database_type'] == 'mysql') { if ($CONF['database_type'] == 'mysql' && !empty($after)) {
$query .= " AFTER $after "; # PgSQL does not support to specify where to add the column, MySQL does $query .= " AFTER $after "; # PgSQL does not support to specify where to add the column, MySQL does
} }
@ -1760,3 +1760,8 @@ function upgrade_1841_sqlite() {
_db_add_field($table, 'token_validity', '{DATETIME}', 'token'); _db_add_field($table, 'token_validity', '{DATETIME}', 'token');
} }
} }
function upgrade_1842() {
_db_add_field('mailbox', 'password_expiry', "{DATETIME}"); // when a specific mailbox password expires
_db_add_field('domain', 'password_expiry', 'int DEFAULT 0'); // expiry applied to mailboxes within that domain
}

Loading…
Cancel
Save