Remove int width from db schema (MySQL 8) (#11725)

* Remove width from db schema

* Update to address DEFAULT_GENERATED validation, and push new schema

* Only remove width from integer types

* Build from fresh db

Co-authored-by: Tony Murray <murraytony@gmail.com>
This commit is contained in:
arrmo
2020-05-30 17:06:53 -05:00
committed by GitHub
parent 24b6222712
commit 67cb7b4dc3
2 changed files with 728 additions and 724 deletions

View File

@ -2238,7 +2238,7 @@ function dump_db_schema($connection = null)
foreach (DB::connection($connection)->select(DB::raw("SELECT COLUMN_NAME, COLUMN_TYPE, IS_NULLABLE, COLUMN_DEFAULT, EXTRA FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = '$db_name' AND TABLE_NAME='$table'")) as $data) {
$def = [
'Field' => $data->COLUMN_NAME,
'Type' => $data->COLUMN_TYPE,
'Type' => preg_replace('/int\([0-9]+\)/', 'int', $data->COLUMN_TYPE),
'Null' => $data->IS_NULLABLE === 'YES',
'Extra' => str_replace('current_timestamp()', 'CURRENT_TIMESTAMP', $data->EXTRA),
];
@ -2247,6 +2247,10 @@ function dump_db_schema($connection = null)
$default = trim($data->COLUMN_DEFAULT, "'");
$def['Default'] = str_replace('current_timestamp()', 'CURRENT_TIMESTAMP', $default);
}
// MySQL 8 fix, remove DEFAULT_GENERATED from timestamp extra columns
if ($def['Type'] == 'timestamp') {
$def['Extra'] = preg_replace("/DEFAULT_GENERATED[ ]*/", '', $def['Extra']);
}
$output[$table]['Columns'][] = $def;
}

File diff suppressed because it is too large Load Diff