Visio支援資料庫建模,但是professional版本不包含正向工程功能,即無法產生sql。這真是令人痛恨,還好有OrthogonalToolBox這樣的工具。這是一個非常有趣的軟體,安裝之後它並沒有程式功能表項目,無法直接啟動,而是在其它應用程式裡增加一個工具條。
可以在OrthogonalToolBox 裡開啟一個visio建立的資料庫模型,然後將其匯出成xml,並選擇"ER to SQL XSLT Transform"這個xslt作為style。然後在IE裡開啟這個XML,就可以看到sql代碼了。
這個XSLT是為MS SQL Server設計的,但是將其修改成產生其它資料庫的sql也很簡單,或者直接在產生的sql文本上做Regex替換也是個不錯的主意。
http://blog.csdn.net/pinxue/archive/2006/10/05/1322090.aspx
Installation Instructions
To install Orthogonal Toolbox:
- Download the zip file and extract the contents of the zip file to any (temporary) location.
- Run (Start | Run… then Browse… to the extract location) setup.exe.
- Follow the instructions of the installation utility.
- Once installation is complete, you can access Orthogonal Toolbox by opening/creating an ORM Source Model and/or a Database Model Diagram within Visio.
- Look for the toolbar titled “Orthogonal Toolbox”. If the toolbar is not visible, it can be made visible via View | Toolbars | Orthogonal Toolbox.
- Once the toolbar is visible, you can use the utility by clicking the button labeled “Orthogonal Toolbox”.