In this section you will find how to generate a full deployment script in PowerDesigner in order to implement the data models in the database and i-refactory. A full deployment consists of files containing Data Definition Language (DDL) scripts and metadata (JSON).
Before you start, make sure:
{tip} By default, i-refactory generate scripts for all opened (active) data models. So close old or unwanted models before pressing the export function.
To generate and export DDL and metadata files in PowerDesigner:
Generate DDL and Metadata
. In the first half of the Export wizard window you will find:
Custom Directory
: You can select or create a custom folder for the files. Click on the folder icon to browse for a folder.Generate Directory
: When selected, a directory is generated in i-refactory_export_path\<workspace>\yyyymmddhhmmss
format.Deployment Directory
: This shows the directory the files are generated in.
In the second half of the Export wizard window you will find a table with the following column names:
Selected Model
: Name of the data model.Model Architecturelayer
: Shows the corresponding database layer of the data models.Model Name
: Name of the data model.Model Code
: Code of the data model.Model Version
: Shows the model version of the data model.Export DDL
: Select this option to generate DDL scripts. By default, all opened layers are selected.Export metadata
: Select this option to generate metadata for the data model. By default, all opened layers are selected.Export schema
: Choose if schema(s) should be created if they do not exist.
After pressing OK
the export starts. This can freeze PowerDesigner for a while. You can monitor it's process in the PowerDesigner output box.
{tip} You can select which model you want to export. If the changes are limited to the Technical Staging Model, you can export the
tstgin
DDL and metadata. If the changes are limited to constraints in the LVM, you only need to export thehstgin
metadata. For more information about the content, see the section content of exported DDL and metadata per layer.
After exporting, the following files will be present:
generated
: Folder that contains all generated DDL code and metadata.install.ps1
: This is the PowerShell installer that can be called from windows explorer.install.sql
: This is the installer that can be run in your database management console, for example: Microsoft SQL Server Management Console. It installs all generated layers.install-with-powershell.sql
: This script is called by install.ps1
. It wil install the tables and views for the exported models.<layer_code>_<model_code>_install.sql
: This is a layer-specific installer that can be run in your database management console, for example: Microsoft SQL Server Management Console.
The generated
folder contains :
cfpl
: This folder contains the DDL files for the CFPL-layergdal
:
hstgin
: This folder contains the DDL files for the HSTGIN-layer (also known als LVL-layer)metadata
: This folder contains the .json
files with the metadata for every layer. Mappings are included in the .json
file of the receiving layer.tstgin
: This folder contains the DDL files for the TSTGIN-layer
Every folder with DDL files (tstgin, hstgin, cfpl) contains the following files:
create_schemas.sql
: A wrapper file that will create the schemas for the layer.install.sql
: A wrapper file that create the DDL-related items for the layer.post_installation.sql
: A wrapper file that you can modify to create DDL-related items for the layer. It runs after the install.sql
.pre_installation.sql
: A wrapper file that you can modify to create DDL-related items for the layer. It runs before install.sql
.{warning} The install scripts do not remove existing objects in the database: they do a full deployment. You should remove existing objects or install to a clean environment.
In i-refactory release 3.x, there is an exception to this rule in the GDAL views: we will automatically remove the views, functions, stored procedures, and triggers for which no related metadata object exists anymore.
Each layer differs in what's generated in the DDL and what's generated in the metadata. In the TSL, the keys and constraints are in the metadata. In the LVL, the primary key is implemented in the database but all other keys and constraints are in the metadata. In CFPL, the keys and constraints are in the DDL. Finally, for the GDAL only metadata is generated.
{info} Drop statements are never generated as part of the DDL.
Generated in DDL:
Generated in Metadata:
set constraint helper
)business rule helper
)Only metadata is generated for GDAL, there is no DDL script.
<schema_name>
: View of the current data. Consists of a surrogate key and attributes.<schema_name>_oasi_bk
: A flattened view of the current data with the business key(s). One attribute set interface with business keys view.<schema_name>_hist
: View with full Historic perspective. With this view you can travel through the transaction timeline.<schema_name>_removed:
: View to see the audit trail of the removed records.