SlideShare a Scribd company logo
1 of 42
15 Apr 2023
NYC MuleSoft Meetup Group
Liquibase Integration with MuleSoft
Safe Harbour Statement
● Both the speaker and the host are organizing this meet-up in individual capacity only. We are
not representing our companies here.
● This presentation is strictly for learning purposes only. Organizer/Presenter do not hold any
responsibility that same solution will work for your business requirements.
● This presentation is not meant for any promotional activities.
2
A recording of this meetup will be uploaded to events page within 24 hours.
Questions can be submitted/asked at any time in the Chat/Questions & Answers Tab.
Make it more Interactive!!!
Give us feedback! Rate this meetup session by filling feedback form at the end of the day.
We Love Feedbacks!!! Its Bread & Butter for Meetup.
Housekeeping
3
Organizers
● Around 15+ years of experience into ERP and integrations
● Working as principal architect at Slalom LLC
● 3X MuleSoft Certified, 1X AWS Certified
● Managed multiple end to end implementation/integrations
projects
● MuleSoft Ambassador
● Mentoring Mule Developers and People trying to switch to
MuleSoft
Neeraj Kumar
5
About the Speaker
● Working as a Senior Principal Engineer at Tricon Infotech
Private Limited.
● 13+ years of Total Experience.
● 5+ years experience in Mulesoft.
● Certified MuleSoft Developer and Architect.
● MuleSoft Mentor and Leader
● Top contributors of MuleSoft Help Forum
● Founder of DataWeave Fun
Shyam Raj Prasad
6
● Introductions
● Liquibase
❑ Introduction
❑ Major Concepts
❑ Liquibase Integration with MuleSoft
● Demo
● Wrap-Up
Agenda
Liquibase
Database Change Management
● Liquibase is an open-source solution
● It is for managing revisions of database schema scripts
● It works across various types of databases
● Supports various file formats for defining the DB structure
What is Liquibase
8
9
• We used to maintain DB scripts (text based) and add them manually to
DB
• But there are more issues
○ Easy to lost sync between code and DB state
○ Hard to find out state of particular DB environment
○ Often require to re-create DB from scratch during development
○ Hard to recover from error during development
(Ex: In case of applying wrong statement to DB)
• For these issues, Liquibase is a good solution
Why Liquibase ?
10
• Flyway
• mybatis
• c5-db-migration
• dbdeploy
• MIGRATEdb
• migrate4j
• dbmaintain
• AutoPatch
What are the other similar tools?
11
• Easy setup
• Extensibility
• Database diff report
• Supports for many database types
• Rollback database changes feature
• Database independent migration support
• Java based and easy to manage with java project
• Support for different changelog format
○ build-in: XML, YAML, JSON and SQL
How Liquibase is differ from others?
• Compatibility with a broad range of databases such as Oracle, SQL Server, MariaDB
& PostgreSQL.
• Liquibase also works with:
o DB2 on Z.
o Apache Derby and SQLite.
o Oracle ATP, H2 databases & Informix.
• For a complete list of native and community-supported databases, see Liquibase
Getting Started.
• A flexible extension framework that allows for seamless additions of newly released
platforms and integrations.
• Full control of when, where, and how database changes are deployed.
12
Major Features of Liquibase
• Ability to merge changes from multiple developers.
• Code branches.
• Multiple databases.
• Cluster-safe database upgrades.
• Generation of starting changelogs from existing databases.
• Generation of database change documentation.
• Automated updates or generation of SQL.
13
Liquibase Supports
There are two main mechanisms, or concepts, that are the foundation of Liquibase.
These two concepts are:
• Schema Changes which consist of changelogs, changesets & Change Types.
• Tracking tables that record database changes.
14
How Liquibase Works
• Schema changes are the fundamental unit of change in Liquibase.
• In SQL, schema changes are written using SQL statements that create, modify or drop
database objects.
• Examples of typical schema changes are create table, add index and drop column.
• In XML, YAML or JSON the same schema changes are modelled as Liquibase Change Types.
▪ One or more schema changes (Change Types) are grouped into a changeset. The best practice is to
limit each changeset to only one Change Type.
▪ One or more changesets are contained in a changelog.
▪ Changelogs are text files containing schema changes. They should be stored and versioned in your
preferred source control tool.
In addition to containing schema changes, a changelog can include other changelogs. This allows
multiple teams to each work on their own changelogs so they can work independently.
15
Schema Changes
Tracking tables are used to track, version, and deploy database schema changes. If your
database does not contain a tracking table, Liquibase will create one for you.
Liquibase uses two types of tables to track successful schema change deployments:
• DATABASECHANGELOG
• DATABASECHANGELOGLOCK
16
Tracking Tables
The DATABASECHANGELOG table is created and used by Liquibase to track which
changesets have already been run.
It does this by tracking each changeset as a row identified by a combination of ID, author,
and filename specified in the changelog. It is required to make each changeset ID unique in
one changelog file. The author will likely remain the same in every changeset in a changelog,
but if working in a team, it could differ per changeset.
17
DATABASECHANGELOG
To avoid database-specific restrictions on key lengths, there is no primary key
on the tracking table.
Below is an example of how your tracking table will look like
18
DATABASECHANGELOG
To prevent multiple instances of Liquibase running at one time, Liquibase creates and uses a
DATABASECHANGELOGLOCK table behind the scenes. Liquibase uses the
DATABASECHANGELOGLOCK table to prevent other developers, DBAs, or especially automated
processes from being able to execute database changes at the same time.
If multiple instances of Liquibase are running concurrently on the same database a conflict will
occur. The DATABASECHANGELOGLOCK prevents this from happening, which protects your
database.
Below is a sample DATABASECHANGELOGLOCK table.
19
DATABASECHANGELOGLOCK Table
20
• Changelog file
• Changeset
• Changes
• Preconditions
• Contexts
Major Concepts
21
• The root of all Liquibase changes is the databaseChangeLog file.
Change Log File
<databaseChangeLog>
<changeSet id="1" ...>
...
</changeSet>
<changeSet id="2" ...>
...
</changeSet>
</databaseChangeLog>
22
• It is possible to break up changelogs into multiple manageable pieces
Change Log File
<databaseChangeLog>
<include file="src/api/changelog-api-2.1.0.xml"/>
<include file="src/api/changelog-api-2.2.0.xml"/>
<include file="src/api/changelog-api-2.3.0.xml"/>
...
</databaseChangeLog>
23
• The unit Liquibase tracks execution of Database operation.
• Liquibase attempts to execute each changeSet in a transaction that
is committed at the end or rolled back if there is an error.
• Uniquely identified by the "author" & "id" attribute.
• Runs only change sets which are not in executed state yet in
DATABASECHANGELOG table.
Change Set
24
<changeSet id="2.1.0-update-display-order-admin-user-role-event-mgr"
author="Vindya"
dbms="mysql"
context="prod, test">
<comment>Sample of changeset</comment> <!-- comment is optional -->
<change .. /> <!-- will be explained later --</changeSet>
Change Set
25
• Each changeset contains a change which describes the
change/refactoring to apply to the database.
• One change per changeset.
Change
26
• Structural Refactorings
o Add Column
o Rename Column
o Modify Column
o Drop Column
o Alter Sequence
o Create Table
o Rename Table
o Drop Table
o Create View
o Rename View
o Drop View
o Merge Columns
o Create Stored Procedure
Change
27
• Data Quality Refactorings
○ Add Lookup Table
○ Add Not-Null Constraint
○ Remove Not-Null Constraint
○ Add Unique Constraint
○ Drop Unique Constraint
○ Create Sequence
○ Drop Sequence
○ Add Auto-Increment
○ Add Default Value
○ Drop Default Value
Change
28
• Referential Integrity Refactorings
○ Add Foreign Key Constraint
○ Drop Foreign Key Constraint
○ Drop All Foreign Key Constraints
○ Add Primary Key Constraint
○ Drop Primary Key Constraint
• Non-Refactoring Transformations
○ Insert Data
○ Load Data
○ Load Update Data
○ Update Data
○ Delete Data
Change
29
• Architectural Refactorings
○ Create Index
○ Drop Index
○ Custom Refactorings
• Modifying Generated SQL
○ Custom SQL
○ Custom SQL File
○ Custom Refactoring Class
○ Execute Shell Command
Change
30
● Preconditions can be applied to either the changelog as a whole or
individual change sets
● precondition - assertion, that will be evaluated before execution of
changeset.
● If a precondition fails, Liquibase will stop execution
○ check for dbms type
○ check for current user name
○ check if changeset has been executed
○ check if table exists
○ check if table has column
○ check if view exists
○ check if FK constraint exists
Preconditions
<?xml version="1.0" encoding="UTF-8"?>
<changeSet id="1" author=”sfesenko” >
<preConditions onFail="MARK_RAN">
<tableExists tableName="TEST" />
</preConditions>
<dropTable cascadeConstraints="true" tableName=”TEST” />
</changeset>
31
Preconditions
• It’s possible to specify for each changeset in what context it should be run.
• Context value can be specified on Liquibase run.
• Contexts can be applied to changesets to control which are ran in different
environments.
• Example – prod for production and test for test.
32
Changeset Context
• On Demand
o Command Line
o Ant
o Maven
• Automated
o Servlet Listener
o Spring Listener
o JEE CDI Listener
• Java APIs
o Liquibase can easily be embedded and executed through its Java APIs.
33
How to Run?
• Create property file liquibase.property with connection
○ Parameters:
▪ driver=com.mysql.jdbc.Driver
▪ classpath=db_changelogs/api
▪ changeLogFile=changelog-api-master.xml
▪ username=<username>
▪ password=<password>
▪ url=jdbc:mysql://localhost:3306/christie
▪ logLevel=DEBUG
• Run liquibase as
○ liquibase <command>
34
Command Line
• update - applies to all unrun changes.
• rollback - reverts (rolls back) changes you have made to your database.
• snapshot - used when you want to quickly compare changes in your database or
keep a record of your current database state.
• dbDoc - generates database change documentation.
• diff - allows you to compare two databases of the same type or different types to
one another.
35
Liquibase Common Commands
• diffChangeLog - used when you want to create a deployable changelog to
synchronize multiple databases.
• generateChangeLog - creates a changelog file that has a sequence of changesets
which describes how to re-create the current state of the database.
• history - a helper command that lists out all your deploymentIds and all
changesets associated with each deploymentId.
36
Liquibase Common Commands
• Use one file per changeset (greatly simplified merges)
• Use convention for file names
• Use “run on change” attribute for stored procedures, views, triggers, etc
• Decide early if rollback feature will be used
• Test both incremental and full update
• Do not change “wrong” changeset - just add new one with fix
• Consider possibility of “compressing” changesets when full update became
slow
37
Tips & Tricks
Demo
Q&A
Take a stand !
40
● Nominate yourself for the next meetup speaker and suggest a topic as well.
41
● Upcoming Meetup:
○ Advance Integrations ChatGPT <> MuleSoft by Mr. Shubham Chaurasia (May 13th )
(https://meetups.mulesoft.com/events/details/mulesoft-new-york-city-presents-first-chapter-
advanced-integrations-with-chatgpt)
● Share:
○ Tweet using the hashtag #MuleSoftMeetups
○ Invite your network to join: https://meetups.mulesoft.com/new-york-city/
● Feedback:
○ Fill out the survey feedback and suggest topics for upcoming events
○ Contact MuleSoft at meetups@mulesoft.com for ways to improve the program
What’s next?
Thank you

More Related Content

Similar to Liquibase Integration with MuleSoft

Continuous DB Changes Delivery With Liquibase
Continuous DB Changes Delivery With LiquibaseContinuous DB Changes Delivery With Liquibase
Continuous DB Changes Delivery With LiquibaseAidas Dragūnas
 
Ten query tuning techniques every SQL Server programmer should know
Ten query tuning techniques every SQL Server programmer should knowTen query tuning techniques every SQL Server programmer should know
Ten query tuning techniques every SQL Server programmer should knowKevin Kline
 
Introduction To Liquibase
Introduction To Liquibase Introduction To Liquibase
Introduction To Liquibase Knoldus Inc.
 
Evolutionary database design
Evolutionary database designEvolutionary database design
Evolutionary database designSalehein Syed
 
Delivering Changes for Applications and Databases
Delivering Changes for Applications and DatabasesDelivering Changes for Applications and Databases
Delivering Changes for Applications and DatabasesMiguel Alho
 
Bringing DevOps to the Database
Bringing DevOps to the DatabaseBringing DevOps to the Database
Bringing DevOps to the DatabaseMichaela Murray
 
Liquibase – a time machine for your data
Liquibase – a time machine for your dataLiquibase – a time machine for your data
Liquibase – a time machine for your dataNeev Technologies
 
