有沒有小夥伴遇到過數據庫表特別多 梳理起來很麻煩 最近研究了下 powerdesigner 反向工程 發現真的很實用
,這篇帖子對大家很有用 親測可用,如果帖子失效 就看我的吧 哈哈哈!!!
https://www.cnblogs.com/xmyjcs/p/8536233.html
步驟一:下載odbc驅動並進行安裝:
(1)下載
mysql-connector-odbc-5.3.4-win32
注意:不管電腦是32位,還是64位,統一安裝32位即可。
(2)安裝
步驟二:odbcad32.exe添加數據源
找到C:\Windows\SysWOW64目錄下找到odbcad32.exe這個文件
在這裏插入圖片描述
雙擊打開,彈出ODBC數據源管理界面
點擊添加按鈕,在彈出的窗口中選中,安裝好的驅動:
點擊完成,彈出數據庫信息創建窗體:
點擊後Ok後,即可以看到新增加了選項:
配置完成。
步驟三:數據庫導出爲Sql腳本文件
步驟四:打開PowerDesigner軟件,進行導入生成模型
A、選擇菜單,導入數據源
B.選擇數據庫版本
C.點擊添加Sql文件
D.點擊確定後,即可進行轉換,生成想要的數據庫模型
步驟五,設置顯示備註信息:
A、雙擊表,進入編輯模式,注意:表和列記得添加註釋,如下圖所示:
點擊下圖按鈕:
B、勾選Comment的多選框
C、打開執行腳本編輯窗口
D、執行以下VBS腳本:
複製代碼
Option Explicit
ValidationMode = True
InteractiveMode = im_Batch
Dim blankStr
blankStr = Space(1)
Dim mdl ’ the current model
' get the current active model
Set mdl = ActiveModel
If (mdl Is Nothing) Then
MsgBox "There is no current Model "
ElseIf Not mdl.IsKindOf(PdPDM.cls_Model) Then
MsgBox "The current model is not an Physical Data model. "
Else
ProcessFolder mdl
End If
Private sub ProcessFolder(folder)
On Error Resume Next
Dim Tab 'running table
for each Tab in folder.tables
if not tab.isShortcut then
tab.name = tab.comment
Dim col ' running column
for each col in tab.columns
if col.comment = "" or replace(col.comment," ", "")="" Then
col.name = blankStr
blankStr = blankStr & Space(1)
else
col.name = col.comment
end if
next
end if
next
Dim view 'running view
for each view in folder.Views
if not view.isShortcut then
view.name = view.comment
end if
next
' go into the sub-packages
Dim f ' running folder
For Each f In folder.Packages
if not f.IsShortcut then
ProcessFolder f
end if
Next
end sub
複製代碼
E、執行後,即可發現註釋已經正常現示:
步驟六:顯示原字段名
點擊Ok後,會彈出確認框,默認選擇確定後即可看到效果:
步驟七:更改顯示的順序:
調整後效果:
數據庫反向生成模型結束!