Previous Article : Introducing Touchless Deployment
In this article, describes step by step how to migrate your sql through Touchless Deployment API and understand each scenario’s for deploying which would benefit customers, partners, DBA’s & Data Integration consultant.
Available for both SAP HANA and Oracle tenants
Getting Started
Step 1Â : Enable Touchless deployment role and assign to the user
The Touchless Deployment permission is added in Security > Roles > Administration.The Commissions user who deploys the database changes must be granted with this permission (through a role).
To configure permissions for Touchless Deployment:
1. In Manage Setup > Security > Roles, select the Role that has the permissions to deploy database changes.
Step 2 : Touchless Deployment API’s to check if you have access to deploy.
Below API will not provide any 200 ok response.
Method : GET
URL : https://XXXX.callidusondemand.com/TrueComp-SaaS/services/rest/touchlessdeployment/
Authentication : Basic XXXXXXXXXXXXXX
content-type : application/json
Below API will provide 200 ok response if User is authenticated, that confirms user can deploy the next step.
Method : GET
URL : https://XXXX.callidusondemand.com/TrueComp-SaaS/services/rest/touchlessdeployment/status
Authentication : Basic XXXXXXXXXXXXXX
content-type : application/json
Step 3Â : Create your own folder with required xml and *sql format files. (Sample Github link at end of the step is mentioned)
📦 project-folder ┣
📜 master.xml
┣ 📂CR1
┗📜 CR1.sql ┗📜 CR2.sql ┗📜 CR3.sql ┗📜 CR4.sql
Master.xml would be look like below for deploy. you can change XML file name as you per your need. Mention your folder name which will have all your *.sql files.
CR1.sql would like below sample which can continue multiple statements.Â
GitHub Link :Â https://github.com/yogananda-muthaiah/Touchless-Deployment
Understand Liquibase Documentation
https://docs.liquibase.com/concepts/changelogs/sql-format.html
Step 4Â : Zip the complete root folder
Zip file should have XML and folder (conatins all your sql files).
Step 5Â : Lets upload the zipfile for deploying to the database using Touchless Deployment API
Method : POST
URL : https://XXXX.callidusondemand.com/TrueComp-SaaS/services/rest/touchlessdeployment/update?changeMasterFile=master.xml
Authentication : Basic XXXXXXXXXXXXXX
content-type : application/json
changeLogZip : <your folder path of zip file> (forma-data)
Open the postman or any other API Management tool
2 tables are created after API went successful (202 Accepted) as per above CR1.sql (above screenshot)
Once API is successful, records will be stored in table :Â ext.cs_td_ext_databasechangelog
If user is tried many times, it will be locked in below table :Â ext.cs_td_ext_databasechangeloglock
Step 6Â : Below API will update the TAG which would be required for rollback statement ..
many of you might know what is database rollback… sometimes rollback are important in your implementation in the long run because if you need to archive the records and delete the entire process, it would help only if you have updated the TAG name for your deployed.
Method : POST
URL : https://XXXX.callidusondemand.com/TrueComp-SaaS/services/rest/touchlessdeployment/tag?tag=version1&changeMasterFile=master.xml
Authentication : Basic XXXXXXXXXXXXXX
content-type : application/json
changeLogZip : <your folder path of zip file> (select form-data)
Go back to your postman to execute the below API to update the tag which will deploy and reflect immediately in database.
As shown in below screenshot, last row is updated with TAG column Version1
Best Practice :
Always follow Step 6 if you need to rollback in future anytime. Step 5 is straightforward will not rollback.
Step 7Â : API to check your Deployed Status
Method : GET
URL : https://XXXX.callidusondemand.com/TrueComp-SaaS/services/rest/touchlessdeployment/getstatus/22
Authentication : Basic XXXXXXXXXXXXXX
content-type : application/json
Step 8Â : Roll back Scenario on last ChangeSet
Below API will rollback the last number of changesets (the number is provided in your sql file in 2nd line). so In my scenario – 2 tables are dropped.. because it refers to the last time in CR1.sql (refer Step3)
https://docs.liquibase.com/workflows/liquibase-community/liquibase-auto-rollback.html
Method : POST
URL : https://XXXX.callidusondemand.com/TrueComp-SaaS/services/rest/touchlessdeployment/rollbackLastChangesets?changeMasterFile=master.xml&changesets=9998
Authentication : Basic XXXXXXXXXXXXXX
content-type : application/json
changeLogZip : <your folder path of zip file> (select form-data)
Back to your postman, execute the below API endpoint to complete your rollback statement.
In my example, changeset = 9998 was executed in Step 6 which was in my sql file statement
After the API is successfull, that confirms your sql is executed successfully and you don’t see the records in log table …Â
Best Practice :
Ensure your zip file what it contains would be rolledback, if you have multiple sql statements, while rolling back it executes everything from *.sql
Step 9Â : Roll back Scenario on Tag column
Below API will rollback based on RollbackToTag endpoint allows the user to rollback all changes which have been done after the TAG
Method : POST
URL : https://XXXX.callidusondemand.com/TrueComp-SaaS/services/rest/touchlessdeployment/rollbackToTag?changeMasterFile=master.xml&tag=Version1
Authentication : Basic XXXXXXXXXXXXXX
content-type : application/json
changeLogZip : <your folder path of zip file> (select form-data)
Step 10Â : Roll back Scenario on Date column
Below API will rollback based on RollbackToDate endpoint allows the user to rollback all changes which have been done after the date
Method : POST
URL : https://XXXX.callidusondemand.com/TrueComp-SaaS/services/rest/touchlessdeployment/rollbackToDate?changeMasterFile=master.xml&date=2022-06-21,12:27:13
Authentication : Basic XXXXXXXXXXXXXX
content-type : application/json
changeLogZip : <your folder path of zip file> (select form-data)
Note:
Any future enhancements :Â SAP Commissions Influence Portal
Refer Housekeeping Notes from Previous Article : Introducing Touchless Deployment
Known Limitations
- Deployed information stored in ext schema is not available in /TouchlessDeployment (Step2)
- Touchless Deployment API is only for EXT Database Schema.
- Zip file should contain only *.sql format and zip file upload limit is upto 2MB.
- username in changeset will not be considered from RestAPI – User Authorization.
- Deploy id status keeps generating even if you executed more than once.