Powering GIS Application with PostgreSQL and Postgres Plus
Powering GIS Application with PostgreSQL and Postgres Plus Powering GIS Application with PostgreSQL and Postgres Plus
Powering GIS Application with PostgreSQL and Postgres Plus Ashnikbiz
 
Delivering changes for applications and databases
Delivering changes for applications and databasesDelivering changes for applications and databases
Delivering changes for applications and databasesEduardo Piairo
 
Database Migrations with Gradle and Liquibase
Database Migrations with Gradle and LiquibaseDatabase Migrations with Gradle and Liquibase
Database Migrations with Gradle and LiquibaseDan Stine
 
Handling Database Deployments
Handling Database DeploymentsHandling Database Deployments
Handling Database DeploymentsMike Willbanks
 
OSA Con 2022 - Extract, Transform, and Learn about your developers - Brian Le...
OSA Con 2022 - Extract, Transform, and Learn about your developers - Brian Le...OSA Con 2022 - Extract, Transform, and Learn about your developers - Brian Le...
OSA Con 2022 - Extract, Transform, and Learn about your developers - Brian Le...Altinity Ltd
 
MySQL Workbench and Visual Explain -- RMUG Feb 19th 2015
MySQL Workbench and Visual Explain -- RMUG Feb 19th 2015MySQL Workbench and Visual Explain -- RMUG Feb 19th 2015
MySQL Workbench and Visual Explain -- RMUG Feb 19th 2015Dave Stokes
 
