总结powerdesigner使用技巧,如取消name和code的联动,去掉双引号等,方便中国用户使用数据库
本身使用的PowerDesigner版本为16.5数据库设计
去掉SQL中的双引号性能
按照图片圈出来的部分操做spa
修改配置设计
取消name和code的联动code
依次选择:Tools->General Operationsblog
出现下图界面,选择Dialog,将图中的复选框选择取消掉图片
在表中显示name和codeci
依次选择:Tools->Display Preferencesget
出现下图界面,选择Table,点击Advanced
根据图中圈出来的部分最终肯定显示的列和前后顺序
最终的显示结果以下:
建立的外键关联不添加物理链接
如今一般作数据库设计的时候再也不须要外键,由于外键会严重下降性能,但powerdesigner的默认配置在使用外键时会自动添加物理链接,并且删除外键的时候会自动删掉列,这让人很痛苦,后来发现用两种方式能够避免此问题
1.使用外键-reference(实现),但不建立链接
PowerDesigner中配置外键关系时,若是要删除配置的外键关系,默认设置会一同删除外键列. 要更改此设置,需在菜单栏tools中打开Model Options,在Model Settings中点击Reference, 而后把"Auto-migrate columns"这个checkbox的勾去掉,便可
2.使用追溯-traceability link(虚线),不会生成外键
这样可能以往在视觉上效果不同,但我建议能够这样作,避免别人误认为导出来的脚本是含有外键的
将name字段值放到comment
中国用户为了方便理解,在name字段一般使用中文,最终还但愿将中文添加到备注当中去。下面的操做步骤很是重要
1.设计表的时候先不要去添加任何字段的备注,不然一下子执行脚本将name转换为字段的时候会将以前的备注所有清除掉
2.执行脚本
3.添加个性化的备注,好比约定枚举值等
版本一:name覆盖comment
脚本内容以下:
'****************************************************************************** '* File: name2comment.vbs '* Title: Name to Comment Conversion '* Model: Physical Data Model '* Objects: Table, Column, View '* Author: steveguoshao '* Created: 2013-11-29 '* Mod By: '* Modified: '* Version: 1.0 '* Memo: Modify from name2code.vbs '****************************************************************************** Option Explicit ValidationMode = True InteractiveMode = im_Batch 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 ' This routine copy name into comment for each table, each column and each view ' of the current folder Private sub ProcessFolder(folder) Dim Tab 'running table for each Tab in folder.tables if not tab.isShortcut then tab.comment = tab.name Dim col ' running column for each col in tab.columns col.comment= col.name next end if next Dim view 'running view for each view in folder.Views if not view.isShortcut then view.comment = view.name 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
版本2:若是comment不为空,则用name替换
Option Explicit ValidationMode = True InteractiveMode = im_Batch 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 ' This routine copy name into comment for each table, each column and each view ' of the current folder Private sub ProcessFolder(folder) Dim Tab 'running table for each Tab in folder.tables if not tab.isShortcut then if trim(tab.comment)="" then'若是有表的注释,则不改变它.若是没有表注释.则把name添加到注释里面. tab.comment = tab.name end if Dim col ' running column for each col in tab.columns if trim(col.comment)="" then '若是col的comment为空,则填入name,若是已有注释,则不添加;这样能够避免已有注释丢失. col.comment= col.name end if next end if next Dim view 'running view for each view in folder.Views if not view.isShortcut and trim(view.comment)="" then view.comment = view.name 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
将上面的内容保存到name2comment.vbs中
进入脚本执行界面
打开选择脚本窗口
选择并执行脚本
而后查看你的SQL脚本