Sybase Powerdesigner - 如何自动格式化PK和FK的命名? [英] Sybase Powerdesigner - how to automatically format naming of PK and FK?

查看:1026
本文介绍了Sybase Powerdesigner - 如何自动格式化PK和FK的命名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Sybase Powerdesigner - 如何自动格式化PK和FK的命名?

Sybase Powerdesigner - how to automatically format naming of PK and FK?

运行脚本以格式化主键和外键

Run script to format primary key and foreign key like this format

PK_TABLENAME

FK_PARENT_CHILD


b $ b

示例

PK_Post

FK_Post_Comment


推荐答案

至少对于外键,事件处理程序从附加的表定义名称。在图中创建引用时,它将工作;

At least for a Foreign-Key, you can create an Initialize event handler to define the name from the attached tables. It will work when you create a Reference in a diagram; maybe not when you create it through a list (as the tables won't be attached yet).

我作为一个练习处理名称冲突...

I leave as an exercise dealing with the name collisions...

对于主键,您可以在Key元类上使用Validate事件处理程序,并在Key变为Primary时重命名该键(除非它的名称已经以PK开头)。

For a Primary Key, you could use a Validate event handler on the Key metaclass, and rename the Key when it becomes Primary (unless its name already starts with "PK").

这篇关于Sybase Powerdesigner - 如何自动格式化PK和FK的命名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