SlideShare a Scribd company logo
1 of 63
Database Migrations
with Gradle and Liquibase
Dan Stine
Copyright Clearance Center
www.copyright.com
Gradle Summit
June 12, 2015
About Me
• Software Architect
• Library & Framework Developer
• Platform Engineering Lead & Product Owner
• Gradle User Since 2011
• Enemy of Inefficiency & Needless Inconsistency
dstine at copyright.com
sw at stinemail.com
github.com/dstine
6/12/20152
About Copyright Clearance Center
• Global licensing solutions that make © work for everyone
– Get, share and manage content
– Rights broker for the world’s most sought-after materials
– Global company (US, Europe, Asia) – HQ in Danvers, MA
• Industry-specific software systems
– Internal and external user base
– Applications, services, databases
– Organic growth over many years
• In 2011, CCC adopted a Product Platform strategy for
growing its software portfolio
6/12/20153
Agenda
• Context
• Liquibase
• Development Process
• Deploy Time
• Extensibility
• Wrap Up
6/12/20154
CONTEXT
6/12/20155
Database Migrations
• Database structure changes
– Tables, constraints, indexes, etc.
– Schema changes (DDL, not DML)
• Reference data
– List of countries, user types, order status, etc.
– Set of allowed values
• Database logic
– Functions, procedures, triggers
– (Very little of this)
6/12/20156
Our Historical Approach
• DB migrations handled in relatively ad-hoc fashion
• Various flavors of “standard” practice
– Framework copied and modified from project to project
– Framework not always used (“small” projects)
• Development teams shared a DEV database
– Conflicts between code and database
6/12/20157
Development Pain Points
• Intra-team collaboration was difficult
• Forced synchronous updates within development team
• Learn variations when switching between projects
• Project startup was costly
6/12/20158
Deployment Pain Points
• Manual process
– Where are the scripts for this app?
– Which scripts should be run and how?
• Recurring difficulties
– Hours spent resolving mismatches between app and database
– Testing activities frequently delayed or even restarted
• Impossible to automate
– Too many variations
• Self-service deployment was a pipe dream
6/12/20159
Standard Software Platform
• Started platform definition in 2011
– Homogenous by default
• Tools
– Java, Spring, Tomcat, Postgres
– Git / GitHub, Gradle, Jenkins, Artifactory, Liquibase, Chef
• Process
– Standard development workflow
– Standard application shape & operational profile
6/12/201510
Vision for Database Script Management
• Integrated into developer workflow
• Feeds cleanly into deployment workflow
• Developer commits scripts and the process takes over
– Just like with application code
6/12/201511
A Plan For Pain Relief
• Manage scripts as first-class citizens
– Same repo as application code
– Standard location in source tree
• Standard execution engine
– No more variations
– Automatic tracking of applied migrations
• Prevent conflicts and mismatches
– Introduce developer workstation databases (LOCAL )
– Dedicated sandbox
– Commit database and associated application change together
6/12/201512
A Plan For Pain Relief
• Liquibase
– Database described as code
– Execution engine & migration tracking
• Gradle
– Provide conventions
– Tasks for invoking Liquibase
– Already familiar to developers from existing build process
– Flexibility to integrate into deployment process
– Flexibility to handle emergent requirements
6/12/201513
LIQUIBASE
6/12/201514
Liquibase Basics
• Provides vocabulary of database changes
– Create Table, Add PK, Add FK, Add Column, Add
Index, …
– Drop Table, Drop PK, Drop FK, Drop Column, Drop
Index, …
– Insert, Update, Delete, …
• Changes are grouped into changesets
– Change(s) that should be applied atomically
• Changesets are grouped into changelogs
– Files managed in version control
6/12/201515
Liquibase Basics
• Changesets uniquely identified by [Author, ID, File]
– Liquibase tracks changeset execution in a special table
– Lock table to prevent concurrent Liquibase invocations
– Modified changesets are detected via checksums
• Supported databases
– MySQL, PostgreSQL, Oracle, SQL Server, …
• Groovy DSL
– Liquibase v2 supported only XML
– https://github.com/tlberglund/groovy-liquibase
6/12/201516
Example Changeset
changeSet(id: '2015-01-23', author: 'John Doe <jdoe@copyright.com>') {
createTable(schemaName: 'apps', tableName: 'myapp_version',
tablespace: 'ccc_data') {
column(name: 'version_uid', type: 'VARCHAR(128)')
column(name: 'type', type: 'VARCHAR(10)')
column(name: 'owner_uid', type: 'VARCHAR(128)')
column(name: 'version', type: 'VARCHAR(20)')
column(name: 'start_date', type: 'TIMESTAMPTZ')
column(name: 'end_date', type: 'TIMESTAMPTZ')
}
addPrimaryKey(constraintName: 'PK_myapp_version',
schemaName: 'apps', tableName: 'myapp_version',
tablespace: 'ccc_index', columnNames: 'version_uid')
addForeignKeyConstraint(constraintName: 'FK_myapp_version_2_owner',
baseTableSchemaName: 'apps', baseTableName: 'myapp_version',
baseColumnNames: 'owner_uid',
referencedTableSchemaName: 'apps',
referencedTableName: 'myapp_owner',
referencedColumnNames: 'owner_uid')
}
6/12/201517
Liquibase @ CCC
• Learning curve
– Team needs to understand the underlying model
– Don’t edit changesets once they’ve been applied
• Our standards
– Schema name and tablespace are required
– Parameterize schema name and tablespace
createTable(
schemaName: dbAppsSchema,
tableName: 'myapp_version',
tablespace: dbDataTablespace)
6/12/201518
DEVELOPMENT PROCESS
6/12/201519
Development Workflow
• Gradle is our SCM hub
– Workstation builds
– LOCAL app servers via command line
– IDE integration
– CI and release builds on Jenkins
• Maintain Gradle-centric workflow
– Integrated database development
6/12/201520
Standard Project Structure
• Single Git repo with multi-project Gradle build
myapp
myapp-db
myapp-rest
myapp-service
myapp-ui
group = com.copyright.myapp
• UI and REST service published as WARs
• DB published as JAR
6/12/201521
Custom Gradle Plugin
• Created custom plugin: ccc-postgres
• Standard script location
– Main source set: src/main/liquibase
– Package: com.copyright.myapp.db
• Standard versions
– Liquibase itself
– Postgres JDBC driver
6/12/201522
Plugin Extension
• Custom DSL via Gradle extension
cccPostgres {
mainChangelog = 'com/copyright/myapp/db/main.groovy'
}
• Main changelog includes other changelogs
6/12/201523
Development Lifecycle Tasks
• Provided by ccc-postgres
• Easy to manage LOCAL development database
– Isolated from other developers and deployments
– Pull in new schema changes  run a task
• Built on Gradle Liquibase plugin
https://github.com/tlberglund/gradle-liquibase-plugin
6/12/201524
Development Lifecycle Tasks
6/12/201525
Development Lifecycle Tasks
• Typical developer loop
– gradlew update
– gradlew tomcatRun and/or IDE
• Not just for product development teams
– Simple to run any app
– Architects, QA, Platform Engineering
6/12/201526
Development Lifecycle Tasks
Task Runs As Description
createDatabase postgres Creates ccc user and database
Creates data and index tablespaces
createSchema ccc Creates apps schema
update ccc Runs main changelog
dropDatabase postgres Drops ccc user and database
resetBaseChangelog postgres Truncates
postgres.public.databasechangelog
6/12/201527
• resetBaseChangelog
– Must clear all traces of Liquibase to start over
Plugin Configuration
• Override default library versions
cccPostgres.standardDependencies.postgresDriver
• Defaults point to LOCAL development database
– Can override property values
dbHost, dbPort, dbName
dbUsername, dbPassword
dbDataTablespace, dbIndexTablespace
dbBaseUsername, dbBasePassword
6/12/201528
Standardization and Compliance
• So all our teams are authoring DB code
• But Liquibase is new to many
• And we have company standards
• Let’s automate!
6/12/201529
Static Analysis
• CodeNarc
– Static analysis of Groovy code
– Allows custom rule sets
• Created a set of custom CodeNarc rules
– Analyze our Liquibase Groovy DSL changelogs
• Apply to our db projects via the Gradle codenarc plugin
– Fail build if violations are found
6/12/201530
Static Analysis – Required Attributes
• Our rule categorizes all change attributes
– Required by Liquibase
• createTable requires tableName
– Required by CCC
• createTable requires schemaName and tablespace
– Optional
• Unintended positive consequence!
– Catches typos that otherwise would not be detected until farther
downstream
– constrainttName or tablspace
6/12/201531
Static Analysis – Required Parameterization
• Ensure that schemaName & tablespace are parameterized for
future flexibility
@Override
void visitMapExpression(MapExpression mapExpression) {
mapExpression.mapEntryExpressions
.findAll { it.keyExpression instanceof ConstantExpression }
.findAll { ['schemaName', 'tablespace']
.contains(it.keyExpression.value) }
.findAll { it.valueExpression instanceof ConstantExpression }
.each { addViolation(it, "${it.keyExpression.value} should
not be hard-coded") }
super.visitMapExpression(mapExpression)
}
6/12/201532
Schema Spy
• Generates visual representation of database structure
– Requires running database instance
– Requires GraphViz installation
• Custom task runSchemaSpy
– By default, points at LOCAL database
6/12/201533
Continuous Integration for DB Scripts
• Compile Groovy
– Catches basic syntax errors
• CodeNarc analysis
– Catches policy and DSL violations
• Integration tests
– Apply Liquibase scripts to H2 in-memory database
– Catches additional classes of error
6/12/201534
Release Build
• Publish JAR
– Liquibase Groovy scripts from src/main/liquibase
• META-INF/MANIFEST.MF contains entry point
Name: ccc-postgres
MainChangelog: com/copyright/myapp/db/main.groovy
6/12/201535
DEPLOY TIME
6/12/201536
Deployment Automation
• Early efforts focused on applications themselves
– Jenkins orchestrating Chef runs
– Initial transition from prose instructions to Infrastructure as Code
• Database deployments remained manual
– Better than ad-hoc approach
– But still error prone and time-consuming
6/12/201537
Automated Application Deployments
• Chef environment file
– Cookbook versions: which instructions are used
• Chef data bags
– Configuration values for each environment
– Encrypted data bags for (e.g.) database credentials
• Jenkins deploy jobs (a.k.a “the button”)
– Parameters = environment, application version
6/12/201538
Initial Delivery Pipeline
6/12/201539
Manual
Deploy
Initial Delivery Pipeline (DB Deployments)
• Clone Git repo and checkout tag
• Manually configure & run Gradle task from ccc-postgres
gradlew update -PdbHost=testdb.copyright.com
-PdbPort=5432 -PdbDatabase=ccc
-PdbUsername=ccc -PdbPassword=******
• Many apps x
many versions x
multiple environments =
TIME & EFFORT & ERROR
6/12/201540
Target Delivery Pipeline
6/12/201541
Full Stack
Automated
Deploy
Target Delivery Pipeline
• Automated process should also update database
– Single Jenkins job for both apps and database scripts
• Maintain data-driven design
– Environment file lists database artifacts
– Controlled flow down the pipeline
• Gradle database deployment task
– Retrieve scripts from Artifactory
– Harvest information already in Chef data bags (URL, password)
– Execute Liquibase
6/12/201542
Automated Database Deployment
6/12/201543
Jenkins Deploy Job
• One job per application group, per set of deployers
– E.g. myapp.qa allows QA to deploy to environments they own
– Typically contains multiple deployables (apps, db artifacts)
– Typical deployer sets = DEV, QA, OPS
• Executes Liquibase via Gradle for database deployments
– Invokes deployDbArtifact task for each db artifact
• (Executes Chef for application deployments)
6/12/201544
Gradle deployDbArtifact Task
• Parameterized via Gradle project properties
– appGroup = myapp
– artifactName = myapp-db
– artifactVersion = 2.1.12
– environment = TEST
• Downloads JAR from Artifactory
– com.copyright.myapp:myapp-db:2.1.12
– Extract MainChangelog value from manifest
6/12/201545
Gradle deployDbArtifact Task
• Retrieves DB URL from Chef data bag item for TEST
"myapp.db.url": "jdbc:postgresql://testdb:5432/ccc"
• Retrieves password from encrypted Chef data bag
– myapp.db.password
• Executes Liquibase
6/12/201546
Data Bag Access
• Built on top of Chef Java bindings from jclouds
• No support for encrypted data bags
• Java Cryptography Extensions and the following libs:
compile 'org.apache.jclouds.api:chef:1.7.2'
compile 'org.apache.jclouds.provider:enterprisechef:1.7.2'
compile 'commons-codec:commons-codec:1.9'
6/12/201547
Push-Button Deploys
6/12/201548
Deploy History
6/10/2015
DEV TEST PROD
Automated Deployments By Role
6/12/201550
QA Rising
QA
Overtakes
OPS
OPS
Falling
Initial
Rollout
EXTENSIBILITY
6/12/201551
Additional Scenarios
• Framework originally design to handle migrations for
schema owned by each application
• Achieved additional ROI by managing additional
database deployment types with low effort
6/12/201552
Roles and Permissions
• An application that manages user roles and permissions
(RP) for all other applications
– Has rp-db project to manage its schema, of course
– But every consuming app (e.g. myapp) needs to manage the
particular roles and permissions known to it
– Reference data that lives in tables owned by another app
• myapp now has multiple db projects
– myapp-db to manage its schema
– myapp-rp-db to manage its RP reference data
– Both are deployed with new versions of myapp
6/12/201553
Roles and Permissions
• Minor addition of conditional logic
if (artifactName.endsWith('-rp-db')) {
// e.g. myapp-rp-db
// deploy to RP database
} else {
// e.g. myapp-db
// deploy to application's own database
}
• Easy to implement because … Gradle & Groovy
• Conceptual integrity of framework is maintained
6/12/201554
WRAP UP
6/12/201555
Observations
• Power of convention and consistency
– Once first schemas were automated, dominoes toppled quickly
• Power of flexible tools and building blocks
– Handle legacy complexities, special cases, acquisitions, strategy
changes, evolving business conditions
– New database project types fell easily into place
6/12/201556
Observations
• Know your tools
– Knowledge (how) has to propagate through the organization
– Ideally the underlying model (why)
• Schema changes no longer restrained by process
6/12/201557
“If it hurts, do it more often”
“If it’s easy, do it more often”
“If it hurts, do it more often”
 Reduced technical debt
Dirty Work …
• Database development and deployment processes are
often considered to be unexciting
• But sometimes you need to roll up your sleeves and do
the dirty work to realize a vision
• And relational databases are still the bedrock of most of
today’s information systems
6/12/201558
Dirty Work … Can Be Exciting!
• Efficient processes
• Reliable and extensible automation
• CONTINUOUS DELIVERY
6/12/201559
Full Stack Automated Self-Service Deployments
• Reduced workload of Operations team
• Safely empowered individual product teams
• Significantly reduced the DEV-to-TEST time delay
• Reinvested the recouped bandwidth
– More reliable & frequent software releases
– Additional high-value initiatives
6/12/201560
Resources
• Liquibase
http://www.liquibase.org
https://github.com/tlberglund/groovy-liquibase
https://github.com/tlberglund/gradle-liquibase-plugin
• Refactoring Databases: Evolutionary Database Design
Ambler and Sadalage (2006)
• Jenkins and Chef:
Infrastructure CI and Application Deployment
http://www.slideshare.net/dstine4/jenkins-and-chef-infrastructure-
ci-and-automated-deployment
https://www.youtube.com/watch?v=PQ6KTRgAeMU
6/12/201561
The word and design marks which appear in this
presentation are the trademarks of their respective
companies.
6/12/201562
Thank You:
Copyright Clearance Center Engineering Team
Gradle Summit Organizers

More Related Content

What's hot

HBase and HDFS: Understanding FileSystem Usage in HBase
HBase and HDFS: Understanding FileSystem Usage in HBaseHBase and HDFS: Understanding FileSystem Usage in HBase
HBase and HDFS: Understanding FileSystem Usage in HBaseenissoz
 
MySQL Shell - The Best MySQL DBA Tool
MySQL Shell - The Best MySQL DBA ToolMySQL Shell - The Best MySQL DBA Tool
MySQL Shell - The Best MySQL DBA ToolMiguel Araújo
 
MySQL HA with PaceMaker
MySQL HA with  PaceMakerMySQL HA with  PaceMaker
MySQL HA with PaceMakerKris Buytaert
 
MariaDB Galera Cluster
MariaDB Galera ClusterMariaDB Galera Cluster
MariaDB Galera ClusterAbdul Manaf
 
Managing (Schema) Migrations in Cassandra
Managing (Schema) Migrations in CassandraManaging (Schema) Migrations in Cassandra
Managing (Schema) Migrations in CassandraDataStax Academy
 
실무로 배우는 시스템 성능 최적화 8부 - 1,2,3장
실무로 배우는 시스템 성능 최적화 8부 - 1,2,3장실무로 배우는 시스템 성능 최적화 8부 - 1,2,3장
실무로 배우는 시스템 성능 최적화 8부 - 1,2,3장Sunggon Song
 
Maria DB Galera Cluster for High Availability
Maria DB Galera Cluster for High AvailabilityMaria DB Galera Cluster for High Availability
Maria DB Galera Cluster for High AvailabilityOSSCube
 
Upgrade from MySQL 5.7 to MySQL 8.0
Upgrade from MySQL 5.7 to MySQL 8.0Upgrade from MySQL 5.7 to MySQL 8.0
Upgrade from MySQL 5.7 to MySQL 8.0Olivier DASINI
 
MySQL with DRBD/Pacemaker/Corosync on Linux
 MySQL with DRBD/Pacemaker/Corosync on Linux MySQL with DRBD/Pacemaker/Corosync on Linux
MySQL with DRBD/Pacemaker/Corosync on LinuxPawan Kumar
 
nexus helm 설치, docker/helm repo 설정과 예제
nexus helm 설치, docker/helm repo 설정과 예제nexus helm 설치, docker/helm repo 설정과 예제
nexus helm 설치, docker/helm repo 설정과 예제choi sungwook
 
OSMC 2022 | Ignite: Observability with Grafana & Prometheus for Kafka on Kube...
OSMC 2022 | Ignite: Observability with Grafana & Prometheus for Kafka on Kube...OSMC 2022 | Ignite: Observability with Grafana & Prometheus for Kafka on Kube...
OSMC 2022 | Ignite: Observability with Grafana & Prometheus for Kafka on Kube...NETWAYS
 
MariaDB 10: The Complete Tutorial
MariaDB 10: The Complete TutorialMariaDB 10: The Complete Tutorial
MariaDB 10: The Complete TutorialColin Charles
 
Always on in sql server 2017
Always on in sql server 2017Always on in sql server 2017
Always on in sql server 2017Gianluca Hotz
 
Docker Containers Deep Dive
Docker Containers Deep DiveDocker Containers Deep Dive
Docker Containers Deep DiveWill Kinard
 
Installing Postgres on Linux
Installing Postgres on LinuxInstalling Postgres on Linux
Installing Postgres on LinuxEDB
 

What's hot (20)

HBase and HDFS: Understanding FileSystem Usage in HBase
HBase and HDFS: Understanding FileSystem Usage in HBaseHBase and HDFS: Understanding FileSystem Usage in HBase
HBase and HDFS: Understanding FileSystem Usage in HBase
 
MySQL Shell - The Best MySQL DBA Tool
MySQL Shell - The Best MySQL DBA ToolMySQL Shell - The Best MySQL DBA Tool
MySQL Shell - The Best MySQL DBA Tool
 
MySQL HA with PaceMaker
MySQL HA with  PaceMakerMySQL HA with  PaceMaker
MySQL HA with PaceMaker
 
MariaDB Galera Cluster
MariaDB Galera ClusterMariaDB Galera Cluster
MariaDB Galera Cluster
 
Spring Boot
Spring BootSpring Boot
Spring Boot
 
Managing (Schema) Migrations in Cassandra
Managing (Schema) Migrations in CassandraManaging (Schema) Migrations in Cassandra
Managing (Schema) Migrations in Cassandra
 
실무로 배우는 시스템 성능 최적화 8부 - 1,2,3장
실무로 배우는 시스템 성능 최적화 8부 - 1,2,3장실무로 배우는 시스템 성능 최적화 8부 - 1,2,3장
실무로 배우는 시스템 성능 최적화 8부 - 1,2,3장
 
Maria DB Galera Cluster for High Availability
Maria DB Galera Cluster for High AvailabilityMaria DB Galera Cluster for High Availability
Maria DB Galera Cluster for High Availability
 
Upgrade from MySQL 5.7 to MySQL 8.0
Upgrade from MySQL 5.7 to MySQL 8.0Upgrade from MySQL 5.7 to MySQL 8.0
Upgrade from MySQL 5.7 to MySQL 8.0
 
MySQL with DRBD/Pacemaker/Corosync on Linux
 MySQL with DRBD/Pacemaker/Corosync on Linux MySQL with DRBD/Pacemaker/Corosync on Linux
MySQL with DRBD/Pacemaker/Corosync on Linux
 
nexus helm 설치, docker/helm repo 설정과 예제
nexus helm 설치, docker/helm repo 설정과 예제nexus helm 설치, docker/helm repo 설정과 예제
nexus helm 설치, docker/helm repo 설정과 예제
 
Flyway
FlywayFlyway
Flyway
 
OSMC 2022 | Ignite: Observability with Grafana & Prometheus for Kafka on Kube...
OSMC 2022 | Ignite: Observability with Grafana & Prometheus for Kafka on Kube...OSMC 2022 | Ignite: Observability with Grafana & Prometheus for Kafka on Kube...
OSMC 2022 | Ignite: Observability with Grafana & Prometheus for Kafka on Kube...
 
MariaDB 10: The Complete Tutorial
MariaDB 10: The Complete TutorialMariaDB 10: The Complete Tutorial
MariaDB 10: The Complete Tutorial
 
Git real slides
Git real slidesGit real slides
Git real slides
 
Git hooks
Git hooksGit hooks
Git hooks
 
Always on in sql server 2017
Always on in sql server 2017Always on in sql server 2017
Always on in sql server 2017
 
Docker Containers Deep Dive
Docker Containers Deep DiveDocker Containers Deep Dive
Docker Containers Deep Dive
 
Installing Postgres on Linux
Installing Postgres on LinuxInstalling Postgres on Linux
Installing Postgres on Linux
 
Migrating Oracle to PostgreSQL
Migrating Oracle to PostgreSQLMigrating Oracle to PostgreSQL
Migrating Oracle to PostgreSQL
 

Viewers also liked

Database migrations with Flyway and Liquibase
Database migrations with Flyway and LiquibaseDatabase migrations with Flyway and Liquibase
Database migrations with Flyway and LiquibaseLars Östling
 
Javaland 2016 - Flyway vs. LiquiBase - Battle der Datenbankmigrationstools
Javaland 2016 - Flyway vs. LiquiBase - Battle der DatenbankmigrationstoolsJavaland 2016 - Flyway vs. LiquiBase - Battle der Datenbankmigrationstools
Javaland 2016 - Flyway vs. LiquiBase - Battle der DatenbankmigrationstoolsStephan Kaps
 
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
 
Flyway - database migrations made easy
Flyway - database migrations made easyFlyway - database migrations made easy
Flyway - database migrations made easyjstack
 
Getting started with agile database migrations for java flywaydb
Getting started with agile database migrations for java flywaydbGetting started with agile database migrations for java flywaydb
Getting started with agile database migrations for java flywaydbGirish Bapat
 
Agile Database Development with Liquibase
Agile Database Development with LiquibaseAgile Database Development with Liquibase
Agile Database Development with LiquibaseTim Berglund
 
GUI patterns : My understanding
GUI patterns : My understandingGUI patterns : My understanding
GUI patterns : My understandingNitin Bhide
 
Liquibase få kontroll på dina databasförändringar
Liquibase   få kontroll på dina databasförändringarLiquibase   få kontroll på dina databasförändringar
Liquibase få kontroll på dina databasförändringarSqueed
 
Intro to CI/CD using Docker
Intro to CI/CD using DockerIntro to CI/CD using Docker
Intro to CI/CD using DockerMichael Irwin
 
Pluggable Infrastructure with CI/CD and Docker
Pluggable Infrastructure with CI/CD and DockerPluggable Infrastructure with CI/CD and Docker
Pluggable Infrastructure with CI/CD and DockerBob Killen
 
Database migration with flyway
Database migration  with flywayDatabase migration  with flyway
Database migration with flywayJonathan Holloway
 
Gradle - time for a new build
Gradle - time for a new buildGradle - time for a new build
Gradle - time for a new buildIgor Khotin
 
Gradle build tool that rocks with DSL JavaOne India 4th May 2012
Gradle build tool that rocks with DSL JavaOne India 4th May 2012Gradle build tool that rocks with DSL JavaOne India 4th May 2012
Gradle build tool that rocks with DSL JavaOne India 4th May 2012Rajmahendra Hegde
 
Gradle - the Enterprise Automation Tool
Gradle  - the Enterprise Automation ToolGradle  - the Enterprise Automation Tool
Gradle - the Enterprise Automation ToolIzzet Mustafaiev
 
Continuous Integration with Jenkins and ANT
Continuous Integration with Jenkins and ANTContinuous Integration with Jenkins and ANT
Continuous Integration with Jenkins and ANTDavid Berliner
 
הודו - מצגת כנס עם הפנים לנמר - הקמת תשתיות בהודו - אמנון שחרור באוניברסיטת ת...
הודו - מצגת כנס עם הפנים לנמר - הקמת תשתיות בהודו - אמנון שחרור באוניברסיטת ת...הודו - מצגת כנס עם הפנים לנמר - הקמת תשתיות בהודו - אמנון שחרור באוניברסיטת ת...
הודו - מצגת כנס עם הפנים לנמר - הקמת תשתיות בהודו - אמנון שחרור באוניברסיטת ת...amnons
 
Guerilla marketing
Guerilla marketingGuerilla marketing
Guerilla marketingjayaram v
 
Daily Newsletter: 13th April, 2011
Daily Newsletter: 13th April, 2011Daily Newsletter: 13th April, 2011
Daily Newsletter: 13th April, 2011Fullerton Securities
 

Viewers also liked (20)

Database migrations with Flyway and Liquibase
Database migrations with Flyway and LiquibaseDatabase migrations with Flyway and Liquibase
Database migrations with Flyway and Liquibase
 
Javaland 2016 - Flyway vs. LiquiBase - Battle der Datenbankmigrationstools
Javaland 2016 - Flyway vs. LiquiBase - Battle der DatenbankmigrationstoolsJavaland 2016 - Flyway vs. LiquiBase - Battle der Datenbankmigrationstools
Javaland 2016 - Flyway vs. LiquiBase - Battle der Datenbankmigrationstools
 
Continuous DB Changes Delivery With Liquibase
Continuous DB Changes Delivery With LiquibaseContinuous DB Changes Delivery With Liquibase
Continuous DB Changes Delivery With Liquibase
 
Flyway - database migrations made easy
Flyway - database migrations made easyFlyway - database migrations made easy
Flyway - database migrations made easy
 
Getting started with agile database migrations for java flywaydb
Getting started with agile database migrations for java flywaydbGetting started with agile database migrations for java flywaydb
Getting started with agile database migrations for java flywaydb
 
Agile Database Development with Liquibase
Agile Database Development with LiquibaseAgile Database Development with Liquibase
Agile Database Development with Liquibase
 
GUI patterns : My understanding
GUI patterns : My understandingGUI patterns : My understanding
GUI patterns : My understanding
 
Liquibase få kontroll på dina databasförändringar
Liquibase   få kontroll på dina databasförändringarLiquibase   få kontroll på dina databasförändringar
Liquibase få kontroll på dina databasförändringar
 
Git,Travis,Gradle
Git,Travis,GradleGit,Travis,Gradle
Git,Travis,Gradle
 
Intro to CI/CD using Docker
Intro to CI/CD using DockerIntro to CI/CD using Docker
Intro to CI/CD using Docker
 
Pluggable Infrastructure with CI/CD and Docker
Pluggable Infrastructure with CI/CD and DockerPluggable Infrastructure with CI/CD and Docker
Pluggable Infrastructure with CI/CD and Docker
 
Database migration with flyway
Database migration  with flywayDatabase migration  with flyway
Database migration with flyway
 
Gradle - time for a new build
Gradle - time for a new buildGradle - time for a new build
Gradle - time for a new build
 
Gradle in 45min
Gradle in 45minGradle in 45min
Gradle in 45min
 
Gradle build tool that rocks with DSL JavaOne India 4th May 2012
Gradle build tool that rocks with DSL JavaOne India 4th May 2012Gradle build tool that rocks with DSL JavaOne India 4th May 2012
Gradle build tool that rocks with DSL JavaOne India 4th May 2012
 
Gradle - the Enterprise Automation Tool
Gradle  - the Enterprise Automation ToolGradle  - the Enterprise Automation Tool
Gradle - the Enterprise Automation Tool
 
Continuous Integration with Jenkins and ANT
Continuous Integration with Jenkins and ANTContinuous Integration with Jenkins and ANT
Continuous Integration with Jenkins and ANT
 
הודו - מצגת כנס עם הפנים לנמר - הקמת תשתיות בהודו - אמנון שחרור באוניברסיטת ת...
הודו - מצגת כנס עם הפנים לנמר - הקמת תשתיות בהודו - אמנון שחרור באוניברסיטת ת...הודו - מצגת כנס עם הפנים לנמר - הקמת תשתיות בהודו - אמנון שחרור באוניברסיטת ת...
הודו - מצגת כנס עם הפנים לנמר - הקמת תשתיות בהודו - אמנון שחרור באוניברסיטת ת...
 
Guerilla marketing
Guerilla marketingGuerilla marketing
Guerilla marketing
 
Daily Newsletter: 13th April, 2011
Daily Newsletter: 13th April, 2011Daily Newsletter: 13th April, 2011
Daily Newsletter: 13th April, 2011
 

Similar to Database Migrations with Gradle and Liquibase

Evolutionary database design
Evolutionary database designEvolutionary database design
Evolutionary database designSalehein Syed
 
Bringing DevOps to the Database
Bringing DevOps to the DatabaseBringing DevOps to the Database
Bringing DevOps to the DatabaseMichaela Murray
 
Meetup developing building and_deploying databases with SSDT
Meetup developing building and_deploying databases with SSDTMeetup developing building and_deploying databases with SSDT
Meetup developing building and_deploying databases with SSDTSolidify
 
Database CI Demo Using Sql Server
Database CI  Demo Using Sql ServerDatabase CI  Demo Using Sql Server
Database CI Demo Using Sql ServerUmesh Kumar
 
DWX 2023 - Datenbank-Schema Deployment im Kubernetes Release
DWX 2023 - Datenbank-Schema Deployment im Kubernetes ReleaseDWX 2023 - Datenbank-Schema Deployment im Kubernetes Release
DWX 2023 - Datenbank-Schema Deployment im Kubernetes ReleaseMarc Müller
 
MIGRATION - PAIN OR GAIN?
MIGRATION - PAIN OR GAIN?MIGRATION - PAIN OR GAIN?
MIGRATION - PAIN OR GAIN?DrupalCamp Kyiv
 
DesignMind SQL Server 2008 Migration
DesignMind SQL Server 2008 MigrationDesignMind SQL Server 2008 Migration
DesignMind SQL Server 2008 MigrationMark Ginnebaugh
 
Agile Oracle to PostgreSQL migrations (PGConf.EU 2013)
Agile Oracle to PostgreSQL migrations (PGConf.EU 2013)Agile Oracle to PostgreSQL migrations (PGConf.EU 2013)
Agile Oracle to PostgreSQL migrations (PGConf.EU 2013)Gabriele Bartolini
 
Taking your site from Drupal 6 to Drupal 7
Taking your site from Drupal 6 to Drupal 7Taking your site from Drupal 6 to Drupal 7
Taking your site from Drupal 6 to Drupal 7Phase2
 
SQL Server 2019 CTP2.4
SQL Server 2019 CTP2.4SQL Server 2019 CTP2.4
SQL Server 2019 CTP2.4Gianluca Hotz
 
FlexDeploy Product Technical Overview
FlexDeploy Product Technical OverviewFlexDeploy Product Technical Overview
FlexDeploy Product Technical OverviewDalibor Blazevic
 
Presto Strata Hadoop SJ 2016 short talk
Presto Strata Hadoop SJ 2016 short talkPresto Strata Hadoop SJ 2016 short talk
Presto Strata Hadoop SJ 2016 short talkkbajda
 
Staging Drupal 8 31 09 1 3
Staging Drupal 8 31 09 1 3Staging Drupal 8 31 09 1 3
Staging Drupal 8 31 09 1 3Drupalcon Paris
 
OUG Ireland Meet-up 12th January
OUG Ireland Meet-up 12th JanuaryOUG Ireland Meet-up 12th January
OUG Ireland Meet-up 12th JanuaryBrendan Tierney
 
Expert guidance on migrating from magento 1 to magento 2
Expert guidance on migrating from magento 1 to magento 2Expert guidance on migrating from magento 1 to magento 2
Expert guidance on migrating from magento 1 to magento 2James Cowie
 
PostgreSQL as a Strategic Tool
PostgreSQL as a Strategic ToolPostgreSQL as a Strategic Tool
PostgreSQL as a Strategic ToolEDB
 
CTS2 Development Framework
CTS2 Development FrameworkCTS2 Development Framework
CTS2 Development Frameworkcts2framework
 
GraalVM and Oracle's Documentation Trends.pdf
GraalVM and Oracle's Documentation Trends.pdfGraalVM and Oracle's Documentation Trends.pdf
GraalVM and Oracle's Documentation Trends.pdfohupalo
 
Developing Kafka Streams Applications with Upgradability in Mind with Neil Bu...
Developing Kafka Streams Applications with Upgradability in Mind with Neil Bu...Developing Kafka Streams Applications with Upgradability in Mind with Neil Bu...
Developing Kafka Streams Applications with Upgradability in Mind with Neil Bu...HostedbyConfluent
 
01 upgrade to my sql8
01 upgrade to my sql8 01 upgrade to my sql8
01 upgrade to my sql8 Ted Wennmark
 

Similar to Database Migrations with Gradle and Liquibase (20)

Evolutionary database design
Evolutionary database designEvolutionary database design
Evolutionary database design
 
Bringing DevOps to the Database
Bringing DevOps to the DatabaseBringing DevOps to the Database
Bringing DevOps to the Database
 
Meetup developing building and_deploying databases with SSDT
Meetup developing building and_deploying databases with SSDTMeetup developing building and_deploying databases with SSDT
Meetup developing building and_deploying databases with SSDT
 
Database CI Demo Using Sql Server
Database CI  Demo Using Sql ServerDatabase CI  Demo Using Sql Server
Database CI Demo Using Sql Server
 
DWX 2023 - Datenbank-Schema Deployment im Kubernetes Release
DWX 2023 - Datenbank-Schema Deployment im Kubernetes ReleaseDWX 2023 - Datenbank-Schema Deployment im Kubernetes Release
DWX 2023 - Datenbank-Schema Deployment im Kubernetes Release
 
MIGRATION - PAIN OR GAIN?
MIGRATION - PAIN OR GAIN?MIGRATION - PAIN OR GAIN?
MIGRATION - PAIN OR GAIN?
 
DesignMind SQL Server 2008 Migration
DesignMind SQL Server 2008 MigrationDesignMind SQL Server 2008 Migration
DesignMind SQL Server 2008 Migration
 
Agile Oracle to PostgreSQL migrations (PGConf.EU 2013)
Agile Oracle to PostgreSQL migrations (PGConf.EU 2013)Agile Oracle to PostgreSQL migrations (PGConf.EU 2013)
Agile Oracle to PostgreSQL migrations (PGConf.EU 2013)
 
Taking your site from Drupal 6 to Drupal 7
Taking your site from Drupal 6 to Drupal 7Taking your site from Drupal 6 to Drupal 7
Taking your site from Drupal 6 to Drupal 7
 
SQL Server 2019 CTP2.4
SQL Server 2019 CTP2.4SQL Server 2019 CTP2.4
SQL Server 2019 CTP2.4
 
FlexDeploy Product Technical Overview
FlexDeploy Product Technical OverviewFlexDeploy Product Technical Overview
FlexDeploy Product Technical Overview
 
Presto Strata Hadoop SJ 2016 short talk
Presto Strata Hadoop SJ 2016 short talkPresto Strata Hadoop SJ 2016 short talk
Presto Strata Hadoop SJ 2016 short talk
 
Staging Drupal 8 31 09 1 3
Staging Drupal 8 31 09 1 3Staging Drupal 8 31 09 1 3
Staging Drupal 8 31 09 1 3
 
OUG Ireland Meet-up 12th January
OUG Ireland Meet-up 12th JanuaryOUG Ireland Meet-up 12th January
OUG Ireland Meet-up 12th January
 
Expert guidance on migrating from magento 1 to magento 2
Expert guidance on migrating from magento 1 to magento 2Expert guidance on migrating from magento 1 to magento 2
Expert guidance on migrating from magento 1 to magento 2
 
PostgreSQL as a Strategic Tool
PostgreSQL as a Strategic ToolPostgreSQL as a Strategic Tool
PostgreSQL as a Strategic Tool
 
CTS2 Development Framework
CTS2 Development FrameworkCTS2 Development Framework
CTS2 Development Framework
 
GraalVM and Oracle's Documentation Trends.pdf
GraalVM and Oracle's Documentation Trends.pdfGraalVM and Oracle's Documentation Trends.pdf
GraalVM and Oracle's Documentation Trends.pdf
 
Developing Kafka Streams Applications with Upgradability in Mind with Neil Bu...
Developing Kafka Streams Applications with Upgradability in Mind with Neil Bu...Developing Kafka Streams Applications with Upgradability in Mind with Neil Bu...
Developing Kafka Streams Applications with Upgradability in Mind with Neil Bu...
 
01 upgrade to my sql8
01 upgrade to my sql8 01 upgrade to my sql8
01 upgrade to my sql8
 

Recently uploaded

Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesŁukasz Chruściel
 
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
 
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
 
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
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Developmentvyaparkranti
 
Software Coding for software engineering
Software Coding for software engineeringSoftware Coding for software engineering
Software Coding for software engineeringssuserb3a23b
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作qr0udbr0
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...confluent
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalLionel Briand
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprisepreethippts
 
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfExploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfkalichargn70th171
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...OnePlan Solutions
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Natan Silnitsky
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
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
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...Technogeeks
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfFerryKemperman
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Hr365.us smith
 

Recently uploaded (20)

Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New Features
 
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
 
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
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Development
 
Software Coding for software engineering
Software Coding for software engineeringSoftware Coding for software engineering
Software Coding for software engineering
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive Goal
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprise
 
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfExploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
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...
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdf
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)
 

Database Migrations with Gradle and Liquibase

  • 1. Database Migrations with Gradle and Liquibase Dan Stine Copyright Clearance Center www.copyright.com Gradle Summit June 12, 2015
  • 2. About Me • Software Architect • Library & Framework Developer • Platform Engineering Lead & Product Owner • Gradle User Since 2011 • Enemy of Inefficiency & Needless Inconsistency dstine at copyright.com sw at stinemail.com github.com/dstine 6/12/20152
  • 3. About Copyright Clearance Center • Global licensing solutions that make © work for everyone – Get, share and manage content – Rights broker for the world’s most sought-after materials – Global company (US, Europe, Asia) – HQ in Danvers, MA • Industry-specific software systems – Internal and external user base – Applications, services, databases – Organic growth over many years • In 2011, CCC adopted a Product Platform strategy for growing its software portfolio 6/12/20153
  • 4. Agenda • Context • Liquibase • Development Process • Deploy Time • Extensibility • Wrap Up 6/12/20154
  • 6. Database Migrations • Database structure changes – Tables, constraints, indexes, etc. – Schema changes (DDL, not DML) • Reference data – List of countries, user types, order status, etc. – Set of allowed values • Database logic – Functions, procedures, triggers – (Very little of this) 6/12/20156
  • 7. Our Historical Approach • DB migrations handled in relatively ad-hoc fashion • Various flavors of “standard” practice – Framework copied and modified from project to project – Framework not always used (“small” projects) • Development teams shared a DEV database – Conflicts between code and database 6/12/20157
  • 8. Development Pain Points • Intra-team collaboration was difficult • Forced synchronous updates within development team • Learn variations when switching between projects • Project startup was costly 6/12/20158
  • 9. Deployment Pain Points • Manual process – Where are the scripts for this app? – Which scripts should be run and how? • Recurring difficulties – Hours spent resolving mismatches between app and database – Testing activities frequently delayed or even restarted • Impossible to automate – Too many variations • Self-service deployment was a pipe dream 6/12/20159
  • 10. Standard Software Platform • Started platform definition in 2011 – Homogenous by default • Tools – Java, Spring, Tomcat, Postgres – Git / GitHub, Gradle, Jenkins, Artifactory, Liquibase, Chef • Process – Standard development workflow – Standard application shape & operational profile 6/12/201510
  • 11. Vision for Database Script Management • Integrated into developer workflow • Feeds cleanly into deployment workflow • Developer commits scripts and the process takes over – Just like with application code 6/12/201511
  • 12. A Plan For Pain Relief • Manage scripts as first-class citizens – Same repo as application code – Standard location in source tree • Standard execution engine – No more variations – Automatic tracking of applied migrations • Prevent conflicts and mismatches – Introduce developer workstation databases (LOCAL ) – Dedicated sandbox – Commit database and associated application change together 6/12/201512
  • 13. A Plan For Pain Relief • Liquibase – Database described as code – Execution engine & migration tracking • Gradle – Provide conventions – Tasks for invoking Liquibase – Already familiar to developers from existing build process – Flexibility to integrate into deployment process – Flexibility to handle emergent requirements 6/12/201513
  • 15. Liquibase Basics • Provides vocabulary of database changes – Create Table, Add PK, Add FK, Add Column, Add Index, … – Drop Table, Drop PK, Drop FK, Drop Column, Drop Index, … – Insert, Update, Delete, … • Changes are grouped into changesets – Change(s) that should be applied atomically • Changesets are grouped into changelogs – Files managed in version control 6/12/201515
  • 16. Liquibase Basics • Changesets uniquely identified by [Author, ID, File] – Liquibase tracks changeset execution in a special table – Lock table to prevent concurrent Liquibase invocations – Modified changesets are detected via checksums • Supported databases – MySQL, PostgreSQL, Oracle, SQL Server, … • Groovy DSL – Liquibase v2 supported only XML – https://github.com/tlberglund/groovy-liquibase 6/12/201516
  • 17. Example Changeset changeSet(id: '2015-01-23', author: 'John Doe <jdoe@copyright.com>') { createTable(schemaName: 'apps', tableName: 'myapp_version', tablespace: 'ccc_data') { column(name: 'version_uid', type: 'VARCHAR(128)') column(name: 'type', type: 'VARCHAR(10)') column(name: 'owner_uid', type: 'VARCHAR(128)') column(name: 'version', type: 'VARCHAR(20)') column(name: 'start_date', type: 'TIMESTAMPTZ') column(name: 'end_date', type: 'TIMESTAMPTZ') } addPrimaryKey(constraintName: 'PK_myapp_version', schemaName: 'apps', tableName: 'myapp_version', tablespace: 'ccc_index', columnNames: 'version_uid') addForeignKeyConstraint(constraintName: 'FK_myapp_version_2_owner', baseTableSchemaName: 'apps', baseTableName: 'myapp_version', baseColumnNames: 'owner_uid', referencedTableSchemaName: 'apps', referencedTableName: 'myapp_owner', referencedColumnNames: 'owner_uid') } 6/12/201517
  • 18. Liquibase @ CCC • Learning curve – Team needs to understand the underlying model – Don’t edit changesets once they’ve been applied • Our standards – Schema name and tablespace are required – Parameterize schema name and tablespace createTable( schemaName: dbAppsSchema, tableName: 'myapp_version', tablespace: dbDataTablespace) 6/12/201518
  • 20. Development Workflow • Gradle is our SCM hub – Workstation builds – LOCAL app servers via command line – IDE integration – CI and release builds on Jenkins • Maintain Gradle-centric workflow – Integrated database development 6/12/201520
  • 21. Standard Project Structure • Single Git repo with multi-project Gradle build myapp myapp-db myapp-rest myapp-service myapp-ui group = com.copyright.myapp • UI and REST service published as WARs • DB published as JAR 6/12/201521
  • 22. Custom Gradle Plugin • Created custom plugin: ccc-postgres • Standard script location – Main source set: src/main/liquibase – Package: com.copyright.myapp.db • Standard versions – Liquibase itself – Postgres JDBC driver 6/12/201522
  • 23. Plugin Extension • Custom DSL via Gradle extension cccPostgres { mainChangelog = 'com/copyright/myapp/db/main.groovy' } • Main changelog includes other changelogs 6/12/201523
  • 24. Development Lifecycle Tasks • Provided by ccc-postgres • Easy to manage LOCAL development database – Isolated from other developers and deployments – Pull in new schema changes  run a task • Built on Gradle Liquibase plugin https://github.com/tlberglund/gradle-liquibase-plugin 6/12/201524
  • 26. Development Lifecycle Tasks • Typical developer loop – gradlew update – gradlew tomcatRun and/or IDE • Not just for product development teams – Simple to run any app – Architects, QA, Platform Engineering 6/12/201526
  • 27. Development Lifecycle Tasks Task Runs As Description createDatabase postgres Creates ccc user and database Creates data and index tablespaces createSchema ccc Creates apps schema update ccc Runs main changelog dropDatabase postgres Drops ccc user and database resetBaseChangelog postgres Truncates postgres.public.databasechangelog 6/12/201527 • resetBaseChangelog – Must clear all traces of Liquibase to start over
  • 28. Plugin Configuration • Override default library versions cccPostgres.standardDependencies.postgresDriver • Defaults point to LOCAL development database – Can override property values dbHost, dbPort, dbName dbUsername, dbPassword dbDataTablespace, dbIndexTablespace dbBaseUsername, dbBasePassword 6/12/201528
  • 29. Standardization and Compliance • So all our teams are authoring DB code • But Liquibase is new to many • And we have company standards • Let’s automate! 6/12/201529
  • 30. Static Analysis • CodeNarc – Static analysis of Groovy code – Allows custom rule sets • Created a set of custom CodeNarc rules – Analyze our Liquibase Groovy DSL changelogs • Apply to our db projects via the Gradle codenarc plugin – Fail build if violations are found 6/12/201530
  • 31. Static Analysis – Required Attributes • Our rule categorizes all change attributes – Required by Liquibase • createTable requires tableName – Required by CCC • createTable requires schemaName and tablespace – Optional • Unintended positive consequence! – Catches typos that otherwise would not be detected until farther downstream – constrainttName or tablspace 6/12/201531
  • 32. Static Analysis – Required Parameterization • Ensure that schemaName & tablespace are parameterized for future flexibility @Override void visitMapExpression(MapExpression mapExpression) { mapExpression.mapEntryExpressions .findAll { it.keyExpression instanceof ConstantExpression } .findAll { ['schemaName', 'tablespace'] .contains(it.keyExpression.value) } .findAll { it.valueExpression instanceof ConstantExpression } .each { addViolation(it, "${it.keyExpression.value} should not be hard-coded") } super.visitMapExpression(mapExpression) } 6/12/201532
  • 33. Schema Spy • Generates visual representation of database structure – Requires running database instance – Requires GraphViz installation • Custom task runSchemaSpy – By default, points at LOCAL database 6/12/201533
  • 34. Continuous Integration for DB Scripts • Compile Groovy – Catches basic syntax errors • CodeNarc analysis – Catches policy and DSL violations • Integration tests – Apply Liquibase scripts to H2 in-memory database – Catches additional classes of error 6/12/201534
  • 35. Release Build • Publish JAR – Liquibase Groovy scripts from src/main/liquibase • META-INF/MANIFEST.MF contains entry point Name: ccc-postgres MainChangelog: com/copyright/myapp/db/main.groovy 6/12/201535
  • 37. Deployment Automation • Early efforts focused on applications themselves – Jenkins orchestrating Chef runs – Initial transition from prose instructions to Infrastructure as Code • Database deployments remained manual – Better than ad-hoc approach – But still error prone and time-consuming 6/12/201537
  • 38. Automated Application Deployments • Chef environment file – Cookbook versions: which instructions are used • Chef data bags – Configuration values for each environment – Encrypted data bags for (e.g.) database credentials • Jenkins deploy jobs (a.k.a “the button”) – Parameters = environment, application version 6/12/201538
  • 40. Initial Delivery Pipeline (DB Deployments) • Clone Git repo and checkout tag • Manually configure & run Gradle task from ccc-postgres gradlew update -PdbHost=testdb.copyright.com -PdbPort=5432 -PdbDatabase=ccc -PdbUsername=ccc -PdbPassword=****** • Many apps x many versions x multiple environments = TIME & EFFORT & ERROR 6/12/201540
  • 42. Target Delivery Pipeline • Automated process should also update database – Single Jenkins job for both apps and database scripts • Maintain data-driven design – Environment file lists database artifacts – Controlled flow down the pipeline • Gradle database deployment task – Retrieve scripts from Artifactory – Harvest information already in Chef data bags (URL, password) – Execute Liquibase 6/12/201542
  • 44. Jenkins Deploy Job • One job per application group, per set of deployers – E.g. myapp.qa allows QA to deploy to environments they own – Typically contains multiple deployables (apps, db artifacts) – Typical deployer sets = DEV, QA, OPS • Executes Liquibase via Gradle for database deployments – Invokes deployDbArtifact task for each db artifact • (Executes Chef for application deployments) 6/12/201544
  • 45. Gradle deployDbArtifact Task • Parameterized via Gradle project properties – appGroup = myapp – artifactName = myapp-db – artifactVersion = 2.1.12 – environment = TEST • Downloads JAR from Artifactory – com.copyright.myapp:myapp-db:2.1.12 – Extract MainChangelog value from manifest 6/12/201545
  • 46. Gradle deployDbArtifact Task • Retrieves DB URL from Chef data bag item for TEST "myapp.db.url": "jdbc:postgresql://testdb:5432/ccc" • Retrieves password from encrypted Chef data bag – myapp.db.password • Executes Liquibase 6/12/201546
  • 47. Data Bag Access • Built on top of Chef Java bindings from jclouds • No support for encrypted data bags • Java Cryptography Extensions and the following libs: compile 'org.apache.jclouds.api:chef:1.7.2' compile 'org.apache.jclouds.provider:enterprisechef:1.7.2' compile 'commons-codec:commons-codec:1.9' 6/12/201547
  • 50. Automated Deployments By Role 6/12/201550 QA Rising QA Overtakes OPS OPS Falling Initial Rollout
  • 52. Additional Scenarios • Framework originally design to handle migrations for schema owned by each application • Achieved additional ROI by managing additional database deployment types with low effort 6/12/201552
  • 53. Roles and Permissions • An application that manages user roles and permissions (RP) for all other applications – Has rp-db project to manage its schema, of course – But every consuming app (e.g. myapp) needs to manage the particular roles and permissions known to it – Reference data that lives in tables owned by another app • myapp now has multiple db projects – myapp-db to manage its schema – myapp-rp-db to manage its RP reference data – Both are deployed with new versions of myapp 6/12/201553
  • 54. Roles and Permissions • Minor addition of conditional logic if (artifactName.endsWith('-rp-db')) { // e.g. myapp-rp-db // deploy to RP database } else { // e.g. myapp-db // deploy to application's own database } • Easy to implement because … Gradle & Groovy • Conceptual integrity of framework is maintained 6/12/201554
  • 56. Observations • Power of convention and consistency – Once first schemas were automated, dominoes toppled quickly • Power of flexible tools and building blocks – Handle legacy complexities, special cases, acquisitions, strategy changes, evolving business conditions – New database project types fell easily into place 6/12/201556
  • 57. Observations • Know your tools – Knowledge (how) has to propagate through the organization – Ideally the underlying model (why) • Schema changes no longer restrained by process 6/12/201557 “If it hurts, do it more often” “If it’s easy, do it more often” “If it hurts, do it more often”  Reduced technical debt
  • 58. Dirty Work … • Database development and deployment processes are often considered to be unexciting • But sometimes you need to roll up your sleeves and do the dirty work to realize a vision • And relational databases are still the bedrock of most of today’s information systems 6/12/201558
  • 59. Dirty Work … Can Be Exciting! • Efficient processes • Reliable and extensible automation • CONTINUOUS DELIVERY 6/12/201559
  • 60. Full Stack Automated Self-Service Deployments • Reduced workload of Operations team • Safely empowered individual product teams • Significantly reduced the DEV-to-TEST time delay • Reinvested the recouped bandwidth – More reliable & frequent software releases – Additional high-value initiatives 6/12/201560
  • 61. Resources • Liquibase http://www.liquibase.org https://github.com/tlberglund/groovy-liquibase https://github.com/tlberglund/gradle-liquibase-plugin • Refactoring Databases: Evolutionary Database Design Ambler and Sadalage (2006) • Jenkins and Chef: Infrastructure CI and Application Deployment http://www.slideshare.net/dstine4/jenkins-and-chef-infrastructure- ci-and-automated-deployment https://www.youtube.com/watch?v=PQ6KTRgAeMU 6/12/201561
  • 62. The word and design marks which appear in this presentation are the trademarks of their respective companies. 6/12/201562
  • 63. Thank You: Copyright Clearance Center Engineering Team Gradle Summit Organizers

Editor's Notes

  1. Execute via shell or batch script, copy/paste, etc. Prohibitive time / effort / cost to automate
  2. Exceptions are possible but should be rare Just a sampling of tools, there are others
  3. No longer need to build our own migrations framework Liquibase, Flyway, etc.
  4. Changes also called “refactorings” – Refactoring Databases book by Ambler and Sadalage Example grouping – splitting a column, or a higher level refactoring
  5. Analogy: don’t modify Git commits once they’ve been “published”
  6. As someone who works in central role, the ability to checkout any project and run it via the Tomcat plugin is simply brilliant BUT I need the database, too!
  7. Simplified example – most projects have additional subprojects for layering purposes and so on
  8. Much farther downstream
  9. Cannot be generated at build time without spinning up Postgres, but there is no way to run embedded Postgres
  10. Data-driven!
  11. DBA’s would copy/paste from text file
  12. Taking advantage of ability to write arbitrary logic in Groovy
  13. Same-day turnaround for test environments
  14. Reap additional dividends on our carefully generalized design
  15. Same in all environments – especially for database scripts! Balance the internal and external pressure against design considerations – just like any software development effort
  16. Don’t edit changesets! And not just basic usage – form a mental model We‘ve all heard “if it hurts, do it more often”. Once you’ve done that, next step is “it’s easy so do it more often!”
  17. Single-page web apps, distributed systems
  18. To an ever-growing number of people, teams, companies, and industries
  19. QA team can control the environments they own in the first place!