使用lavavel框架自動生成資料字典
foreach (DB::getDoctrineSchemaManager()->listTables() as $key => $val) {
$tables[$key]['TABLE_NAME'] = $val->getName();
$tables[$key]['TABLE_COMMENT'] = $val->getOptions()['comment'];
foreach (DB::getDoctrineSchemaManager()->listTableColumns($val->getName()) as $detail) {
$tables[$key]['COLUMN'][] = [
'COLUMN_COMMENT' => $detail->getComment(), 'COLUMN_NAME' => $detail->getName(),
'COLUMN_TYPE' => $detail->getType()->getName(), 'COLUMN_DEFAULT' => $detail->getDefault(),
'IS_NULLABLE' => $detail->getNotnull(), 'EXTRA' => $detail->getAutoincrement(),
];
}
}
本作品採用《CC 協議》,轉載必須註明作者和本文連結