PowerDesigner LDM/PDM 中的自动重命名列
我想根据主复选框的状态重命名 PowerDesigner LDM/PDM 中的列。更具体地说,如果选中 Primary,我希望将该列从“oldname”重命名为“id_oldname”。
我认为可以使用自定义检查/自动修复脚本,例如“MSSQLSRV2008::Profile\Column\Custom Checks\Identity Seed and Incrementvalidity”中的脚本,但我真的不是 VBScript 专家:)
有没有一种简单的方法可以在 PowerDesigner 15 中实现这一点吗?
I want to rename columns in a PowerDesigner LDM/PDM according to the state of the Primary checkbox. To be more specific, I want the column renamed from "oldname" to "id_oldname" if Primary is checked.
I think it is possible with a custom check/autofix script like the one in "MSSQLSRV2008::Profile\Column\Custom Checks\Identity Seed and Increment validity" but I'm really not a VBScript expert :)
Is there an easy way to achieve that in PowerDesigner 15?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
解决方案非常简单。不幸的是,这并不是一个完美的方案,因为 PowerDesigner 在某些情况下(由于某种未知的原因)无法执行事件处理程序。下面的小vb脚本应该能够处理它。将创建扩展模型定义文件并将其附加到项目中。该脚本是表元类的验证事件处理程序(尽管它是自动修复而不是验证)。
这要归功于提供原始代码的 Richard Kier。谢谢,理查德。
The solution is quite simple. Unfortunately not a flawless one, because PowerDesigner fails to execute the event handler in some cases (for some unknown reason). The small vbscript below should be able to handle it. An extended model definition file is to be created and attached to the project. The script is a Validate Event Handler of the Table metaclass (though it's rather an autofix than a validation).
The credit goes to Richard Kier who supplied the original code. Thanks, Richard.
人们可以编写 VBScript 来搜索对象模型,查找作为主键成员的列并重命名它们。
或者:
可以调出一列列表
(右键单击一个包或
型号、列表->列)
按 control-U(或单击
漏斗和铅笔图标)来调出
自定义列和过滤器。
其他行已检查。
您现在应该看到作为键一部分的所有列。您可以类似地使用通配符过滤不合规的名称。您还可以选择多行并同时重命名它们。
One can write the VBScript to trawl the object model, looking for columns that are members of primary keys and renaming them.
Or:
One can bring up a list of columns
(Right click on a package or the
model, List of -> Columns)
Press control-U (or click on the
funnel-and-pencil icon) to bring up
Customize Columns and Filter.
other rows have that checked.
You should now see all the columns that are part of keys. You can similarly filter with wildcards for non-compliant names. You can also select multiple rows and rename them at the same time.
有一个更简单的方法。
该工具显示更新后的模型。
There is a much simpler method to this.
The tool shows the updated model.