6

PowerDesigner反向导入表+PowerDesigner的ER图设计+PowerDesigner连接外键的线(版本1...

 2 years ago
source link: https://www.cnblogs.com/kakarotto-chen/p/17528286.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client



使用PowerDesigner导入表+PowerDesigner画ER图+PowerDesigner设置外键

①ER图:就是PD中的 Physical Diagram


一、导入表,并设置备注为PD中的显示名称

1、新建数据库模型

image

image

2、导入表——见参考

  • 最好每张表都把生成主键的名字修改了,不然会产生错误的字段
-- 建表语句1_未修改前的CREATE TABLE "TABLE_1"("COLUMN_11" CHAR(10),"ID" CHAR(32) NOT NULL,"AGE" NUMBER(22,6),"C_2222" CHAR(10),UNIQUE("AGE"),NOT CLUSTER PRIMARY KEY("ID")) STORAGE(ON "MAIN", CLUSTERBTR) ; COMMENT ON COLUMN "TABLE_1"."AGE" IS 'CS_AA';COMMENT ON COLUMN "TABLE_1"."COLUMN_11" IS 'CS_11';COMMENT ON COLUMN "TABLE_1"."C_2222" IS 'CS_';COMMENT ON COLUMN "TABLE_1"."ID" IS 'CS_DD'; -- 建表语句2_修改之后的-- 主键的名字规则:PK_表名CREATE TABLE "TABLE_1"("COLUMN_11" CHAR(10),"ID" CHAR(32) NOT NULL,"AGE" NUMBER(22,6),"C_2222" CHAR(10),UNIQUE("AGE"),constraint PK_CS1 PRIMARY KEY("ID")) STORAGE(ON "MAIN", CLUSTERBTR) ; COMMENT ON COLUMN "TABLE_1"."AGE" IS 'CS_AA';COMMENT ON COLUMN "TABLE_1"."COLUMN_11" IS 'CS_11';COMMENT ON COLUMN "TABLE_1"."C_2222" IS 'CS_';COMMENT ON COLUMN "TABLE_1"."ID" IS 'CS_DD';

修改详情:

image
  • 脚本
    • 使用字段备注当做pd中的显示名的脚本
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 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="" then 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

1、参考——规范:

设计规范——有需要的私我。或者评论

2、新建ER图

image

image

3、连接有外键关系的两张表(同一张表出现在不同的ER图中的情况)

①工具栏中的这个图标,可以把拖入ER图的有外键关联的表连接起来。

——这个功能适用于,同一张表出现在不同的ER图中。

image

呼出界面:

image

②其他工具栏:

image

4、绘制外键的线

参考:https://www.somode.com/jiaocheng/36995.html

4.1、打开面板

  • 找到 References

image

image

4.2、外键设置

①、如Table_2(从表) 中的 TABLE_ID 是 TABLE_1(主表) 的 ID 的外键。

image

②、双击连线,设置如下:

  • 设置外键名字

image
  • 设置是否在生成sql的时候生成外键。(不生成表示:只有ER图展示,sql中不会有)

image
  • 配置字段:选择子表、父表的字段

image

image

见①。子表的外键字段出现 <FK> 就是对的

4.3、显示外键线上的名字

参考:https://www.cnblogs.com/EasonJim/p/4715282.html

image

image

image

5、格式设置

5.1、把table1的格式弄到table2上。

image

5.2、给外键的线赋予格式

image

5.3、获取格式、应用格式

image

②操作步奏:

image

image

image

image

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK