Search code examples
powerdesigner

How to specify a database schema in PowerDesigner


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.


Solution

  • PDM Model Options

    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: this

    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.