PowerDesigner (6) – Physical Data Model (PDM Reverse Engineering)

The original text is from: http://www.voidcn.com/article/p-vudrzoeb-oy.html

Physical Data Model PDM

Physical Data Model (PDM): After the logical structure of the database is designed, its physical design needs to be completed. PDM is designed to achieve this purpose .

The physical data model is based on the commonly used DBMS (database management system) theory, and generates the corresponding DBMS SQL language script from the real world model established in CDM/LDM. The SQL script is used to generate the storage structure (tables, constraints, etc.) of real-world information in the database, and to ensure the integrity and consistency of the data in the database.

1. Basic concepts

1.1 Table, column, view, primary key, candidate key, foreign key

1.2 Stored procedures and triggers

1.3 Defaults and rules

When the user does not A column assignment means that the value automatically inserted by the database server for the column is the default. The rule is to allow or not allow those values ​​to be inserted into certain columns specified in the management of the database. Defaults and rules work together to help the system maintain data integrity. Defaults and rules can be associated with columns and user-defined data.

1.4 Integrity check constraints (uniqueness and primary key constraints, referential integrity constraints, check constraints, etc.)

Integrity refers to the correctness and consistency of the data in the database. Data integrity is achieved by restricting and constraining database insertion, deletion, and modification of data values. The database provides two methods to maintain data integrity: one is to define integrity constraints at the time of definition, and the other is to define rules, constraints, and indexes. And triggers.

1.5 index (combined index, unique index, clustered index and non-clustered index)

2. Create PDM

2.1 Create PDM

There are 4 ways to create PDM:

  • Use the design environment to directly create PDM
  • Reverse engineering from existing data or database SQL scripts Establishing PDM
  • Establishing PDM from CDM using internal model generation method
  • Establishing PDM from object-oriented model using internal model generation method for class diagram

Use first here Kind of method.

(1) Select the File-New Model command, and select the Physical Data Model option on the left side of the opened window, as shown in Figure 6.1.

Figure 6-1

(2) Enter the model name on the right, from the DBMS drop-down list box Choose a target DBMS.

(3) Select the Extended Model Definitions tab, if you use PowerBuilder to develop applications, when PowerBuilder connects to the database, save the extended attributes of the tables and columns to its Catalog table, select the PowerBuilder checkbox to generate PDM The extended attributes of tables and columns can be obtained from the Catalog table. As shown in Figure 6-2.

Figure 6-2

(4) Click the “OK” button to open the new PDM design window , As shown in Figure 7-3. The workspace includes the browser window on the left, the design window on the right, the output window on the lower side and the floating tool window. You can use the icons in the tool window to design PDM in the design window.

(5) Use the Table in the toolbar Icon creation table, use the Reference icon to create a reference relationship, use the View icon to create a view, and the Produce icon to create a stored procedure. Other tools are used in the same way as the toolbar in CDM.

(6) Create tables, columns, sequences, references and referential integrity, domains, indexes, views, stored procedures, etc. The effect is shown in Figure 6-3 (only tables and columns are created).

Figure 6-3

3.PDM reverse engineering< /strong>

PowerDesigner’s reverse engineering includes the reverse generation of business processing models from the process language (Process Language), and the ect language) reversely generate an object-oriented model, reversely generate a physical data model from the database and a database script, and reversely generate an XML model from an XML definition (XML Difinition). Here is an introduction to PDM reverse engineering, the process of generating PDM from the existing DBMS user database or existing database SQL scripts, that is, the process of deriving its physical design from the physical structure of the existing database.

(1) Select the File-Reverse Engineer-Database command, open the New Physical Data Model window, enter the model name and select DBMS, and click the “OK” button, as shown in Figure 6-4.

Figure 6-4

(2) Open the Database Reverse Engineering Options window and select Options Card, as shown in Figure 6-5.

Figure 6-5

(3) Select the Selection tab and choose the method of reverse engineering , Using script files (SQL script) or Using a data source (data source defined in ODBC).

(4) If the Using script files radio button is selected, click the Add Files icon in the window shown in Figure 6-7 to open the SQL file selection window, and select one or more SQL files.

Figure 6-7

(5) If the Using a data source radio button is selected, click Database The Connect to a Data Source icon in the lower right corner of the Reverse Engineering Options window, open the Connect to a Data Source window as shown in Figure 6-8, select an ODBC data source or Select Click Configure to enter the Connection Profilre Definition window to configure the data source and enter the user name and password , Click the Connect button, as shown in Figure 6-9.

Figure 6-8

Figure 6-9

(6) Select the Target Models tab, click the Add Models icon to select the existing PDM File, the result of reverse engineering is combined with it into a PDM. If no PDM file is selected, a new PDM will be generated.

(7) Click the “OK” button in the Database Reverse Engineering Options window to open the window shown in Figure 6-10, and select all or part of the objects in the database to be reverse engineered. The effect is shown in Figure 6-11.

Figure 6-10

Figure 6-11

Note: When connecting to the data, if you encounter the com.MySQL.jdbc.Driver clas not find error, please check whether the path of the database connection jar is configured in the environment variable. As shown in Figure 6-12.

Figure 6-12

Summary: PMD reverse engineering can ensure that the existing physical database is synchronized with PDM , It also provides convenience for system designers to analyze and improve the existing database, which is also the wonderful feature of PowerDesigner.

Leave a Comment

Your email address will not be published.