zoukankan      html  css  js  c++  java
  • powerdesigner生成mysql带注释的ER图

    1.安装PowerDesigner的

    参考
    https://blog.csdn.net/sinat_34104446/article/details/79885141

    2配置逆向工程

    2.1新建模型pdm

     
    新建模型巴纽

    注: DBMS选择MYSQL5.0
     
    配置链接巴纽

     
    新建数据库链接-01.png
     
    配置链接巴纽
    com.mysql.jdbc.Driver
    jdbc:mysql://192.168.0.151:3306/nbspider
    
     
    测试连接巴纽

    常见问题:
    出现无法初始化JavaVM!
    这是因为powerdesiger需要用32位jdk,如果不想修改环境变量,可以在powerdesiger安装目录配置脚本startup-classpath.bat

    Set JAVA_HOME=C:Javajdk1.8.0_181-32
    Set CLASSPATH =C:Java
    epomysqlmysql-connector-java5.1.45mysql-connector-java-5.1.45.jar
    pdshell16.exe
    

    2.2根据数据库链接修改模型

     
    修改模型01.png

     
    修改模型02.png
    • 另外,若导出的数据量结构中需要导出外键等关系,则酌情选择如下选择项。


       
      导出外键配置巴纽
    • 点击确定
       
      选择导出的数据库巴纽

      选择要导出的数据库,可以先选择“ALL users”,全部反选,然后选择要建立逆向工程的数据库,再点击全选即可

    2.3生成逆向工程

    生成效果如下:

     
    image.png

    编辑表名

     
    image.png

    显示注释列

    1. 进入首选项


       
      显示code.png
    2. 选择代码
       
      image.png

      https://blog.csdn.net/qq_17010367/article/details/79212850
       
      自定义列属性巴纽

       
      显示代码列巴纽

      设置完毕后效果如下图:
       
      image.png
    3. 在PowerDesigner中,表结构的代码,名字字段均为英文,不易阅读,若需要将备注中的字段替换到名字段显示,则执行方法:工具 - 执行命令 - 编辑/运行脚本,则弹出如下图中的对话框:


       
      image.png
     
    image.png
    • Vb脚本代码如下:
    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 code 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 len(tab.comment) <> 0 then 
    tab.name = tab.comment 
    end if 
    On Error Resume Next 
    Dim col 'running column 
    for each col in tab.columns 
    if len(col.comment) <>0 then 
    col.name =col.comment 
    end if 
    On Error Resume Next 
    next 
    end if 
    next 
    end sub  
    

    执行后可以将VBScript中保存到本地,下次执行时执行本地脚本即可


     
    image.png
    1. 执行后的效果如下图:
     
    最终效果图巴纽

    3. PowerDesigner导出SQL时如何添加注释

    • 参考:https://jingyan.baidu.com/album/47a29f24652e44c0142399c3.html picindex
      = 2

    4.#PowerDesigner生成mysql字段注释注释

    5. PowerDesigner将PDM导出生成WORD文档

    https://blog.csdn.net/ni_hao_ya/article/details/51282618




  • 相关阅读:
    一、Javadoc文档标记
    0-写在java系列文章之前
    Tomcat全攻略
    linux使用普通账户时,无法登录,提示“-bash: fork: retry: Resource temporarily unavailable”
    在Linux下安装和使用MySQL
    linux下修改jdk环境变量的方法
    linux下卸载系统自带或者非自带的jdk
    linux中 /etc/profile的作用
    每天一个linux命令:tar命令-jia2
    如何使用蓝湖设计稿同时适配PC及移动端
  • 原文地址:https://www.cnblogs.com/-wanglei/p/10781039.html
Copyright © 2011-2022 走看看