Upgrade Script Standards

The purpose of this document is to describe the upgrade script standards used in IFS Applications. This document aims at guiding the developers when writing UPG, CDB, CRE, SQL and INS files.

Contents

Introduction

File Types Used During the Upgrade Process

UPG

UPG (upgrade) files are used when upgrading from a previous version (track) to a new version (track). These files are only executed during an upgrade process and not during a fresh installation. Depending on the current version of IFS Applications available in your environment you may need to execute several upgrade files in order to upgrade to the latest CORE version. Eg. IFS APP7 to IFS APP75

CDB

CDB files are created to fix DDL (Data Definition Language) and DML(Data Manipulation Language) issues in support versions. E.g. adding, removing and changing table columns and inserting or updating data into new or existing columns.

CDB files are merged to UPG files when a Core Version of IFS Applications is released. CDB files are executed:

SQL

There are different types of SQL files and they are used for different purposes. Such as:


CRE

Create files(.CRE) are mainly used during fresh installations and NOT during the upgrade process. However, there are some exceptions to this rule. For e.g. the Luconnection.cre files are run during an Upgrade even though it is a CRE file. CRE files are usually prefixed to the module that they belong and have the DDL statements to create the table structures such as DB Objects, tables index, constrains...etc used by that component. Some modules contain separate CRE file for creating Sequences, report tables (RPTs) that are used by the module.

UPG Files

General Section

Sequence Section

Creation of all database sequences  and modifications should be done under this section.

Remove obsolete objects Section

General Guidelines

Support Specific Instructions

Creating a Table

Examples

Creation/Recreation of Constraints

Example

Creation/Recreation of Indexes

Examples

Adding /Modifying Database Columns

Examples

Temporary Indexes

      It is possible to create temporary indexes in UPG files to support efficient execution of DML statements. Once the DML statements gets executed, these indexes can be dropped.

CDB Files

 General Section

General Instructions

Creating a Table

Examples

Creation/Recreation of Constraints

Examples

Creation/Recreation of Indexes

Examples

Adding /Modifying Database Columns

Examples

Temporary Indexes

Project Delivery CDB Files

General Information

Naming Standard

            E.g 121005_MEP_Invent.cdb

Sub Section Registration

Exception Handling

Error Logging

Post Bug Corrections

Example

SQL Files

General Section

Pre<>.sql Files (Pre Scripts)

Post<>.sql files (Post Scripts)

Clear Scripts (<Component-short-name>cl.sql)

Drop Scripts <component-short-name>dr.sql

CRE Files

  <Component-short-name>.cre Files

General Section

Instructions

Creating a Table

Examples

Creation of Constraints

Examples

Creation of Indexes

Examples

Adding/ Modifying table columns

Obsolete tables and table columns

 

Sequence.cre files

Report.cre files

<Component-short-name>Connection.cre files

INS Files

INS files (Insert Scripts)

Frequently Asked Questions (FAQ's)

  1. What is the deployment order of the file types?

        Answer:

FRESH Installation UPGRADE Installation Service Pack Upgrade

(eg: Fresh Inst to APP8)

(eg: 2004-1 to APP8)

(eg: APP75 to APP75-SP7)

*.CRE *.UPG *.CDB
*.API *.API *.API
*.APY *.APY *.APY
*.INS, *.RDF and *.SQL *.INS, *.RDF and *.SQL *.INS, *.RDF and *.SQL

These files are executed in component-wise.
  1. When doing updates, do we need to update the column ROWVERSION in the UPG or CDB file?

          Answer: NO. Since the purpose of this column is to store the latest TIMESTAMP where columns are updated from client windows. 

  1. Why drop statements that are not included in the UPG or CDB file?

          Answer: Never include drop statements for columns or tables in a .UPG or a .CDB file because the customer may require the data in these columns or tables. The drop statements should instead be included in a cleanup script. The tables should be renamed in the CDB or UPG file and dropped in the cleanup script <Module>cl.sql file ( Ordercl.sql). It is important to note that not null columns should be set as nullable in the UPG or CDB file. This will allow the customer to work with the application without running the cleanup script.

          Note: Drop statements for views or packages can straight away be included in the .UPG/CDB file.

  In both support and project track clear script is updated.

  1. Why are method calls not used in UPG/CDB file?

Answer: During an installation process the state of the packages and views can be invalid.

  1. Is it possible to use Transaction_SYS.Logical_Unit_Is_Installed() in *.UPG/CDB files?

Answer: No. The Transaction_SYS.Logical_Unit_Is_Installed() calls the method Dictionary_SYS.Logical_Unit_Is_Installed. To use Dictionary_SYS.Logical_Unit_Is_Installed method, it requires that the Dictionary Cache is up to date. During the installation and upgrade process there exists a possibility that the dictionary cache is not up to date (TRUNCATE Dict*.TAB in fndbas/400.upg). Hence, there is no guarantee of producing the expected results (these methods are reserved for runtime). Thus, the alternative would be to use methods in Database_SYS.

  1. Do we update *.UPG/CRE files in Support tracks? If so, in what situations?

Answer: It is not necessary to update *.UPG/CRE files in Support unless a situation arises where:

Note: Sometime additional *.CDB files should be provided in addition to *.UPG files  in order to repair corrupted data.

  1. What are the circumstances where Pre/Post SQL scripts have to be created instead of *.CDB/UPG files?

Answer: If a script has to be executed before starting the installation, then a Pre-script has to be created. Otherwise, the script has to be executed at the end of the installation after deploying ALL components. Thereafter you can refer to this script as Post-script.

There are two types of Pre/Post SQL scripts:

  1. Why should  you avoid using manual Pre/Post SQL as much as possible?

Answer: The main reason is the complexity of administration/upgrade of the database environments and overhead cost of maintaining these scripts. If it is necessary to use post script files, make the script auto deployable using [PostInstallationData] section in the Deploy.ini. However, in VERY rare situations it may be necessary to introduce manually deployable pre/post scripts (ex: user input in the script).

Note: You MUST contact your Technical Manager or Technical Coordinator before introducing any new pre/post scripts.

  1. Are Cleanup (cl.sql) scripts updated in the Support tracks?

Answer: Yes, Cleanup scripts can be updated in the Support tracks. These scripts have to be updated during projects as well.(recommendation is to keep-on updating during the Implementation. i.e: not wait until the end of the project).

  1. Are *.INS files updated in the support tracks?

Answer: The common practice is to update .INS files in support tracks. This does not work in all places. The alternative is to create a CDB file with the changed code only.

Important information when updating INS files:

  1. What is the purpose of adding TimeStamp to a *.UPG or CDB file?

Answer: The Timestamp (Installation_SYS.Log_Detail_Time_Stamp) is added before every PROMPT statement in the *.UPG/CDB file. After executing the UPG/CDB  file by checking the timestamps in the log files, it is possible to find out statements/commands which take a longer period to be executed. Later on, these statements can be optimized further for better performance.

  1. What is the purpose of using Database_SYS in *.UPG/CDB file?

Answer: The Database_SYS package is the common interface provided by Foundation1 to create or modify data database objects.

  1. What is the difference between [PostInstallationData] and [ PostInstallationObject] in deploy.ini?

Answer:

  1. Is it necessary to add “ifs_assert_safe” annotation in *.UPG/CDB?

Answer: It is not necessary to add this annotation in these files since PL/SQL block cannot be executed from outside (ie: from Client window, Query option or third party tool) as a standalone. But, it’s mandatory to write the dynamic code in safer way.

References:

  1. Installation Roadmap
  2. Installation Guide
  3. Performance Guide
  4. Time Stamp Guide