Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 633
Henry Avatar asked Jul 25 '11 19:07

Henry


People also ask

How do you configure databases using schema?

In Object Explorer, expand the Databases folder. Expand the database in which to create the new database schema. Right-click the Security folder, point to New, and select Schema. In the Schema - New dialog box, on the General page, enter a name for the new schema in the Schema name box.

What are the 3 types of database schema?

Schema is of three types: Logical Schema, Physical Schema and view Schema.


1 Answers

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.

like image 144
Stephanie Page Avatar answered Nov 13 '22 14:11

Stephanie Page