Technical Introduction to PostgreSQL and PPAS
Technical Introduction to PostgreSQL and PPASTechnical Introduction to PostgreSQL and PPAS
Technical Introduction to PostgreSQL and PPASAshnikbiz
 
Sql developer - Powerful Free tool for Developers and DBA's
Sql developer - Powerful Free tool for Developers and DBA'sSql developer - Powerful Free tool for Developers and DBA's
Sql developer - Powerful Free tool for Developers and DBA'sNavneet Upneja
 
Why retail companies can't afford database downtime
Why retail companies can't afford database downtimeWhy retail companies can't afford database downtime
Why retail companies can't afford database downtimeDBmaestro - Database DevOps
 
Weblogic server-overview-weblogic-scripting-tool0-1228252752844434-9
Weblogic server-overview-weblogic-scripting-tool0-1228252752844434-9Weblogic server-overview-weblogic-scripting-tool0-1228252752844434-9
Weblogic server-overview-weblogic-scripting-tool0-1228252752844434-9Bhaskar Naik
 
OpenNTF Webinar, October 2020
OpenNTF Webinar, October 2020OpenNTF Webinar, October 2020
OpenNTF Webinar, October 2020Howard Greenberg
 

Similar to Liquibase Integration with MuleSoft (20)

Continuous DB Changes Delivery With Liquibase
Continuous DB Changes Delivery With LiquibaseContinuous DB Changes Delivery With Liquibase
Continuous DB Changes Delivery With Liquibase
 
Ten query tuning techniques every SQL Server programmer should know
Ten query tuning techniques every SQL Server programmer should knowTen query tuning techniques every SQL Server programmer should know
Ten query tuning techniques every SQL Server programmer should know
 
Introduction To Liquibase
Introduction To Liquibase Introduction To Liquibase
Introduction To Liquibase
 
Evolutionary database design
Evolutionary database designEvolutionary database design
Evolutionary database design
 
Delivering Changes for Applications and Databases
Delivering Changes for Applications and DatabasesDelivering Changes for Applications and Databases
Delivering Changes for Applications and Databases
 
Bringing DevOps to the Database
Bringing DevOps to the DatabaseBringing DevOps to the Database
Bringing DevOps to the Database
 
Liquibase – a time machine for your data
Liquibase – a time machine for your dataLiquibase – a time machine for your data
Liquibase – a time machine for your data
 
Powering GIS Application with PostgreSQL and Postgres Plus
Powering GIS Application with PostgreSQL and Postgres Plus Powering GIS Application with PostgreSQL and Postgres Plus
Powering GIS Application with PostgreSQL and Postgres Plus
 
Rails data migrations
Rails data migrationsRails data migrations
Rails data migrations
 
Delivering changes for applications and databases
Delivering changes for applications and databasesDelivering changes for applications and databases
Delivering changes for applications and databases
 
LiquiBase
LiquiBaseLiquiBase
LiquiBase
 
Database Migrations with Gradle and Liquibase
Database Migrations with Gradle and LiquibaseDatabase Migrations with Gradle and Liquibase
Database Migrations with Gradle and Liquibase
 
Handling Database Deployments
Handling Database DeploymentsHandling Database Deployments
Handling Database Deployments
 
OSA Con 2022 - Extract, Transform, and Learn about your developers - Brian Le...
OSA Con 2022 - Extract, Transform, and Learn about your developers - Brian Le...OSA Con 2022 - Extract, Transform, and Learn about your developers - Brian Le...
OSA Con 2022 - Extract, Transform, and Learn about your developers - Brian Le...
 
MySQL Workbench and Visual Explain -- RMUG Feb 19th 2015
MySQL Workbench and Visual Explain -- RMUG Feb 19th 2015MySQL Workbench and Visual Explain -- RMUG Feb 19th 2015
MySQL Workbench and Visual Explain -- RMUG Feb 19th 2015
 
Technical Introduction to PostgreSQL and PPAS
Technical Introduction to PostgreSQL and PPASTechnical Introduction to PostgreSQL and PPAS
Technical Introduction to PostgreSQL and PPAS
 
Sql developer - Powerful Free tool for Developers and DBA's
Sql developer - Powerful Free tool for Developers and DBA'sSql developer - Powerful Free tool for Developers and DBA's
Sql developer - Powerful Free tool for Developers and DBA's
 
Why retail companies can't afford database downtime
Why retail companies can't afford database downtimeWhy retail companies can't afford database downtime
Why retail companies can't afford database downtime
 
