"Go" Make a Database upgrade script with PowerDesigner

Source: Internet
Author: User
Tags apm powerdesigner

Many people use PD to ask if they have the ability to make automatic upgrade scripts. Actually, there is.
Operating principle: 1, save the original version, Save as APM files, generate a archive Model. 2, generate the upgrade script, you need to select the original version
Operation steps: 1, open the PDM file, select Save As .... Save As, select the APM file type in the pop-up window, and enter a file name to save. 2, modify the content of the relevant data model, and then save. 3. Select Modify Database from the Database menu. Menu 4, after setting the directory and file name of the upgrade script in the popup window, select the using an archive model in the obtains database schema in the synchronization page box: Select the previously saved APM file. The rest of the following page box settings are similar to the build script.
5, click OK, PD will automatically generate a database of the comparison information, pop up a DB synchronization window, where the window lists all the differences, you can choose to upgrade the content. Click OK to see the upgrade script.

Generate script Analysis: In general, it's a very intelligent tool. For example, if you add a column, the script for the achievement is simple. The script is as follows: ALTER TABLE sy_msgsend add Column_8 CHAR (10)/
The Intelligent upgrade script is fully reflected when the column is deleted, as shown below, and doing a delete column will generate a series of upgrade scripts:
/*==============================================================*/ 
/*Database name:database*/
/*DBMS name:oracle Version 9i*/
/*Created on:2007-9-6 11:12:26*/
/*==============================================================*/Alter TableSy_msgreceiverDrop constraintFk_sy_msgre_sy_msgrec_sy_msgse/Drop TableTmp_sy_msgsendCascadeConstraints//*==============================================================*/
/*Table:tmp_sy_msgsend*/
/*==============================================================*/Create TableTmp_sy_msgsend (
ms_id Number(Ten) not NULL,
Ms_contentVARCHAR2(4000),
Ms_sendtime DATE,
Ms_typeVARCHAR2(4),
Ms_sender Number(8),
Ms_status Number(1)default 1 not NULL,
Ms_msgsource Number(2)default 1 not NULL,
Column_8CHAR(Ten) )/ Insert intoTmp_sy_msgsend (ms_id, Ms_content, Ms_sendtime, Ms_type, Ms_sender, Ms_status, Ms_msgsource)
Selectms_id, Ms_content, Ms_sendtime, Ms_type, Ms_sender, Ms_status, Ms_msgsource fromSy_msgsend/Drop TableSy_msgsendCascadeConstraints//*==============================================================*/
/*Table:sy_msgsend*/
/*==============================================================*/Create TableSy_msgsend (
ms_id Number(Ten) not NULL,
Ms_contentVARCHAR2(4000),
Ms_sendtime DATE,
Ms_typeVARCHAR2(4),
Ms_sender Number(8),
Ms_status Number(1)default 1 not NULL,
Ms_msgsource Number(2)default 1 not NULL,
constraintPk_sy_msgsendPrimary Key(ms_id)) Tablespace Tbs_eoffice/Insert intoSy_msgsend (ms_id, Ms_content, Ms_sendtime, Ms_type, Ms_sender, Ms_status, Ms_msgsource)
Selectms_id, Ms_content, Ms_sendtime, Ms_type, Ms_sender, Ms_status, Ms_msgsource fromTmp_sy_msgsend//*==============================================================*/
/*index:index_47*/
/*==============================================================*/
Create IndexIndex_47 onSy_msgsend (Ms_senderASC) Tablespace Tbs_idx_eoffice/Alter TableSy_msgreceiverAdd constraintFk_sy_msgre_sy_msgrec_sy_msgseForeign Key(ms_id)
ReferencesSy_msgsend (ms_id) on Delete Cascade /

"Go" Make a Database upgrade script with PowerDesigner

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.