PowerDesigner MySQL PDM comment Note2012-11-01 15:38 4447 People read comments (0) report Classification:Database related
(7) PowerDesigner MySQL PDM comment note
First, Generate comments
The default PD does not generate comments and can be modified as follows for mysql5.0.
At the Database-->edit current DBMS ...
Set the properties of the DBMS to find the Mysql5.0-->script-->objects-->column-->add
Put the original content:
SQL code
- %20:column% [%national%? National]%datatype%[%unsigned% unsigned][%zerofill%? zerofill][[. o:[character Set][charset]]%charset%][. z:[%notnull%][%identity% auto_increment:[ default%default%]][comment%.q: @OBJTLABL%]]
Switch
SQL code
- %20:column% [%national%? National]%datatype%[%unsigned% unsigned][%zerofill%? zerofill][[. o:[character Set][charset]]%charset%][. z:[%notnull%][%identity% auto_increment:[ default%default%]][comment%.q:comment%]] /c3>
In fact, only the last @objtlabl changed to comment on the line.
The generated code has a comment for each field:
SQL code
- Drop table if exists admin;
- /*==============================================================*/
- /* Table:admin * /
- /*==============================================================*/
- Create Table Admin
- (
- id int ( ) not null auto_ Increment comment
- user_name varchar (+) comment
- password varchar (+) comment
- User_kind varchar (2) Comment ' user type ',
- Is_online varchar (1) Comment ' online logo ',
- Last_login Date Comment ' Last landing time ',
- Last_logout Date Comment ' last log out time ',
- primary key (ID)
- );
- Alter table admin Comment ' login system user Information table ';
Notes for the table:
To set the properties of the DBMS, locate mysql5.0-->script-->objects-->table-->tablecomment:
Value, add the following:
ALTER TABLE [%qualifier%]%table% comment%.60qa:comment%
When added, the following statement is generated:
ALTER TABLE code comment ' Codes table ';
Code generation:
Click menu Database-->generate Database
The Database Generation screen appears: In the Format tab, tick generate name in empty comment
Click OK to generate the appropriate code, and the comments above will appear in the code.
Ii. Removal of annotations
The existence of annotations is mainly for everyone to see, when using PowerDesigner design database, to write a lot of comment let people see, generate SQL file also contains these comment, but with this SQL file generation database, often because comment too long to fail, The deletion of 1.1 points in the file comment is too troublesome. Here's a way to get PowerDesigner to generate SQL files without comment.
Select Database->edit Current DBMS, click Open Script, objects, table, create, in value will be the last [comment = "%tlabl%"] Delete, this is to remove the comment that created the table.
Script---objects, column, create, in value will be the last [Comment%.Q: @OBJTLABL%] removed, this is to remove the column of the comment.
This produces no comment when the SQL file is generated.
There is also a point, if the database design has index, generate SQL file will drop index to the front of the file, when the first generation of the database, because there is no index so will be error, so to the top of the drop index deleted, but manually delete or trouble, Can do this:
CTRL + G, open database Generation, select the Options tab, select Index, and remove the √ right drop index before the
PowerDesigner MySQL PDM comment note