如何將MySQL 架構轉換為GitHub Wiki Markdown
挑戰:
模式轉換為Markdown格式以用於文件解決方案:
利用兩個預存程序來完成此任務:第一個預存程序(describeTables_v2a):
此程序從指定資料庫中提取模式信息,準備並將其儲存在基於會話的表中。第二個預存程序 (Print_Tables_Like_Describe):
此程序為指定的所有表格產生類似 MySQL 的 DESCRIBE語句的輸出用法:
範例:
SET @theOutVar =-1; -- A variable used as the OUT variable below -- Call describeTables_v2a with auto-calling enabled call Reporting101a.describeTables_v2a('stackoverflow', @theOutVar, false, true);
輸出:
輸出會類似以下內容:+--------------------------------------------------------------------------------------------+ | | +--------------------------------------------------------------------------------------------+ | course | | +------------+--------------+------+-----+---------+-------------------+ | | Field | Type | Null | Key | Default | Extra | | +------------+--------------+------+-----+---------+-------------------+ | | courseId | int(11) | NO | PRI | | auto_increment | | +------------+--------------+------+-----+---------+-------------------+ | | deptId | int(11) | NO | MUL | | | | +------------+--------------+------+-----+---------+-------------------+ | | courseName | varchar(100) | NO | | | | | +------------+--------------+------+-----+---------+-------------------+ | | | dept | | +----------+--------------+------+-----+---------+-------------------+ | | Field | Type | Null | Key | Default | Extra | | +----------+--------------+------+-----+---------+-------------------+ | | deptId | int(11) | NO | PRI | | auto_increment | | +----------+--------------+------+-----+---------+-------------------+ | | deptName | varchar(100) | NO | | | | | +----------+--------------+------+-----+---------+-------------------+ | | | scjunction | | +------------+---------+------+-----+---------+-------------------+ | | Field | Type | Null | Key | Default | Extra | | +------------+---------+------+-----+---------+-------------------+ | | id | int(11) | NO | PRI | | auto_increment | | +------------+---------+------+-----+---------+-------------------+ | | studentId | int(11) | NO | MUL | | | | +------------+---------+------+-----+---------+-------------------+ | | courseId | int(11) | NO | MUL | | | | +------------+---------+------+-----+---------+-------------------+ | | term | int(11) | NO | | | | | +------------+---------+------+-----+---------+-------------------+ | | attendance | int(11) | NO | | | |以上是如何使用預存程序將 MySQL 架構轉換為 GitHub Wiki Markdown?的詳細內容。更多資訊請關注PHP中文網其他相關文章!