`

PowerDesigner 给表统一增加默认字段(id,创建时间,创建人,修改时间,修改人)

阅读更多

将下面脚本粘贴到tools->execute commands->edit/run script里运行。

 

 

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    
                  'if tab.comment="" then
                     'tab.comment   =  tab.name
                  'end if   
                  Dim isNeedAdd:isNeedAdd = true
                  Dim   col   '   running   column    
                  for   each   col   in   tab.columns    
                     if col.code="create_tm" then   
                         isNeedAdd = false   
                     end if  
                  next
                  if isNeedAdd then
                     Set col = tab.columns.CreateNew '创建一列/字段
                     If not col is Nothing then
                        col.name = "create_tm"
                        col.code = "create_tm"
                        col.DataType = "datetime"
                        output " col.name: " + col.name
                     End If
                     set col = nothing
                     
                     Set col = tab.columns.CreateNew '创建一列/字段
                     If not col is Nothing then
                        col.name = "create_emp"
                        col.code = "create_emp"
                        col.DataType = "varchar(32)"
                        output " col.name: " + col.name
                     End If
                     set col = nothing
                     
                     Set col = tab.columns.CreateNew '创建一列/字段
                     If not col is Nothing then
                        col.name = "update_tm"
                        col.code = "update_tm"
                        col.DataType = "datetime"
                        output " col.name: " + col.name
                     End If
                     set col = nothing
                     
                     Set col = tab.columns.CreateNew '创建一列/字段
                     If not col is Nothing then
                        col.name = "update_emp"
                        col.code = "update_emp"
                        col.DataType = "varchar(32)"
                        output " col.name: " + col.name
                     End If
                     set col = nothing
                  end if  
            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 
 

 

分享到:
评论

相关推荐

    PowerDesigner 16.5带数据修改表结构实例

    PowerDesigner 16.5 提供了多种修改表结构的方法,包括增加字段、删除字段、修改字段类型等。下面是一个简单的实例: 1. 打开 PDM 文件后,另保存为 APM。 2. 选择:File-Save As 3. Database-Connect 4. 然后对...

    使用PowerDesigner创建数据库表图文并茂版

    使用PowerDesigner创建数据库表图文并茂版

    powerdesigner为表设置表空间

    1. **打开 PowerDesigner 15 并加载相应的模型**:首先启动 PowerDesigner 应用程序,然后打开包含您想要修改的表的模型。如果您还没有创建模型,则需要先创建一个新的模型。 2. **选择目标表**:在模型视图(Model ...

    PowerDesigner逆向工程显示字段备注

    PowerDesigner16.5逆向工程显示字段备注,生成的更贴合。使用的是命令运行的方式,本人亲试,非常方便。

    PowerDesigner中自动生成sqlserver字段备注

    然而,在使用PowerDesigner生成SQL Server数据库时,一个常见的痛点是,默认情况下,它不会自动为数据库字段添加备注或注释,这在后续的数据库维护和理解上造成了一定的不便。本文将详细介绍如何在PowerDesigner中...

    powerdesigner批量修改增加脚本

    在用powerdesigner进行数据建模的时候,经常会遇到修改字段名,修改字段类型,在指定字段后面新加字段等操作,这个时候你可能就需要用脚本实现了,这个资料就是实现这些功能的,在powerdesigner15里测试可用

    PowerDesigner数据库模型表内容大小写转换

    PowerDesigner数据库模型表内容大小写转换,可对表名称、字段名称、字段类型标识字符、主外键依赖等字符串进行大小写转换操作

    PowerDesigner字段与Oracle字段对应

    在数据库设计过程中,PowerDesigner 和 Oracle 之间的字段对应关系是至关重要的,因为它直接影响到数据的存储和处理。PowerDesigner 是一款强大的数据建模工具,它允许用户创建概念数据模型(CDM)和物理数据模型...

    PowerDesigner 导出表结构 到Excel

    1,打开PowerDesigner,找到创建的物理模型(Physical Data Model), 2,使用快捷键,或者 在PowerDesigner菜单栏中,依次点击“Tools ->Excute Commands->Edit/Run Script..” 3,将下面代码粘贴到空白,点击Run 4,...

    powerdesigner逆向生成工具将注释字段添加到name字段上

    powerdesigner逆向工程导入mysql脚本生成PDM带全注释

    Powerdesigner把表结构导出成word.docx

    3. “Impact Analysis”(影响分析)功能能帮助分析更改一个表或字段可能对整个系统产生的影响。 总结,PowerDesigner是一款强大的数据库设计工具,通过连接数据库、创建数据模型、导出Word文档,以及丰富的设计和...

    PowerDesigner导出数据表结构

    当你需要将这些结构信息分享给团队成员,或者用于数据库的创建或更新时,就需要导出数据表结构。导出的过程可以生成SQL脚本,也可以是XML或其他格式的文档,方便导入到其他系统或工具中。 描述中的"写好的rtp模板...

    powerDesigner 英文字段名修改为中文

    powerDesigner 英文字段名修改为中文 这样比对不同表的时候对应字段

    PowerDesigner导出表结构

    "PowerDesigner导出表结构"这一操作是数据库管理员和开发人员日常工作中常见的需求,它能让我们清晰地了解数据库的架构,并方便地进行维护和共享。 PowerDesigner支持多种数据库管理系统,包括Oracle。在本例中,...

    PowerDesigner中文字段名自动脚本

    在powerdesigner中无法把中英文的字段名同时显示出来,只有通过把中文字段的含义拷贝到stereotype中才行。通过这个脚本文件将自动的把你的数据库中的所有字段的Name拷贝到stereotype中,非常方便。

    PowerDesigner字段名生成备注说明脚本.vbs

    PowerDesigner字段名生成备注说明脚本.vbs

    Powerdesigner 15 表结构导出Word

    Powerdesigner 15 表结构导出 Word 操作指南 Powerdesigner 15 是一款功能强大且灵活的数据建模工具,它提供了丰富的功能来帮助用户设计、开发和管理复杂的数据库系统。在实际应用中,用户常需要将 Powerdesigner ...

    PowerDesigner批量生成SQL脚本时将name生成数据库中字段的comment

    在数据库设计过程中,为了增强数据库的可读性和可维护性,通常会在数据库的表和字段上添加注释(comment)。这些注释可以清晰地说明每个字段的用途和含义,尤其对于那些使用英文名称的字段,注释尤为重要。...

    PowerDesigner 设计数据库表

    **PowerDesigner 设计数据库表** PowerDesigner 是一款强大的数据库建模工具,被广泛应用于系统分析、数据库设计和数据仓库建设中。它提供了直观的图形化界面,使得数据库设计过程更为简单高效。本篇文章将深入探讨...

Global site tag (gtag.js) - Google Analytics