First: run Powerdesigner as an administrator
1. Connect to a database of the server:
Click on the new data source icon
p>
Select the data source type: user data source; here it is said that it is only used for the current machine, and it can be used in the actual local area network.
< img alt="share picture" src="/wp-content/uploads/images/database/power-designer/1626816352152.png" >
Successfully, the connection is successful!
< p>Click OK
————————————— —————————————-
Two. Modify the database: Generate SQL statements to modify the database
p>
p>
Look at this part mainly: p>
Some data cannot be restored from temporary tables:
-> from table dbo.tmp_Animal to table Animal, columns: Species, LatinName, Class, OrderName, Family
-> from table dbo.tmp_EcoTypes to table dbo.EcoTypes, columns: RegionType
-> from table dbo.tmp_EntityData to table EntityData, columns: DATAID
-> from table dbo. tmp_InvadePlants to table InvadePlants, columns: InvadeWay
Use the Animal table as an example to analyze the powerDesigner update database process: first change the backup table Animal table structure and data to tmp_Animal, then modify the Ainmal table structure, and finally insert the tmp_Animal data into the database. In the modified Ainmal table, the insert cannot be inserted, so a warning is prompted!
Compare Ainmail tables
Table structure in the database
Powerdesigner table structure
Comparison found that the field types are inconsistent.
Special attention:
1 If the database has a certain structure (fields, indexes, etc.) and powerdesigner also has a certain structure (fields, indexes), but the database Unlike the powerdesigner agency, it will prompt a warning! For example, the field types are different.
2 If a structure (table, field, index, etc.) does not exist in the database and a structure (table, field, index) exists in powerdesigner, the structure will be added;
3 If If there is a structure (table, field, index, etc.) in the database and no structure (table, field, index) exists in powerdesigner, the structure will be deleted;
This means data loss, which is very dangerous! Therefore, the database must be backed up every time it is modified. And this modification process may take up the entire database, causing the publishing program to not work properly. Therefore, it is not recommended to do this in a production environment database, which can only be used in a test environment and a development environment.
Second, supplement
Click help here and the official powerdesigner document will appear:
< img alt="Share a picture" src="/wp-content/uploads/images/database/power-designer/1626816352153.png" width="641" height="668" >
The translation is:
Plus sign means to add, not in the database, but in the powerdesigner model.
Minus sign means delete, there is in the database, in the powerdesigner model no.
Equal sign means modification, there is in the database, and also in the powerdesigner model , But the two are not the same.
Click the equal sign and a detailed list will appear, for example:
FromModel (representing the powerdesigner model)
ToDataBase (representing the database relational model)
The column will be FromModel Modify the database.
Double-click the exclamation point to display the text format between the database and the powerdesigner model The difference. The value to be applied is blue, preceded by >>, and the value to be deleted is red, preceded by <<. If it is not for the text format change, no pop-up box will appear.
< p>Movement: indicates that the object has moved from a subset of an object to a subset of another object, (green circle with arrow, gray text and icon) indicates the position before the movement, (with The green triangle of the arrow) indicates the position after the movement. If the modification is also made at the same time, the green triangle changes to a red equal sign.
The yellow exclamation mark indicates that its sub-items have been changed.