it should work now

This commit is contained in:
Michael 2017-04-14 11:26:47 +00:00
parent fdcb6d3c6f
commit 2930601719
1 changed files with 9 additions and 8 deletions

View File

@ -163,7 +163,7 @@ function update_structure($verbose, $action, $tables=null, $definition=null) {
if ($action) { if ($action) {
Config::set('system', 'maintenance', 1); Config::set('system', 'maintenance', 1);
Config::set('system', 'maintenance_reason', 'Database update'); Config::set('system', 'maintenance_reason', sprintf(t(': Database update'), dbm::date().' '.date('e')));
} }
$errors = false; $errors = false;
@ -352,6 +352,8 @@ function update_structure($verbose, $action, $tables=null, $definition=null) {
} }
if ($action) { if ($action) {
Config::set('system', 'maintenance_reason', sprintf(t('%s: updating %s table.'), dbm::date().' '.date('e'), $name));
// Ensure index conversion to unique removes duplicates // Ensure index conversion to unique removes duplicates
if ($is_unique) { if ($is_unique) {
if ($ignore != "") { if ($ignore != "") {
@ -402,9 +404,13 @@ function update_structure($verbose, $action, $tables=null, $definition=null) {
return $errors; return $errors;
} }
function db_field_command($parameters, $create = true) { function db_field_command($parameters, $collation = null, $create = true) {
$fieldstruct = $parameters["type"]; $fieldstruct = $parameters["type"];
if (!is_null($collation)) {
$fieldstruct .= " CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci";
}
if ($parameters["not null"]) if ($parameters["not null"])
$fieldstruct .= " NOT NULL"; $fieldstruct .= " NOT NULL";
@ -465,12 +471,7 @@ function db_add_table_field($fieldname, $parameters) {
} }
function db_modify_table_field($fieldname, $parameters, $collation) { function db_modify_table_field($fieldname, $parameters, $collation) {
$sql = sprintf("MODIFY `%s` %s", dbesc($fieldname), db_field_command($parameters, false)); $sql = sprintf("MODIFY `%s` %s", dbesc($fieldname), db_field_command($parameters, $collation, false));
if (!is_null($collation) AND ($collation != 'utf8mb4_general_ci')) {
$sql .= " CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci";
}
return($sql); return($sql);
} }