Skip to content

Latest commit

 

History

History
183 lines (104 loc) · 5.66 KB

File metadata and controls

183 lines (104 loc) · 5.66 KB

In the previous step (02.-Build-The-Main-Branch.md), we have created a snapshot of production metadata in the src folder and the dist folder to install it. This installation will need to be run in VM and other environments that will need to build the system from scratch. However, it should never run in TEST and PROD , where all these objects already exist.

To solve this problem, we will use the Liquibase changelog-sync command. When run against the destination environment, the command analyzes the corresponding change log file and populates the LB control tables accordingly. This will inform subsequent LB UPDATE runs that the baseline changes have already been installed.

Note: This step must be performed before merging any new changes into MAIN

Here are the key steps of implementing this critical task:

  1. Create a new branch called baseline. This branch will never be merged back to main and may be safely dropped after the backfill is completed in Prod
git checkout main
git checkout -b baseline
  1. IF you have direct access to PROD as CLA_DEPLOYER, just run the following commands in SQcl
conn -name proj_prod
cd dist
lb changelog-sync -changelog-file releases/main.changelog.xml 
  1. IF you need to ask a DBA or another resource without access to repo run it for you, follow the steps below:

  2. Edit dist/install.sql . Comment out lb update and add lb changelog-sync so it looks like this:

prompt "Running Liquibase changelog sync to mark changes as applied"
--lb update -log -debug -changelog-file releases/main.changelog.xml -search-path "."
lb changelog-sync -changelog-file releases/main.changelog.xml 
  1. Generate an artifact. The command below will generate file artifact/baseline-25.1.zip
project gen-artifact -name baseline  -version 25.1  -format zip -verbose
  1. Test the articact against VM database. If required, reset VM database first
conn -name proj_vm
project deploy -file artifact/baseline-25.1.zip -verbose
  1. Check if the output is similar to the following and contains no errors
SQL> project deploy -file artifact/baseline-25.1.zip -verbose 
Check database connection...
Extract the file name: baseline-25.1
Artifact decompression in progress...
Artifact decompressed: C:\Users\ALEXAN~1\AppData\Local\Temp\bd1d4ced-6ac8-41c2-995e-298784cd33494729888322982759787
Starting the migration...
Running Liquibase changelog sync to mark changes as applied
--Starting Liquibase at 2025-10-29T09:28:01.892906600 using Java 17.0.13 (version 4.30.0 #0 built at 2025-04-01 10:24+0000)


Operation completed successfully.

Invalid object counts (INVALID status only):

PL/SQL procedure successfully completed.



Compiling invalid objects...


Invalid object counts after recompilation (INVALID status + synonyms with missing targets):


Invalid objects:


0 rows selected.


Compilation errors:


0 rows selected.


Other compilation errors not listed
___________________________________
                                  0

Log file(s) location: C:\repo\cla-project
Removing the decompressed artifact: C:\Users\ALEXAN~1\AppData\Local\Temp\bd1d4ced-6ac8-41c2-995e-298784cd33494729888322982759787...
  1. Check if in VM database table CLA_DEPLOYER.DATABASECHANGELOG exists and is populated, but no project users are created
select count (*) from CLA_DEPLOYER.DATABASECHANGELOG;

COUNT(*)
________
    2229

SQL> select username  from DBA_USERS where username like 'CLA%';

USERNAME     
____________
CLA_DEPLOYER
    
  1. Now, you are ready to pass artifact/baseline-25.1.zip to a DBA. Ask them to connect to Prod as CLA_DEPLOYER and run the deployment
conn -name proj_prod
project deploy -file baseline-25.1.zip -verbose