Weblogic server-overview-weblogic-scripting-tool0-1228252752844434-9
Weblogic server-overview-weblogic-scripting-tool0-1228252752844434-9Weblogic server-overview-weblogic-scripting-tool0-1228252752844434-9
Weblogic server-overview-weblogic-scripting-tool0-1228252752844434-9
 
OpenNTF Webinar, October 2020
OpenNTF Webinar, October 2020OpenNTF Webinar, October 2020
OpenNTF Webinar, October 2020
 

More from NeerajKumar1965

Advanced Integrations of MuleSoft with ChatGTP
Advanced Integrations of MuleSoft with ChatGTPAdvanced Integrations of MuleSoft with ChatGTP
Advanced Integrations of MuleSoft with ChatGTPNeerajKumar1965
 
Introduction to CloudHub 2.0
Introduction to CloudHub 2.0Introduction to CloudHub 2.0
Introduction to CloudHub 2.0NeerajKumar1965
 
Shopify Mulesoft Integrations
Shopify Mulesoft IntegrationsShopify Mulesoft Integrations
Shopify Mulesoft IntegrationsNeerajKumar1965
 
Batch Message Listener capabilities of the Apache Kafka Connector
Batch Message Listener capabilities of the Apache Kafka ConnectorBatch Message Listener capabilities of the Apache Kafka Connector
Batch Message Listener capabilities of the Apache Kafka ConnectorNeerajKumar1965
 
Deep Dive into Event Driven Architecture(Async API)
Deep Dive into Event Driven Architecture(Async API)Deep Dive into Event Driven Architecture(Async API)
Deep Dive into Event Driven Architecture(Async API)NeerajKumar1965
 
Accelerate integration with SAP using MuleSoft
Accelerate integration with SAP using MuleSoftAccelerate integration with SAP using MuleSoft
Accelerate integration with SAP using MuleSoftNeerajKumar1965
 
Deep Dive into Salesforce APIs
Deep Dive into Salesforce APIsDeep Dive into Salesforce APIs
Deep Dive into Salesforce APIsNeerajKumar1965
 
Automate mule deployments with github actions and travis ci
Automate mule deployments with github actions  and  travis ciAutomate mule deployments with github actions  and  travis ci
Automate mule deployments with github actions and travis ciNeerajKumar1965
 
Trailhead - The bridge between Salesforce and MuleSoft
Trailhead - The bridge between Salesforce and MuleSoftTrailhead - The bridge between Salesforce and MuleSoft
Trailhead - The bridge between Salesforce and MuleSoftNeerajKumar1965
 
Caching strategies in MuleSoft
Caching strategies in MuleSoftCaching strategies in MuleSoft
Caching strategies in MuleSoftNeerajKumar1965
 
Deep Dive on CI/CD NYC Meet Up Group
Deep Dive on CI/CD NYC Meet Up GroupDeep Dive on CI/CD NYC Meet Up Group
Deep Dive on CI/CD NYC Meet Up GroupNeerajKumar1965
 
Anypoint MQ-DLQ NYC Meet Up
Anypoint MQ-DLQ NYC Meet UpAnypoint MQ-DLQ NYC Meet Up
Anypoint MQ-DLQ NYC Meet UpNeerajKumar1965
 
Batch Processing with Mule 4
Batch Processing with Mule 4Batch Processing with Mule 4
Batch Processing with Mule 4NeerajKumar1965
 
Nyc mule soft_meetup_13_march_2021
Nyc mule soft_meetup_13_march_2021Nyc mule soft_meetup_13_march_2021
Nyc mule soft_meetup_13_march_2021NeerajKumar1965
 
New York City Meetup- 6th March 2021
New York City Meetup- 6th March 2021New York City Meetup- 6th March 2021
New York City Meetup- 6th March 2021NeerajKumar1965
 

More from NeerajKumar1965 (19)

Advanced Integrations of MuleSoft with ChatGTP
Advanced Integrations of MuleSoft with ChatGTPAdvanced Integrations of MuleSoft with ChatGTP
Advanced Integrations of MuleSoft with ChatGTP
 
Introduction to CloudHub 2.0
Introduction to CloudHub 2.0Introduction to CloudHub 2.0
Introduction to CloudHub 2.0
 
Shopify Mulesoft Integrations
Shopify Mulesoft IntegrationsShopify Mulesoft Integrations
Shopify Mulesoft Integrations
 
Connect_Recap.pptx
Connect_Recap.pptxConnect_Recap.pptx
Connect_Recap.pptx
 
Batch Message Listener capabilities of the Apache Kafka Connector
Batch Message Listener capabilities of the Apache Kafka ConnectorBatch Message Listener capabilities of the Apache Kafka Connector
Batch Message Listener capabilities of the Apache Kafka Connector
 
Deep Dive into Event Driven Architecture(Async API)
Deep Dive into Event Driven Architecture(Async API)Deep Dive into Event Driven Architecture(Async API)
Deep Dive into Event Driven Architecture(Async API)
 
