开发者

How to specify a database schema in PowerDesigner

开发者 https://www.devze.com 2023-03-22 15:59 出处:网络
I want to export my model to a PostgreSQL database. If I do so as is, the objects are built in the Public开发者_运维知识库 schema, because the model doesn\'t specify a schema, and Public happens to be

I want to export my model to a PostgreSQL database. If I do so as is, the objects are built in the Public开发者_运维知识库 schema, because the model doesn't specify a schema, and Public happens to be the default. Does anyone know a way to specify a schema in PowerDesigner?

I can change the default schema in the database, but that seems a little cheesy to me. I ought to be able to control that in my modeling tool, it seems to me.


How to specify a database schema in PowerDesigner

Go to the Tools Menu

Go to Model Options

Under Category>Model Settings>Table & View

Then you'll see Default owner on the right side.

Response to comment

PD is a great tool because it's very easy to try out simple cases. Follow these steps.

  • Create a new PDM for PostGRES
  • Add a table_1 (to it add columns_1, columns_2, columns_3)
  • Add a new user called DBO (make sure to set the NAME and the CODE to DBO)
  • Make the change I describe to the model options
  • Add a table_2 (to it add columns_1, columns_2, columns_3)

Now right click on the PDM in the browser pane and choose the preview tab.

You'll see:

How to specify a database schema in PowerDesigner

Notice how the preview for table_2 has DBO. in front of the table name EXACTLY as you desire. I've also included in the screencap the screen for the List of Tables. You get to that via the Model menu. Notice how the owner is set to the DBO user for table_2, exactly like in the previewed DDL. If you go into the properties for table_1 or use this screen to change ALL of your tables en masse, all of your DDL will work the way you want.

XDB File

create [%Temporary% ]table [%QUALIFIER%]%TABLE% (
   %TABLDEFN%
 )
 [%OPTIONS%]

Not sure what the %QUALIFIER% variable gets filled with but it seems to work.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号