{ed} [LW] Erik will update this section to correspond to i-refactory 3.x. For example, instruction 'Full deployment through windows explorer' corresponds to an older version.
In this section you will find you to implement the data models in the database.
The database objects for the technical staging, logical validation, and central facts layer are installed through scripts (DDL). The generic data access layer objects (views, procedures, triggers) will be generated during metadata import.
{warning} When deploying changes, make sure there are no deliveries (dataloads, or CRUD actions). This might lead to changes on the database that cannot be reverted. It's a good practice to enddate the delivery agreement before running a script.
When you generate the DDL and metadata, this will create a full deployment script.
Edit the config\config.bat
file to represent your settings
Run the install.ps1
file by right clicking on the file and choosing run with powershell. In the window that opens one can see the progress and errors. The path is automatically determined by the folder the install.ps1
resided in.
In the folder log
you will find the log file of the installation.
Open the install.sql
file in SQL Server Management Studio.
:setvar path "<path_name>"
: <path_name>
should be the folder in which the install.sql
resides in.:setvar generated_path "<path_name>"
: <path_name>
should be the folder in which the generated scripts are in.Menu > Query > SQLCMD mode
).master
database.When a model is updated, the database should change accordingly. In most cases, the database objects already exist and the database contains data. In this case, you need to create scripts to upgrade the existing database to match to the new model release. In some cases you also need to migrate data. How to do this is customer specific. In this section we will give a general advise on how to proceed.
Some layers can be deleted and rebuilt, while other layers need an upgrade script. These are the rules for each layer:
{info} When importing metadata, deleted objects are not automatically removed from the database.
To create a delta script:
{warning} Be aware that the database model should be upgraded before the metadata is imported. This is because during metadata import, there are checks on the database. If a table or attribute doesn't exists in the database, it will throw an error.
In some cases, you also need to migrate data. For example, if you create new objects in the central facts layer and you need the history of an existing object in that new object.
When migrating data it is important to keep the following in mind:
{warning} Be aware that when dropping and recreating objects, the security settings for this object can be impacted. One should always redeploy the security settings after DDL changes.
Suppose we would received a requirement for adding a property to one of the entities and the data delivered onwards will be enriched going forward.
This is a minor change and therefore a partial deployment should be considered.
After these changes take place on the models, the next step is to migrate the data into temporary tables and recreate the objects that are being affected and repopulate with data while deciding what the value would be for the newly added property
The cleanest way should be to deploy the newly created database objects to a new database and then do a comparison between the databases to determine what are the changes, after that we can migrate the data from the old db definitions to the new. It is common to use various tools for these procedures for that such as Redgate. Alternatively the data migration that need to take place might look like this:
SELECT {[old column1], [old column2]...}
,NULL as [new column] --Or any other default value for the records that are currently in the Database
INTO [...].[...].[..._migrate]
FROM [...].[...].[...]
The old database object can be dropped and the new definition should be executed
/* There might be a need to disable Identity_insert */
SET IDENTITY_INSERT [...].[...].[...] ON;
INSERT INTO [...].[...].[...] ({[old columns1], [old columns2]...}
, [new column])
SELECT {[old columns1], [old columns2]...}
,[new column]
FROM [...].[...].[..._migrate]
/* There might be a need to re-enable Identity_insert */
SET IDENTITY_INSERT [...].[...].[...] OFF;
Lastly we need to import the new metadata into i-refactory so that constraints, views as well as the GDAL layer will also updated.