Anypoint Data Graphs
Anypoint Data GraphsAnypoint Data Graphs
Anypoint Data Graphs
 
Accelerate integration with SAP using MuleSoft
Accelerate integration with SAP using MuleSoftAccelerate integration with SAP using MuleSoft
Accelerate integration with SAP using MuleSoft
 
Deep Dive into Salesforce APIs
Deep Dive into Salesforce APIsDeep Dive into Salesforce APIs
Deep Dive into Salesforce APIs
 
Automate mule deployments with github actions and travis ci
Automate mule deployments with github actions  and  travis ciAutomate mule deployments with github actions  and  travis ci
Automate mule deployments with github actions and travis ci
 
Trailhead - The bridge between Salesforce and MuleSoft
Trailhead - The bridge between Salesforce and MuleSoftTrailhead - The bridge between Salesforce and MuleSoft
Trailhead - The bridge between Salesforce and MuleSoft
 
Power of LWC + Mulesoft
Power of LWC + MulesoftPower of LWC + Mulesoft
Power of LWC + Mulesoft
 
Caching strategies in MuleSoft
Caching strategies in MuleSoftCaching strategies in MuleSoft
Caching strategies in MuleSoft
 
Deep Dive on CI/CD NYC Meet Up Group
Deep Dive on CI/CD NYC Meet Up GroupDeep Dive on CI/CD NYC Meet Up Group
Deep Dive on CI/CD NYC Meet Up Group
 
Integrating with Aws s3
Integrating with Aws s3Integrating with Aws s3
Integrating with Aws s3
 
Anypoint MQ-DLQ NYC Meet Up
Anypoint MQ-DLQ NYC Meet UpAnypoint MQ-DLQ NYC Meet Up
Anypoint MQ-DLQ NYC Meet Up
 
Batch Processing with Mule 4
Batch Processing with Mule 4Batch Processing with Mule 4
Batch Processing with Mule 4
 
Nyc mule soft_meetup_13_march_2021
Nyc mule soft_meetup_13_march_2021Nyc mule soft_meetup_13_march_2021
Nyc mule soft_meetup_13_march_2021
 
New York City Meetup- 6th March 2021
New York City Meetup- 6th March 2021New York City Meetup- 6th March 2021
New York City Meetup- 6th March 2021
 

Recently uploaded

What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作qr0udbr0
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Velvetech LLC
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Hr365.us smith
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)jennyeacort
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 

Recently uploaded (20)

What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 

