mirror of
http://124.126.16.154:8888/singularity/hyperf-admin.git
synced 2026-01-15 03:35:07 +08:00
Merge pull request #11 from feraner/master
兼容 mysql8.0 table_type 是枚举类型bug
This commit is contained in:
@@ -296,13 +296,13 @@ class DevController extends AbstractController
|
||||
$ret = [];
|
||||
$ignores = ['id', 'create_at', 'update_at', 'is_deleted'];
|
||||
foreach ($schema as $item) {
|
||||
if (in_array($item['column_name'], $ignores)) {
|
||||
if (in_array($item['COLUMN_NAME'], $ignores)) {
|
||||
continue;
|
||||
}
|
||||
$ret[] = [
|
||||
'field' => $item['column_name'],
|
||||
'label' => $item['column_comment'],
|
||||
'type' => $this->transType($item['data_type']),
|
||||
'field' => $item['COLUMN_NAME'],
|
||||
'label' => $item['COLUMN_COMMENT'],
|
||||
'type' => $this->transType($item['DATA_TYPE']),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -316,6 +316,10 @@ class DevController extends AbstractController
|
||||
return 'datetime';
|
||||
case 'bigint':
|
||||
return 'number';
|
||||
case 'text':
|
||||
return 'html';
|
||||
case 'enum':
|
||||
return 'radio';
|
||||
default:
|
||||
return 'input';
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ class ModelMaker extends AbstractMaker
|
||||
return false;
|
||||
}
|
||||
$columns = array_values(array_filter(array_map(function ($item) {
|
||||
if(in_array($item['column_name'], [
|
||||
if(in_array($item['COLUMN_NAME'], [
|
||||
'create_at',
|
||||
'update_at',
|
||||
'is_deleted',
|
||||
@@ -30,7 +30,7 @@ class ModelMaker extends AbstractMaker
|
||||
return null;
|
||||
}
|
||||
|
||||
return $item['column_name'];
|
||||
return $item['COLUMN_NAME'];
|
||||
}, $schema)));
|
||||
$class_namespace = $this->pathToNamespace($path) . '\\' . Str::studly($database);
|
||||
$class_name = Str::studly($table);
|
||||
@@ -68,10 +68,10 @@ class ModelMaker extends AbstractMaker
|
||||
|
||||
protected function getProperty($column): array
|
||||
{
|
||||
$name = $column['column_name'];
|
||||
$type = $this->formatPropertyType($column['data_type'], $column['cast'] ?? null);
|
||||
$name = $column['COLUMN_NAME'];
|
||||
$type = $this->formatPropertyType($column['DATA_TYPE'], $column['cast'] ?? null);
|
||||
|
||||
return [$name, $type, $column['column_comment']];
|
||||
return [$name, $type, $column['COLUMN_COMMENT']];
|
||||
}
|
||||
|
||||
protected function formatDatabaseType(string $type): ?string
|
||||
|
||||
@@ -25,7 +25,7 @@ class TableSchema
|
||||
$builder = $this->getSchemaBuilder($pool);
|
||||
|
||||
return $builder->getConnection()
|
||||
->select('select `column_name`, `data_type`, `column_comment` from information_schema.columns where `table_schema` = ? and `table_name` = ? order by ORDINAL_POSITION', [
|
||||
->select('select `COLUMN_NAME`, `DATA_TYPE`, `COLUMN_COMMENT` from information_schema.COLUMNS where `TABLE_SCHEMA` = ? and `TABLE_NAME` = ? order by ORDINAL_POSITION', [
|
||||
$database,
|
||||
$table_name,
|
||||
]);
|
||||
@@ -48,11 +48,11 @@ class TableSchema
|
||||
{
|
||||
$builder = $this->getSchemaBuilder($pool);
|
||||
$ret = $builder->getConnection()
|
||||
->select("select table_name from information_schema.tables where table_schema=? and table_type='base table';", [
|
||||
->select("select TABLE_NAME from information_schema.tables where table_schema=? and table_type='BASE TABLE';", [
|
||||
$database,
|
||||
]);
|
||||
|
||||
return array_column($ret ?? [], 'table_name');
|
||||
return array_column($ret ?? [], 'TABLE_NAME');
|
||||
}
|
||||
|
||||
public function tableDesign($pool, $database, $table_name)
|
||||
|
||||
Reference in New Issue
Block a user