powerdesigner看这一篇就够了

1、通过数据库构建PDM

首先创建一个物理模型:file->new model

 Model name:物理模型名称,可以自定义命名,或者使用默认名称

DBMS:物理模型所匹配的数据库

点击确定,生成一个物理模型

2、配置数据库连接

数据库配置支持三种方式:ODBC Machine、ODBC File Data Source、connection file

第一种方式,需要在自己的的计算机安装对应的驱动

控制面板->搜索odbc

 根据自己安装的powerdesigner是32位或者64安装对应的驱动

 下载对应的数据库连接驱动,然后安装,之后在该处点击添加,添加成功后到powerdesigner进行配置

Database->Configure connections

点击添加数据库连接

选择需要的驱动,点击下一页完成,配置数据库连接信息

 数据库名称、数据库服务地址、端口、用户、密码,然后点击Test,测试是否成功

3、通过数据库生成PDM

Database->update model from database

勾选刚才配置的数据库连接

点击connect->确定,然后不同的数据库操作不同,pg数据库会有多个schema,勾选对应的表

 点击ok

 对应显示的列可以通过配置

tool->Display Preference

 选择Table

 

勾选需要显示的列,调整顺序

 配置之后展示情况

可以发现name与code一致,name并没有展示中文

双击模型,查看Comment列是否有值

 如果该列没有值,进行sql修改

database->Edit current DBMS->Objects->colums

 查看sql是否正确查出comment的值,可以进行对应的修改,如果提示权限不足,不允许修改,可以到对应的目录,进行文件夹的权限修改,添加“修改”权限,完成以后

tool->Execute Commands->edit/run script

    Option   Explicit   
    ValidationMode   =   True   
    InteractiveMode   =   im_Batch
    Dim blankStr
    blankStr   =   Space(1)
    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 = "" or replace(col.comment," ", "")="" Then
                            col.name = blankStr
                            blankStr = blankStr & Space(1)
                      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  

将该脚本复制进去,点击执行

4、PDM生成数据库脚本

Database -> Generation Database

 

options选项根据对应的需求,选择是否需要生成删除表,用户等语句

 成功生成了脚本

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

阿小木的愤怒

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值