mirror of
https://github.com/vrana/adminer.git
synced 2025-08-10 16:44:17 +02:00
MariaDB: Fix creating and altering generated columns (fixes #897)
This commit is contained in:
@@ -786,12 +786,14 @@ if (!defined('Adminer\DRIVER')) {
|
||||
* @return bool
|
||||
*/
|
||||
function alter_table($table, $name, $fields, $foreign, $comment, $engine, $collation, $auto_increment, $partitioning) {
|
||||
global $connection;
|
||||
$alter = array();
|
||||
foreach ($fields as $field) {
|
||||
if ($field[1]) {
|
||||
$default = $field[1][3];
|
||||
if (preg_match('~ GENERATED~', $default)) {
|
||||
$field[1][3] = $field[1][2];
|
||||
// swap default and null
|
||||
$field[1][3] = (preg_match('~MariaDB~', $connection->server_info) ? "" : $field[1][2]); // MariaDB doesn't support NULL on virtual columns
|
||||
$field[1][2] = $default;
|
||||
}
|
||||
$alter[] = ($table != "" ? ($field[0] != "" ? "CHANGE " . idf_escape($field[0]) : "ADD") : " ") . " " . implode($field[1]) . ($table != "" ? $field[2] : "");
|
||||
|
@@ -2,6 +2,7 @@ Adminer dev:
|
||||
Fix gzip export (bug #896)
|
||||
Fix importing multiple SQL files not terminated by semicolon
|
||||
Use <datalist> for altering collations
|
||||
MariaDB: Fix creating and altering generated columns (bug #897)
|
||||
|
||||
Adminer 5.0.2 (released 2025-03-10):
|
||||
PostgreSQL: Fix setting NULL and original value on enum (bug #884)
|
||||
|
Reference in New Issue
Block a user