Liquibase Integration with MuleSoft

  • 1. 15 Apr 2023 NYC MuleSoft Meetup Group Liquibase Integration with MuleSoft
  • 2. Safe Harbour Statement ● Both the speaker and the host are organizing this meet-up in individual capacity only. We are not representing our companies here. ● This presentation is strictly for learning purposes only. Organizer/Presenter do not hold any responsibility that same solution will work for your business requirements. ● This presentation is not meant for any promotional activities. 2
  • 3. A recording of this meetup will be uploaded to events page within 24 hours. Questions can be submitted/asked at any time in the Chat/Questions & Answers Tab. Make it more Interactive!!! Give us feedback! Rate this meetup session by filling feedback form at the end of the day. We Love Feedbacks!!! Its Bread & Butter for Meetup. Housekeeping 3
  • 4. Organizers ● Around 15+ years of experience into ERP and integrations ● Working as principal architect at Slalom LLC ● 3X MuleSoft Certified, 1X AWS Certified ● Managed multiple end to end implementation/integrations projects ● MuleSoft Ambassador ● Mentoring Mule Developers and People trying to switch to MuleSoft Neeraj Kumar
  • 5. 5 About the Speaker ● Working as a Senior Principal Engineer at Tricon Infotech Private Limited. ● 13+ years of Total Experience. ● 5+ years experience in Mulesoft. ● Certified MuleSoft Developer and Architect. ● MuleSoft Mentor and Leader ● Top contributors of MuleSoft Help Forum ● Founder of DataWeave Fun Shyam Raj Prasad
  • 6. 6 ● Introductions ● Liquibase ❑ Introduction ❑ Major Concepts ❑ Liquibase Integration with MuleSoft ● Demo ● Wrap-Up Agenda
  • 8. ● Liquibase is an open-source solution ● It is for managing revisions of database schema scripts ● It works across various types of databases ● Supports various file formats for defining the DB structure What is Liquibase 8
  • 9. 9 • We used to maintain DB scripts (text based) and add them manually to DB • But there are more issues ○ Easy to lost sync between code and DB state ○ Hard to find out state of particular DB environment ○ Often require to re-create DB from scratch during development ○ Hard to recover from error during development (Ex: In case of applying wrong statement to DB) • For these issues, Liquibase is a good solution Why Liquibase ?
  • 10. 10 • Flyway • mybatis • c5-db-migration • dbdeploy • MIGRATEdb • migrate4j • dbmaintain • AutoPatch What are the other similar tools?
  • 11. 11 • Easy setup • Extensibility • Database diff report • Supports for many database types • Rollback database changes feature • Database independent migration support • Java based and easy to manage with java project • Support for different changelog format ○ build-in: XML, YAML, JSON and SQL How Liquibase is differ from others?
  • 12. • Compatibility with a broad range of databases such as Oracle, SQL Server, MariaDB & PostgreSQL. • Liquibase also works with: o DB2 on Z. o Apache Derby and SQLite. o Oracle ATP, H2 databases & Informix. • For a complete list of native and community-supported databases, see Liquibase Getting Started. • A flexible extension framework that allows for seamless additions of newly released platforms and integrations. • Full control of when, where, and how database changes are deployed. 12 Major Features of Liquibase
  • 13. • Ability to merge changes from multiple developers. • Code branches. • Multiple databases. • Cluster-safe database upgrades. • Generation of starting changelogs from existing databases. • Generation of database change documentation. • Automated updates or generation of SQL. 13 Liquibase Supports
  • 14. There are two main mechanisms, or concepts, that are the foundation of Liquibase. These two concepts are: • Schema Changes which consist of changelogs, changesets & Change Types. • Tracking tables that record database changes. 14 How Liquibase Works
  • 15. • Schema changes are the fundamental unit of change in Liquibase. • In SQL, schema changes are written using SQL statements that create, modify or drop database objects. • Examples of typical schema changes are create table, add index and drop column. • In XML, YAML or JSON the same schema changes are modelled as Liquibase Change Types. ▪ One or more schema changes (Change Types) are grouped into a changeset. The best practice is to limit each changeset to only one Change Type. ▪ One or more changesets are contained in a changelog. ▪ Changelogs are text files containing schema changes. They should be stored and versioned in your preferred source control tool. In addition to containing schema changes, a changelog can include other changelogs. This allows multiple teams to each work on their own changelogs so they can work independently. 15 Schema Changes
  • 16. Tracking tables are used to track, version, and deploy database schema changes. If your database does not contain a tracking table, Liquibase will create one for you. Liquibase uses two types of tables to track successful schema change deployments: • DATABASECHANGELOG • DATABASECHANGELOGLOCK 16 Tracking Tables
  • 17. The DATABASECHANGELOG table is created and used by Liquibase to track which changesets have already been run. It does this by tracking each changeset as a row identified by a combination of ID, author, and filename specified in the changelog. It is required to make each changeset ID unique in one changelog file. The author will likely remain the same in every changeset in a changelog, but if working in a team, it could differ per changeset. 17 DATABASECHANGELOG
  • 18. To avoid database-specific restrictions on key lengths, there is no primary key on the tracking table. Below is an example of how your tracking table will look like 18 DATABASECHANGELOG
  • 19. To prevent multiple instances of Liquibase running at one time, Liquibase creates and uses a DATABASECHANGELOGLOCK table behind the scenes. Liquibase uses the DATABASECHANGELOGLOCK table to prevent other developers, DBAs, or especially automated processes from being able to execute database changes at the same time. If multiple instances of Liquibase are running concurrently on the same database a conflict will occur. The DATABASECHANGELOGLOCK prevents this from happening, which protects your database. Below is a sample DATABASECHANGELOGLOCK table. 19 DATABASECHANGELOGLOCK Table
  • 20. 20 • Changelog file • Changeset • Changes • Preconditions • Contexts Major Concepts
  • 21. 21 • The root of all Liquibase changes is the databaseChangeLog file. Change Log File <databaseChangeLog> <changeSet id="1" ...> ... </changeSet> <changeSet id="2" ...> ... </changeSet> </databaseChangeLog>
  • 22. 22 • It is possible to break up changelogs into multiple manageable pieces Change Log File <databaseChangeLog> <include file="src/api/changelog-api-2.1.0.xml"/> <include file="src/api/changelog-api-2.2.0.xml"/> <include file="src/api/changelog-api-2.3.0.xml"/> ... </databaseChangeLog>
  • 23. 23 • The unit Liquibase tracks execution of Database operation. • Liquibase attempts to execute each changeSet in a transaction that is committed at the end or rolled back if there is an error. • Uniquely identified by the "author" & "id" attribute. • Runs only change sets which are not in executed state yet in DATABASECHANGELOG table. Change Set
  • 24. 24 <changeSet id="2.1.0-update-display-order-admin-user-role-event-mgr" author="Vindya" dbms="mysql" context="prod, test"> <comment>Sample of changeset</comment> <!-- comment is optional --> <change .. /> <!-- will be explained later --</changeSet> Change Set
  • 25. 25 • Each changeset contains a change which describes the change/refactoring to apply to the database. • One change per changeset. Change
  • 26. 26 • Structural Refactorings o Add Column o Rename Column o Modify Column o Drop Column o Alter Sequence o Create Table o Rename Table o Drop Table o Create View o Rename View o Drop View o Merge Columns o Create Stored Procedure Change
  • 27. 27 • Data Quality Refactorings ○ Add Lookup Table ○ Add Not-Null Constraint ○ Remove Not-Null Constraint ○ Add Unique Constraint ○ Drop Unique Constraint ○ Create Sequence ○ Drop Sequence ○ Add Auto-Increment ○ Add Default Value ○ Drop Default Value Change
  • 28. 28 • Referential Integrity Refactorings ○ Add Foreign Key Constraint ○ Drop Foreign Key Constraint ○ Drop All Foreign Key Constraints ○ Add Primary Key Constraint ○ Drop Primary Key Constraint • Non-Refactoring Transformations ○ Insert Data ○ Load Data ○ Load Update Data ○ Update Data ○ Delete Data Change
  • 29. 29 • Architectural Refactorings ○ Create Index ○ Drop Index ○ Custom Refactorings • Modifying Generated SQL ○ Custom SQL ○ Custom SQL File ○ Custom Refactoring Class ○ Execute Shell Command Change
  • 30. 30 ● Preconditions can be applied to either the changelog as a whole or individual change sets ● precondition - assertion, that will be evaluated before execution of changeset. ● If a precondition fails, Liquibase will stop execution ○ check for dbms type ○ check for current user name ○ check if changeset has been executed ○ check if table exists ○ check if table has column ○ check if view exists ○ check if FK constraint exists Preconditions
  • 31. <?xml version="1.0" encoding="UTF-8"?> <changeSet id="1" author=”sfesenko” > <preConditions onFail="MARK_RAN"> <tableExists tableName="TEST" /> </preConditions> <dropTable cascadeConstraints="true" tableName=”TEST” /> </changeset> 31 Preconditions
  • 32. • It’s possible to specify for each changeset in what context it should be run. • Context value can be specified on Liquibase run. • Contexts can be applied to changesets to control which are ran in different environments. • Example – prod for production and test for test. 32 Changeset Context
  • 33. • On Demand o Command Line o Ant o Maven • Automated o Servlet Listener o Spring Listener o JEE CDI Listener • Java APIs o Liquibase can easily be embedded and executed through its Java APIs. 33 How to Run?
  • 34. • Create property file liquibase.property with connection ○ Parameters: ▪ driver=com.mysql.jdbc.Driver ▪ classpath=db_changelogs/api ▪ changeLogFile=changelog-api-master.xml ▪ username=<username> ▪ password=<password> ▪ url=jdbc:mysql://localhost:3306/christie ▪ logLevel=DEBUG • Run liquibase as ○ liquibase <command> 34 Command Line
  • 35. • update - applies to all unrun changes. • rollback - reverts (rolls back) changes you have made to your database. • snapshot - used when you want to quickly compare changes in your database or keep a record of your current database state. • dbDoc - generates database change documentation. • diff - allows you to compare two databases of the same type or different types to one another. 35 Liquibase Common Commands
  • 36. • diffChangeLog - used when you want to create a deployable changelog to synchronize multiple databases. • generateChangeLog - creates a changelog file that has a sequence of changesets which describes how to re-create the current state of the database. • history - a helper command that lists out all your deploymentIds and all changesets associated with each deploymentId. 36 Liquibase Common Commands
  • 37. • Use one file per changeset (greatly simplified merges) • Use convention for file names • Use “run on change” attribute for stored procedures, views, triggers, etc • Decide early if rollback feature will be used • Test both incremental and full update • Do not change “wrong” changeset - just add new one with fix • Consider possibility of “compressing” changesets when full update became slow 37 Tips & Tricks
  • 38. Demo
  • 39. Q&A
  • 40. Take a stand ! 40 ● Nominate yourself for the next meetup speaker and suggest a topic as well.
  • 41. 41 ● Upcoming Meetup: ○ Advance Integrations ChatGPT <> MuleSoft by Mr. Shubham Chaurasia (May 13th ) (https://meetups.mulesoft.com/events/details/mulesoft-new-york-city-presents-first-chapter- advanced-integrations-with-chatgpt) ● Share: ○ Tweet using the hashtag #MuleSoftMeetups ○ Invite your network to join: https://meetups.mulesoft.com/new-york-city/ ● Feedback: ○ Fill out the survey feedback and suggest topics for upcoming events ○ Contact MuleSoft at meetups@mulesoft.com for ways to improve the program What’s next?