DB Updater v4


Overview 

Updater v4, formerly known as Namespace deployer, is available in R4 systems since 22 April 2020.

This means that it is possible to subscribe to updates from other databases by subscribing to individual namespaces.

Namespace can be applied to these objects in Appframe:

  • Database objects
  • Assemblies
  • Articles
  • Reports
  • Code Modules
  • Web site scripts
  • Web site styles
  • Web site templates
  • SQL Templates
  • Bundles
  • Data Change scripts


The default update service for Appframe updates is stage.pimsdevhosting.com which contains all latest thoroughly tested and product-compatible Appframe updates.

As part of this transition, the default hostname for all web components is changed from "Appframe" to "PimsWeb".

This change eliminates the need to run the "Pimp My Site" procedure after applying Appframe Updates, providing that the "PimsWeb" hostname is used. 

The "Pimp My Site" procedure is still available for solutions which do not use the default "PimsWeb" hostname.

A more detailed description of deployed issues including breaking changes can be found in these release notes.

Setup new namespace

We have already added change script with updater v3 in your system to listen for system updates. 


In order to start deploying from a specific date, you should set an offset for specific namespaces. You should use it as an offset date between change packages and new updater.

Local namespace

To add a local namespace, just press the Add local namespace button.

Note: you should ensure that your Namespace is unique for your clients, otherwise, listening for a same namespace from a different solution might break the system. 

Listening for updates

You can start downloading updates for a specific namespace from the specified hostname in /af-namespaces web app, by using the Add external namespace feature:


Controlling namespaces

There are 2 check boxes in the af-namespaces article which can suspend namespace from certain actions.

  1. Apply suspended - you can't apply changes and you can't download it.
  2. Deploy suspended - you can't generate and deploy changes also target can't download it.

Sources to listen updates from R4

1. Listening from stage.pimsdevhosting.com

The default source for updates should be stage.pimsdevhosting.com. 


This source is thoroughly tested and quality-checked by AST and product maintenance teams on a monthly basis. It is therefore ideal for listeners looking for robust, stable and thoroughly tested appframe updates. In addition, update listeners can be reassured of the compatibility between appframe and products when using this source.

To reduce risk and test any client-side customization's, clients may use their own STAGE to listen updates from, adding another quality control layer.

2. Switching between listening sources

You should be very cautious and thoroughly consult with the Appframe team prior any switching activities: there are only certain time intervals when switching can be done, because sources might have different compatibility levels.

Source setup

To setup a database to become a source origin, you need to add ApplyUpdatesConnectionString connection string in web.config.

This is used to provide a list of namespaces to external sources. The below script is an example of how to create an Updater user with sufficient permissions.

    
    create login [af_ApplyUpdates_MMDev] with password = '';
    create user af_ApplyUpdates_MMDev from login af_ApplyUpdates_MMDev;
    alter role af_user add member af_ApplyUpdates_MMDev;
    alter role af_updater add member af_ApplyUpdates_MMDev;
    alter role db_datareader add member af_ApplyUpdates_MMDev;
    
    //Web config entry
    < add   name="ApplyUpdatesConnectionString" 
            connectionstring="Data Source=PimsCoreSQL;Initial Catalog=Pims_R4;User Id=af_ApplyUpdates_MMDev;Password=ComplexPassword" 
            providername="System.Data.SqlClient"/>
    
    

Known issues

In an environment where AD domain name matches the update source name, use a different name for the update source. E.g. if the AD domain is contoso.com, update source should not be contoso.com, but update.contoso.com.

Namespace is auto assigned for DB objects and SQL templates, for the rest items like: Web Articles, Code Modules and etc. you need explicitly set namespace for them. It can be done in corresponding developer application. 

When using SSMS make sure you have setting enabled"Prevent saving changes that require the table to be re-created" . Otherwise changes might not be compatible with Updater. Microsoft article

Updating clients

Clients can be updated manually. 

To update them automatically, you should distribute change scripts via change packages or other forms to the client.

A change script should contain an INSERT statement, for name and ApiKey. A script example is provided below:

     
    --Disabling trigers just in case, person running updates doesn't have permissions;DISABLE TRIGGER stbl_Deploy_Namespaces_Itrig ON stbl_Deploy_Namespaces; 
    declare @_tmp_stbl_Deploy_Namespaces table ([SourceUrl] nvarchar(1024) null, [ApiKey] nvarchar(64) not null, [Name] nvarchar(128) not null, [Description] nvarchar(4000) null ); 
    /* [ApiKey] should be Auto generated key from dbo.stbl_Deploy_Namespaces table */ 
    insert into @_tmp_stbl_Deploy_Namespaces 
    select NULL,'Generated key from you table','Namespace name','Namespace description' 
    
    INSERT INTO stbl_Deploy_Namespaces (SourceUrl,ApiKey,Name, Description) 
    --Your source URL SELECT 
    'https://update.pimsdevhosting.com', ApiKey,Name, Description 
    FROM @_tmp_stbl_Deploy_Namespaces AS NS 
        WHERE NOT EXISTS(SELECT * 
                                FROM stbl_Deploy_Namespaces AS N WITH (NOLOCK) 
                                WHERE N.Name = NS.Name) 
    --Do not forget to Enable ;ENABLE TRIGGER stbl_Deploy_Namespaces_Itrig ON stbl_Deploy_Namespaces; 

Updating closed solutions without direct access to an update server

The Sys.Database.DbUpdater Win application, available in Win Projects, has been introduced for this purpose.

Such Win app is designed only for downloading updates.

To apply and deploy updates, the /af-updater web app is required.


Local changes to external namespaces (Hot fix)

It is possible to generate changes made for namespaces which comes from external sources. Such changes will be generated with negative id's. Negative id's might be different across all systems. In transactions table, original ID is stored in Source_ID field. In order to make local change/hotfix just apply change on stage and press generate and deploy, then you should see your changes listed under updates.

Note: you should be careful when making hot fixes. They will be applied in same sequence defined by VersionCreated field as regular updates. So after making a hotfix, you need to make sure, that is present after in original database.
Local changes/hotfixe will be auto 'Obsoleted' when same object will be downloaded from source. Except data change scripts.

Transition process from updater v3

Updater v4 might potentially break a few things in R4 systems. Check known migration issues in this article.

Namespace to Site Mapping

By default it will update only PimsWeb site. Namespace mapping tool allows to define which WebsiteCMS parts will be copied to hosts based on their namespaces during application of updates.

The namespace mapping tool is accessible via /af-namespacemapping


Related articles

Placeholder "LocalizeWeb2016" failed