powerdesigner生成表sql語句時,統一新增預設欄位(生成時間、生成人等)
阿新 • • 發佈:2020-12-23
技術標籤:資料庫
powerdesigner生成表sql語句時,統一新增預設欄位
文章目錄
推薦方法一:對pd表模型結構不侵入,可以隨時替換預設欄位
方式一:配置建立表預設欄位:
1.開啟Powerdesigner工具,依次點選Database -> Edit Current DBMS…。
2.在彈出視窗,依次點選Script->Objects->Table->Create。
3.在右側視窗的 Value 中填入以下內容:
create [%Temporary%?temporary ]table[%R%?[ if not exists]] [%QUALIFIER%]%TABLE%[
(
%TABLDEFN%,
create_user bigint comment '建立人',
create_time datetime default CURRENT_TIMESTAMP comment '建立時間',
update_user bigint comment '修改人',
update_time datetime default CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP comment '修改時間',
)][%R%?[comment = %.q:TLABL%]]
[%OPTIONS%]
這樣不需要在表模型中新增預設欄位(生成資訊等),在匯出sql指令碼時會預設新增。
方法二:建立表模型後執行vb語句
詳見下文,2.1章節:
powerdesigner-建立資料庫模型及全域性指令碼