For certain DevOps scenarios, it might be desirable to generate a snapshot of your current Database Schema. For GeneXus development, this can be done on a mock Database to validate the pipeline execution, before reorganizing production environments.
With SQL Server, this can be achieved by using Data-Tier Application Packages, which are self-contained and complete Database model snapshots.
Dacpacs require Microsoft SqlPackage, which you can install through PowerShell with the following command:
dotnet tool install -g microsoft.sqlpackage
To generate your Knowledge Base dacpac and export it as a pipeline run artifact, add the following job to your pipeline definition:
- job: GenerateDacpac
- powershell: >
sqlpackage /TargetFile:".\$(kbalias).dacpac" /Action:Extract
- publish: $(WORKING_DIR)/$(kbalias).dacpac
It is recommended that you set up your pipeline dependency to the Build step.
That can be accomplished by adding the following snippet to your job:
The following are specific variable definitions required for the task. See Initial Configuration for the generic variables required.
SQL Server instance name. Example: "GXP5022\SQLEXPRESS"