SlideShare una empresa de Scribd logo
1 de 75
DATABASE
                  REFACTORING WITH


    Tim Berglund
    March, 2009
Monday, March 16, 2009
YOU HAVE A
                    DATABASE IN YOUR
                          LIFE


Monday, March 16, 2009
YOUR DATABASE
                          HAS A FUTURE


Monday, March 16, 2009
CAN IT ADAPT?




Monday, March 16, 2009
HAS IT BEEN
            EMBALMED?
Monday, March 16, 2009
Monday, March 16, 2009
WON’T DIE




Monday, March 16, 2009
NOT REALLY ALIVE




Monday, March 16, 2009
CURSES THE DBA
                         WHO CHANGES IT


Monday, March 16, 2009
WE WILL
           BREAK
                         THE
                   CURSE



Monday, March 16, 2009
EVOLUTIONARY
                           DATABASE
                         DEVELOPMENT


Monday, March 16, 2009
EVOLUTIONARY
                DATABASE DEVELOPMENT




Monday, March 16, 2009
EVOLUTIONARY
                DATABASE DEVELOPMENT
                         REFACTORING




Monday, March 16, 2009
EVOLUTIONARY
                DATABASE DEVELOPMENT
                             REFACTORING
                     EVOLUTIONARY DATA MODELING




Monday, March 16, 2009
EVOLUTIONARY
                DATABASE DEVELOPMENT
                             REFACTORING
                     EVOLUTIONARY DATA MODELING
                          AUTOMATED TESTS




Monday, March 16, 2009
EVOLUTIONARY
                DATABASE DEVELOPMENT
                             REFACTORING
                     EVOLUTIONARY DATA MODELING
                          AUTOMATED TESTS
                          SOURCE CONTROL



Monday, March 16, 2009
EVOLUTIONARY
                DATABASE DEVELOPMENT
                             REFACTORING
                     EVOLUTIONARY DATA MODELING
                          AUTOMATED TESTS
                          SOURCE CONTROL
                              SANDBOXES

Monday, March 16, 2009
REFACTORING




Monday, March 16, 2009
REFACTORING




Monday, March 16, 2009
REFACTORING
                A disciplined way to
             make small changes to your
             source code to improve its
              design, making it easier to
                      work with.




Monday, March 16, 2009
REFACTORING

                         Not adding
                          features!




Monday, March 16, 2009
REFACTORING

                Not fixing bugs!




Monday, March 16, 2009
REFACTORING
                  Opportunistically
                 improving design to
                   accommodate
                      change.




Monday, March 16, 2009
DATABASE REFACTORING


              A simple change to a
        database schema that improves
       its design while retaining both its
          behavioral and informational
                   semantics.




Monday, March 16, 2009
EVOLUTIONARY
                         DATA MODELING




Monday, March 16, 2009
EVOLUTIONARY
                         DATA MODELING

               NOT TRYING TO “GET IT RIGHT UP
                             FRONT.”




Monday, March 16, 2009
EVOLUTIONARY
                         DATA MODELING

                    MAYBE SOME BIG THOUGHTS AT
                              FIRST




Monday, March 16, 2009
EVOLUTIONARY
                         DATA MODELING

                   BUILD THE SIMPLEST THING THAT
                  CAN POSSIBLY WORK...EVERY DAY




Monday, March 16, 2009
DATABASE TESTS


                           TDD IN THE DB



Monday, March 16, 2009
DATABASE TESTS




Monday, March 16, 2009
DATABASE TESTS

                          STORED PROCEDURES




Monday, March 16, 2009
DATABASE TESTS

                          STORED PROCEDURES
                              SQLUNIT




Monday, March 16, 2009
DATABASE TESTS

                          STORED PROCEDURES
                              SQLUNIT
                               DBUNIT



Monday, March 16, 2009
DATABASE TESTS

                          STORED PROCEDURES
                              SQLUNIT
                               DBUNIT
                           CUSTOM HYBRIDS

Monday, March 16, 2009
SOURCE CONTROL




Monday, March 16, 2009
SOURCE CONTROL




                         LIKE MOTHER TAUGHT YOU
Monday, March 16, 2009
SOURCE CONTROL




Monday, March 16, 2009
SOURCE CONTROL

                                   DDL
                         EXTRACT/MIGRATION SCRIPTS
                              REFERENCE DATA
                          STORED PROCS/TRIGGERS

Monday, March 16, 2009
SANDBOXES
Monday, March 16, 2009
Monday, March 16, 2009
Monday, March 16, 2009
CHANGELOG




Monday, March 16, 2009
CHANGELOG
                         COMMANDS



Monday, March 16, 2009
CHANGELOG
                             COMMANDS
                         MIGRATION SCENARIOS


Monday, March 16, 2009
CHANGELOG




Monday, March 16, 2009
CHANGELOG

                          SQL IN XML




Monday, March 16, 2009
CHANGELOG

                              SQL IN XML
                         ONE OPERATION AT A TIME



Monday, March 16, 2009
CHANGELOG

                              SQL IN XML
                         ONE OPERATION AT A TIME
                          TRACKED IN DATABASE


Monday, March 16, 2009
CHANGELOG
         	      <changeSet author=quot;tlberglund (generated)quot; id=quot;1236660747556-11quot;>
         	      	   <createTable tableName=quot;scshoppingcartquot;>
         	      	   	   <column autoIncrement=quot;truequot; name=quot;idquot; type=quot;INTquot;>
         	      	   	   	    <constraints nullable=quot;falsequot;/>
         	      	   	   </column>
         	      	   	   <column name=quot;useridquot; type=quot;INTquot;>
         	      	   	   	    <constraints nullable=quot;falsequot;/>
         	      	   	   </column>
         	      	   	   <column name=quot;lastmodifiedquot; type=quot;DATETIMEquot;/>
         	      	   	   <column name=quot;namequot; type=quot;VARCHAR(50)quot;/>
         	      	   </createTable>
         	      </changeSet>

         	      <changeSet author=quot;tlberglundquot; id=quot;spot-1-1-2quot;>
         	      	   <renameTable oldTableName=quot;scscrubrecordwarehousequot;
                                 newTableName=quot;scrub_record_logquot; />
         	      </changeSet>




Monday, March 16, 2009
LIQUIBASE
                         COMMANDS




Monday, March 16, 2009
LIQUIBASE
                         COMMANDS


                   generateChangeLog


Monday, March 16, 2009
LIQUIBASE
                          COMMANDS


                         changeLogSync


Monday, March 16, 2009
LIQUIBASE
                         COMMANDS


                          update


Monday, March 16, 2009
LIQUIBASE
                         COMMANDS


                            tag


Monday, March 16, 2009
LIQUIBASE
                         COMMANDS


                          rollback


Monday, March 16, 2009
LIQUIBASE
                         COMMANDS


                            diff


Monday, March 16, 2009
DEMO



Monday, March 16, 2009
AND WE’RE BACK



Monday, March 16, 2009
CULTIVATING THE
                          BROWNFIELD




Monday, March 16, 2009
LEGACY ENTERPRISE
                       APP




Monday, March 16, 2009
NEW GRAILS
                          HOTNESS




Monday, March 16, 2009
HARD CUTOVER
Monday, March 16, 2009
CREATIVE ORM
                           MAPPINGS
Monday, March 16, 2009
WITHERING ON THE
             VINE




Monday, March 16, 2009
BROWNFIELD DATA
                      INTEGRATION




Monday, March 16, 2009
BROWNFIELD DATA
                      INTEGRATION
                         TIME ZERO MIGRATION




Monday, March 16, 2009
BROWNFIELD DATA
                      INTEGRATION
                         TIME ZERO MIGRATION




Monday, March 16, 2009
BROWNFIELD
                           TESTING




Monday, March 16, 2009
BROWNFIELD
                            TESTING


                         INTEGRATION TEST DATA



Monday, March 16, 2009
BROWNFIELD
                           TESTING




Monday, March 16, 2009
BROWNFIELD
                           TESTING


                         T0 MIGRATION SCRIPTS



Monday, March 16, 2009
BROWNFIELD
                           TESTING




Monday, March 16, 2009
THE
            CURSE IS
            BROKEN



Monday, March 16, 2009
THANK YOU!

                         TIM BERGLUND
                         AUGUST TECHNOLOGY GROUP, LLC
                         http://www.augusttechgroup.com
                         tim.berglund@augusttechgroup.com
                         @tlberglund




Monday, March 16, 2009
PHOTO CREDITS
               DODO: HTTP://WWW.INTERNATIONALDOVESOCIETY.COM/MISCSPECIES/DODO.HTM
               EMBALMING: HTTP://LIBRARY.THINKQUEST.ORG/C0116982/HTML%20PAGE%20FOLDER/
               HMUMMIFICATION.HTM
               ATTACKING MUMMY: HTTP://WWW.FLICKR.COM/PHOTOS/ROONBABOON/292393932/
               CREEPY MUMMY HEAD: HTTP://WWW.FLICKR.COM/PHOTOS/DR-INI/446311713/
               MARTIN FOWLER: HTTP://WWW.FLICKR.COM/PHOTOS/PRAGDAVE/173640462/
               SCOTT AMBLER: HTTP://WWW.AMBYSOFT.COM/SCOTTAMBLER.HTML
               BRENDEN FRASER: HTTP://SCRAPETV.COM/NEWS/NEWS%20PAGES/ENTERTAINMENT/UNIVERSAL-FIRE-
               ACCIDENTAL-NEW-MUMMY-MOVIE-DELIBERATE-SCRAPE-TV-THE-WORLD-ON-YOUR-SIDE.HTML
               SAND: HTTP://WWW.FLICKR.COM/PHOTOS/LEVIATHOR/207625319/
               MOTHER AND CHILD: HTTP://WWW.FLICKR.COM/PHOTOS/PATRICK_Q/268149208/
               BROWN FIELD: HTTP://WWW.FLICKR.COM/PHOTOS/ARTUR02/471094378/
               JALOPY: HTTP://WWW.FLICKR.COM/PHOTOS/DRAGONFLEYE/3246153/
               JALOPY ON RT 66: HTTP://WWW.FLICKR.COM/PHOTOS/EVOETSCH/2436023218/
               PIMPMOBILE: HTTP://WWW.FLICKR.COM/PHOTOS/AIRGAP/1053594933/
               JUNKED JALOPY: HTTP://WWW.FLICKR.COM/PHOTOS/JABOOBIE/61014658/
               PAINTING CAR: HTTP://WWW.FLICKR.COM/PHOTOS/GARETHJMSAUNDERS/2066690016/
               WITHERED TOMATOES: HTTP://WWW.FLICKR.COM/PHOTOS/SPACESUITCATALYST/349778837/




Monday, March 16, 2009

Más contenido relacionado

Destacado

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
 
Liquibase migration for data bases
Liquibase migration for data basesLiquibase migration for data bases
Liquibase migration for data basesRoman Uholnikov
 
Database Change Management
Database Change ManagementDatabase Change Management
Database Change ManagementDominik Hirt
 
Database Change Management as a Service
Database Change Management as a ServiceDatabase Change Management as a Service
Database Change Management as a ServiceAndrew Solomon
 
Last Month in PHP - February 2017
Last Month in PHP - February 2017Last Month in PHP - February 2017
Last Month in PHP - February 2017Eric Poe
 
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
 
Database migration with flyway
Database migration  with flywayDatabase migration  with flyway
Database migration with flywayJonathan Holloway
 
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
 
Liquibase & Flyway @ Baltic DevOps
Liquibase & Flyway @ Baltic DevOpsLiquibase & Flyway @ Baltic DevOps
Liquibase & Flyway @ Baltic DevOpsAndrei Solntsev
 
Database Migrations with Gradle and Liquibase
Database Migrations with Gradle and LiquibaseDatabase Migrations with Gradle and Liquibase
Database Migrations with Gradle and LiquibaseDan Stine
 
Database migrations with Flyway and Liquibase
Database migrations with Flyway and LiquibaseDatabase migrations with Flyway and Liquibase
Database migrations with Flyway and LiquibaseLars Östling
 
Handling Database Deployments
Handling Database DeploymentsHandling Database Deployments
Handling Database DeploymentsMike Willbanks
 
Community Engagement and Social-Ecological Resilience: How You Choose to Live...
Community Engagement and Social-Ecological Resilience: How You Choose to Live...Community Engagement and Social-Ecological Resilience: How You Choose to Live...
Community Engagement and Social-Ecological Resilience: How You Choose to Live...Jeremy Williams
 
CüMle TüRleri
CüMle TüRleriCüMle TüRleri
CüMle TüRleriyardimt
 
Creating Digital Stories
Creating Digital StoriesCreating Digital Stories
Creating Digital StoriesJeremy Williams
 
CüMle çEşItleri
CüMle çEşItleriCüMle çEşItleri
CüMle çEşItleriyardimt
 

Destacado (20)

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
 
Liquibase migration for data bases
Liquibase migration for data basesLiquibase migration for data bases
Liquibase migration for data bases
 
Database Change Management
Database Change ManagementDatabase Change Management
Database Change Management
 
Database Change Management as a Service
Database Change Management as a ServiceDatabase Change Management as a Service
Database Change Management as a Service
 
Last Month in PHP - February 2017
Last Month in PHP - February 2017Last Month in PHP - February 2017
Last Month in PHP - February 2017
 
Database versioning with liquibase
Database versioning with liquibaseDatabase versioning with liquibase
Database versioning with liquibase
 
Mini Training Flyway
Mini Training FlywayMini Training Flyway
Mini Training Flyway
 
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
 
Database migration with flyway
Database migration  with flywayDatabase migration  with flyway
Database migration with flyway
 
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
 
Liquibase & Flyway @ Baltic DevOps
Liquibase & Flyway @ Baltic DevOpsLiquibase & Flyway @ Baltic DevOps
Liquibase & Flyway @ Baltic DevOps
 
Database Migrations with Gradle and Liquibase
Database Migrations with Gradle and LiquibaseDatabase Migrations with Gradle and Liquibase
Database Migrations with Gradle and Liquibase
 
Database migrations with Flyway and Liquibase
Database migrations with Flyway and LiquibaseDatabase migrations with Flyway and Liquibase
Database migrations with Flyway and Liquibase
 
Handling Database Deployments
Handling Database DeploymentsHandling Database Deployments
Handling Database Deployments
 
Community Engagement and Social-Ecological Resilience: How You Choose to Live...
Community Engagement and Social-Ecological Resilience: How You Choose to Live...Community Engagement and Social-Ecological Resilience: How You Choose to Live...
Community Engagement and Social-Ecological Resilience: How You Choose to Live...
 
CüMle TüRleri
CüMle TüRleriCüMle TüRleri
CüMle TüRleri
 
Creating Digital Stories
Creating Digital StoriesCreating Digital Stories
Creating Digital Stories
 
Moodle Talde Maialen Sagarna
Moodle Talde Maialen SagarnaMoodle Talde Maialen Sagarna
Moodle Talde Maialen Sagarna
 
Art 245 photo montage
Art 245 photo montageArt 245 photo montage
Art 245 photo montage
 
CüMle çEşItleri
CüMle çEşItleriCüMle çEşItleri
CüMle çEşItleri
 

Similar a Database Refactoring With Liquibase

OpenID DrupalCon 2009
OpenID DrupalCon 2009OpenID DrupalCon 2009
OpenID DrupalCon 2009James Walker
 
BigNoise - Web Design Firm, Charlotte, NC
BigNoise - Web Design Firm, Charlotte, NCBigNoise - Web Design Firm, Charlotte, NC
BigNoise - Web Design Firm, Charlotte, NCbignoise
 
Emergence
EmergenceEmergence
Emergenceblprnt
 
Chad Udell - Developers are from Mars, Designers are from Venus
Chad Udell - Developers are from Mars, Designers are from VenusChad Udell - Developers are from Mars, Designers are from Venus
Chad Udell - Developers are from Mars, Designers are from Venus360|Conferences
 
In context
In contextIn context
In contextg1sh
 
Practical Semantic Web and Why You Should Care - DrupalCon DC 2009
Practical Semantic Web and Why You Should Care - DrupalCon DC 2009Practical Semantic Web and Why You Should Care - DrupalCon DC 2009
Practical Semantic Web and Why You Should Care - DrupalCon DC 2009Boris Mann
 
Gerd Leonhard Presentation at Emerging Communication Conference & Awards 2009...
Gerd Leonhard Presentation at Emerging Communication Conference & Awards 2009...Gerd Leonhard Presentation at Emerging Communication Conference & Awards 2009...
Gerd Leonhard Presentation at Emerging Communication Conference & Awards 2009...eCommConf
 
Introduction to Agile and SCRUm
Introduction to Agile and SCRUmIntroduction to Agile and SCRUm
Introduction to Agile and SCRUmSumeet Moghe
 
Introduction to Agile and SCRUM
Introduction to Agile and SCRUMIntroduction to Agile and SCRUM
Introduction to Agile and SCRUMSumeet Moghe
 

Similar a Database Refactoring With Liquibase (15)

Open Web
Open WebOpen Web
Open Web
 
OpenID DrupalCon 2009
OpenID DrupalCon 2009OpenID DrupalCon 2009
OpenID DrupalCon 2009
 
BigNoise - Web Design Firm, Charlotte, NC
BigNoise - Web Design Firm, Charlotte, NCBigNoise - Web Design Firm, Charlotte, NC
BigNoise - Web Design Firm, Charlotte, NC
 
Bnc Pd Day Bellwoods
Bnc Pd Day BellwoodsBnc Pd Day Bellwoods
Bnc Pd Day Bellwoods
 
Emergence
EmergenceEmergence
Emergence
 
Chad Udell - Developers are from Mars, Designers are from Venus
Chad Udell - Developers are from Mars, Designers are from VenusChad Udell - Developers are from Mars, Designers are from Venus
Chad Udell - Developers are from Mars, Designers are from Venus
 
In context
In contextIn context
In context
 
Social Software at work
Social Software at workSocial Software at work
Social Software at work
 
1. Liferay Intro
1. Liferay Intro1. Liferay Intro
1. Liferay Intro
 
Practical Semantic Web and Why You Should Care - DrupalCon DC 2009
Practical Semantic Web and Why You Should Care - DrupalCon DC 2009Practical Semantic Web and Why You Should Care - DrupalCon DC 2009
Practical Semantic Web and Why You Should Care - DrupalCon DC 2009
 
A todo vapor
A todo vaporA todo vapor
A todo vapor
 
Gerd Leonhard Presentation at Emerging Communication Conference & Awards 2009...
Gerd Leonhard Presentation at Emerging Communication Conference & Awards 2009...Gerd Leonhard Presentation at Emerging Communication Conference & Awards 2009...
Gerd Leonhard Presentation at Emerging Communication Conference & Awards 2009...
 
04 Cms Osszehasonlitas
04 Cms Osszehasonlitas04 Cms Osszehasonlitas
04 Cms Osszehasonlitas
 
Introduction to Agile and SCRUm
Introduction to Agile and SCRUmIntroduction to Agile and SCRUm
Introduction to Agile and SCRUm
 
Introduction to Agile and SCRUM
Introduction to Agile and SCRUMIntroduction to Agile and SCRUM
Introduction to Agile and SCRUM
 

Más de Tim Berglund

Distributed Systems In One Lesson
Distributed Systems In One LessonDistributed Systems In One Lesson
Distributed Systems In One LessonTim Berglund
 
Decision Making in Software Teams
Decision Making in Software TeamsDecision Making in Software Teams
Decision Making in Software TeamsTim Berglund
 
Then our buildings shape us 10 minutes
Then our buildings shape us   10 minutesThen our buildings shape us   10 minutes
Then our buildings shape us 10 minutesTim Berglund
 
Complexity Theory and Software Development
Complexity Theory and Software DevelopmentComplexity Theory and Software Development
Complexity Theory and Software DevelopmentTim Berglund
 
Gaelyk: Lightweight Groovy on the Google App Engine
Gaelyk: Lightweight Groovy on the Google App EngineGaelyk: Lightweight Groovy on the Google App Engine
Gaelyk: Lightweight Groovy on the Google App EngineTim Berglund
 
Slaying The Legacy Dragon: Practical Lessons in Replacing Old Software
Slaying The Legacy Dragon: Practical Lessons in Replacing Old SoftwareSlaying The Legacy Dragon: Practical Lessons in Replacing Old Software
Slaying The Legacy Dragon: Practical Lessons in Replacing Old SoftwareTim Berglund
 
Test First Refresh Second: Test-Driven Development in Grails
Test First Refresh Second: Test-Driven Development in GrailsTest First Refresh Second: Test-Driven Development in Grails
Test First Refresh Second: Test-Driven Development in GrailsTim Berglund
 
Test First, Refresh Second: Web App TDD in Grails
Test First, Refresh Second: Web App TDD in GrailsTest First, Refresh Second: Web App TDD in Grails
Test First, Refresh Second: Web App TDD in GrailsTim Berglund
 

Más de Tim Berglund (9)

Distributed Systems In One Lesson
Distributed Systems In One LessonDistributed Systems In One Lesson
Distributed Systems In One Lesson
 
NoSQL Smackdown!
NoSQL Smackdown!NoSQL Smackdown!
NoSQL Smackdown!
 
Decision Making in Software Teams
Decision Making in Software TeamsDecision Making in Software Teams
Decision Making in Software Teams
 
Then our buildings shape us 10 minutes
Then our buildings shape us   10 minutesThen our buildings shape us   10 minutes
Then our buildings shape us 10 minutes
 
Complexity Theory and Software Development
Complexity Theory and Software DevelopmentComplexity Theory and Software Development
Complexity Theory and Software Development
 
Gaelyk: Lightweight Groovy on the Google App Engine
Gaelyk: Lightweight Groovy on the Google App EngineGaelyk: Lightweight Groovy on the Google App Engine
Gaelyk: Lightweight Groovy on the Google App Engine
 
Slaying The Legacy Dragon: Practical Lessons in Replacing Old Software
Slaying The Legacy Dragon: Practical Lessons in Replacing Old SoftwareSlaying The Legacy Dragon: Practical Lessons in Replacing Old Software
Slaying The Legacy Dragon: Practical Lessons in Replacing Old Software
 
Test First Refresh Second: Test-Driven Development in Grails
Test First Refresh Second: Test-Driven Development in GrailsTest First Refresh Second: Test-Driven Development in Grails
Test First Refresh Second: Test-Driven Development in Grails
 
Test First, Refresh Second: Web App TDD in Grails
Test First, Refresh Second: Web App TDD in GrailsTest First, Refresh Second: Web App TDD in Grails
Test First, Refresh Second: Web App TDD in Grails
 

Último

Visualising and forecasting stocks using Dash
Visualising and forecasting stocks using DashVisualising and forecasting stocks using Dash
Visualising and forecasting stocks using Dashnarutouzumaki53779
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 

Último (20)

Visualising and forecasting stocks using Dash
Visualising and forecasting stocks using DashVisualising and forecasting stocks using Dash
Visualising and forecasting stocks using Dash
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 

Database Refactoring With Liquibase

  • 1. DATABASE REFACTORING WITH Tim Berglund March, 2009 Monday, March 16, 2009
  • 2. YOU HAVE A DATABASE IN YOUR LIFE Monday, March 16, 2009
  • 3. YOUR DATABASE HAS A FUTURE Monday, March 16, 2009
  • 4. CAN IT ADAPT? Monday, March 16, 2009
  • 5. HAS IT BEEN EMBALMED? Monday, March 16, 2009
  • 8. NOT REALLY ALIVE Monday, March 16, 2009
  • 9. CURSES THE DBA WHO CHANGES IT Monday, March 16, 2009
  • 10. WE WILL BREAK THE CURSE Monday, March 16, 2009
  • 11. EVOLUTIONARY DATABASE DEVELOPMENT Monday, March 16, 2009
  • 12. EVOLUTIONARY DATABASE DEVELOPMENT Monday, March 16, 2009
  • 13. EVOLUTIONARY DATABASE DEVELOPMENT REFACTORING Monday, March 16, 2009
  • 14. EVOLUTIONARY DATABASE DEVELOPMENT REFACTORING EVOLUTIONARY DATA MODELING Monday, March 16, 2009
  • 15. EVOLUTIONARY DATABASE DEVELOPMENT REFACTORING EVOLUTIONARY DATA MODELING AUTOMATED TESTS Monday, March 16, 2009
  • 16. EVOLUTIONARY DATABASE DEVELOPMENT REFACTORING EVOLUTIONARY DATA MODELING AUTOMATED TESTS SOURCE CONTROL Monday, March 16, 2009
  • 17. EVOLUTIONARY DATABASE DEVELOPMENT REFACTORING EVOLUTIONARY DATA MODELING AUTOMATED TESTS SOURCE CONTROL SANDBOXES Monday, March 16, 2009
  • 20. REFACTORING A disciplined way to make small changes to your source code to improve its design, making it easier to work with. Monday, March 16, 2009
  • 21. REFACTORING Not adding features! Monday, March 16, 2009
  • 22. REFACTORING Not fixing bugs! Monday, March 16, 2009
  • 23. REFACTORING Opportunistically improving design to accommodate change. Monday, March 16, 2009
  • 24. DATABASE REFACTORING A simple change to a database schema that improves its design while retaining both its behavioral and informational semantics. Monday, March 16, 2009
  • 25. EVOLUTIONARY DATA MODELING Monday, March 16, 2009
  • 26. EVOLUTIONARY DATA MODELING NOT TRYING TO “GET IT RIGHT UP FRONT.” Monday, March 16, 2009
  • 27. EVOLUTIONARY DATA MODELING MAYBE SOME BIG THOUGHTS AT FIRST Monday, March 16, 2009
  • 28. EVOLUTIONARY DATA MODELING BUILD THE SIMPLEST THING THAT CAN POSSIBLY WORK...EVERY DAY Monday, March 16, 2009
  • 29. DATABASE TESTS TDD IN THE DB Monday, March 16, 2009
  • 31. DATABASE TESTS STORED PROCEDURES Monday, March 16, 2009
  • 32. DATABASE TESTS STORED PROCEDURES SQLUNIT Monday, March 16, 2009
  • 33. DATABASE TESTS STORED PROCEDURES SQLUNIT DBUNIT Monday, March 16, 2009
  • 34. DATABASE TESTS STORED PROCEDURES SQLUNIT DBUNIT CUSTOM HYBRIDS Monday, March 16, 2009
  • 36. SOURCE CONTROL LIKE MOTHER TAUGHT YOU Monday, March 16, 2009
  • 38. SOURCE CONTROL DDL EXTRACT/MIGRATION SCRIPTS REFERENCE DATA STORED PROCS/TRIGGERS Monday, March 16, 2009
  • 43. CHANGELOG COMMANDS Monday, March 16, 2009
  • 44. CHANGELOG COMMANDS MIGRATION SCENARIOS Monday, March 16, 2009
  • 46. CHANGELOG SQL IN XML Monday, March 16, 2009
  • 47. CHANGELOG SQL IN XML ONE OPERATION AT A TIME Monday, March 16, 2009
  • 48. CHANGELOG SQL IN XML ONE OPERATION AT A TIME TRACKED IN DATABASE Monday, March 16, 2009
  • 49. CHANGELOG <changeSet author=quot;tlberglund (generated)quot; id=quot;1236660747556-11quot;> <createTable tableName=quot;scshoppingcartquot;> <column autoIncrement=quot;truequot; name=quot;idquot; type=quot;INTquot;> <constraints nullable=quot;falsequot;/> </column> <column name=quot;useridquot; type=quot;INTquot;> <constraints nullable=quot;falsequot;/> </column> <column name=quot;lastmodifiedquot; type=quot;DATETIMEquot;/> <column name=quot;namequot; type=quot;VARCHAR(50)quot;/> </createTable> </changeSet> <changeSet author=quot;tlberglundquot; id=quot;spot-1-1-2quot;> <renameTable oldTableName=quot;scscrubrecordwarehousequot; newTableName=quot;scrub_record_logquot; /> </changeSet> Monday, March 16, 2009
  • 50. LIQUIBASE COMMANDS Monday, March 16, 2009
  • 51. LIQUIBASE COMMANDS generateChangeLog Monday, March 16, 2009
  • 52. LIQUIBASE COMMANDS changeLogSync Monday, March 16, 2009
  • 53. LIQUIBASE COMMANDS update Monday, March 16, 2009
  • 54. LIQUIBASE COMMANDS tag Monday, March 16, 2009
  • 55. LIQUIBASE COMMANDS rollback Monday, March 16, 2009
  • 56. LIQUIBASE COMMANDS diff Monday, March 16, 2009
  • 58. AND WE’RE BACK Monday, March 16, 2009
  • 59. CULTIVATING THE BROWNFIELD Monday, March 16, 2009
  • 60. LEGACY ENTERPRISE APP Monday, March 16, 2009
  • 61. NEW GRAILS HOTNESS Monday, March 16, 2009
  • 63. CREATIVE ORM MAPPINGS Monday, March 16, 2009
  • 64. WITHERING ON THE VINE Monday, March 16, 2009
  • 65. BROWNFIELD DATA INTEGRATION Monday, March 16, 2009
  • 66. BROWNFIELD DATA INTEGRATION TIME ZERO MIGRATION Monday, March 16, 2009
  • 67. BROWNFIELD DATA INTEGRATION TIME ZERO MIGRATION Monday, March 16, 2009
  • 68. BROWNFIELD TESTING Monday, March 16, 2009
  • 69. BROWNFIELD TESTING INTEGRATION TEST DATA Monday, March 16, 2009
  • 70. BROWNFIELD TESTING Monday, March 16, 2009
  • 71. BROWNFIELD TESTING T0 MIGRATION SCRIPTS Monday, March 16, 2009
  • 72. BROWNFIELD TESTING Monday, March 16, 2009
  • 73. THE CURSE IS BROKEN Monday, March 16, 2009
  • 74. THANK YOU! TIM BERGLUND AUGUST TECHNOLOGY GROUP, LLC http://www.augusttechgroup.com tim.berglund@augusttechgroup.com @tlberglund Monday, March 16, 2009
  • 75. PHOTO CREDITS DODO: HTTP://WWW.INTERNATIONALDOVESOCIETY.COM/MISCSPECIES/DODO.HTM EMBALMING: HTTP://LIBRARY.THINKQUEST.ORG/C0116982/HTML%20PAGE%20FOLDER/ HMUMMIFICATION.HTM ATTACKING MUMMY: HTTP://WWW.FLICKR.COM/PHOTOS/ROONBABOON/292393932/ CREEPY MUMMY HEAD: HTTP://WWW.FLICKR.COM/PHOTOS/DR-INI/446311713/ MARTIN FOWLER: HTTP://WWW.FLICKR.COM/PHOTOS/PRAGDAVE/173640462/ SCOTT AMBLER: HTTP://WWW.AMBYSOFT.COM/SCOTTAMBLER.HTML BRENDEN FRASER: HTTP://SCRAPETV.COM/NEWS/NEWS%20PAGES/ENTERTAINMENT/UNIVERSAL-FIRE- ACCIDENTAL-NEW-MUMMY-MOVIE-DELIBERATE-SCRAPE-TV-THE-WORLD-ON-YOUR-SIDE.HTML SAND: HTTP://WWW.FLICKR.COM/PHOTOS/LEVIATHOR/207625319/ MOTHER AND CHILD: HTTP://WWW.FLICKR.COM/PHOTOS/PATRICK_Q/268149208/ BROWN FIELD: HTTP://WWW.FLICKR.COM/PHOTOS/ARTUR02/471094378/ JALOPY: HTTP://WWW.FLICKR.COM/PHOTOS/DRAGONFLEYE/3246153/ JALOPY ON RT 66: HTTP://WWW.FLICKR.COM/PHOTOS/EVOETSCH/2436023218/ PIMPMOBILE: HTTP://WWW.FLICKR.COM/PHOTOS/AIRGAP/1053594933/ JUNKED JALOPY: HTTP://WWW.FLICKR.COM/PHOTOS/JABOOBIE/61014658/ PAINTING CAR: HTTP://WWW.FLICKR.COM/PHOTOS/GARETHJMSAUNDERS/2066690016/ WITHERED TOMATOES: HTTP://WWW.FLICKR.COM/PHOTOS/SPACESUITCATALYST/349778837/ Monday, March 16, 2009

Notas del editor

  1. The overwhelming likelihood is that you&#x2019;re working on some kind of software that interacts with a relational database.
  2. It&#x2019;s going to be there, it&#x2019;s going to be doing something, and you&#x2019;re going to have a relationship with it. The question is, will the relationship be a good one for both of you, or bad?
  3. Will it die? It is said of evolutionary systems that things that fail to adapt to change die out. If only this were the case with the enterprise database...
  4. Rather than going extinct, the production DBAs surround it like priests, carefully filling it with embalming fluid and wrapping it in linen strips. (And possibly putting some operations personnel in the tomb to serve the database in the afterlife.)
  5. Inability to change and overprotection lead us to this dread antipattern.
  6. There are long-lived Enterprise applications that rely on it, so it can&#x2019;t just go away.
  7. It isn&#x2019;t really alive either, because business needs are constantly changing, but the database can&#x2019;t change with them.
  8. At least the production DBAs seem to think so!
  9. We&#x2019;ll figure out how to manage changes to the database such that we can make them with confidence in a way that brings the best of developer tools to bear and is relatively friendly to DBA workflows. We&#x2019;ll do this with a mindset and a tool.
  10. The fix is what Scott Ambler calls &#x201C;evolutionary database development.&#x201D; This consists of five components.
  11. Let&#x2019;s explore each of these in turn.
  12. Let&#x2019;s explore each of these in turn.
  13. Let&#x2019;s explore each of these in turn.
  14. Let&#x2019;s explore each of these in turn.
  15. Let&#x2019;s explore each of these in turn.
  16. Martin sez...
  17. Martin sez...
  18. Scott sez.... Code refactorings are really only concerned about behavior. DBs have behavior (stored procs, triggers, etc.) but also information. The database must say the same thing in the same way after the refactoring.
  19. These are two mistakes here: one is thinking we&#x2019;re smart enough to do all this designing correctly at the outset&#x2014;we&#x2019;re not. The other is thinking that the database&#x2019;s business context is a static thing&#x2014;it isn&#x2019;t. There is no &#x201C;right&#x201D; up front, because requirements will change constantly.
  20. Which doesn&#x2019;t mean we can&#x2019;t do a couple of days of designing at first; we can. It makes sense to try to anticipate what we can and make big, hard-to-change commitments correctly. We always expect change, though.
  21. TDD adoption in software development is low enough, but it is virtually unheard of, as far as I know, in database development. The tooling lags behind and the expertise is singularly rare.
  22. There are ways to do it. The tools aren&#x2019;t what they are for TDD of code, but there are options.
  23. There are ways to do it. The tools aren&#x2019;t what they are for TDD of code, but there are options.
  24. There are ways to do it. The tools aren&#x2019;t what they are for TDD of code, but there are options.
  25. There are ways to do it. The tools aren&#x2019;t what they are for TDD of code, but there are options.
  26. Bring all the knowledge, practices, and advantages of software source control to the database. Simply control all those text files in SVN or Git like you normally would. This practice is old hat.
  27. Every database artifact goes in to the repository.
  28. Developers need a place to deploy refactorings when they&#x2019;re trying to get their tests to pass. This must be a local database not used by any other team member or system.
  29. If we learn how to refactor databases from Ambler and Sandalage, Liquibase is the tool that makes it easy. It is an XML-based love poem to Scott Ambler.
  30. We&#x2019;ll consider four aspects of Liquibase. How it stores the schema, how it interacts with the database, and how to use it in some real-world scenarios.
  31. We&#x2019;ll consider four aspects of Liquibase. How it stores the schema, how it interacts with the database, and how to use it in some real-world scenarios.
  32. We&#x2019;ll consider four aspects of Liquibase. How it stores the schema, how it interacts with the database, and how to use it in some real-world scenarios.
  33. Must we rewrite our SQL in XML? We must. It&#x2019;s painful and unappetizing, but worth it! Also, there&#x2019;s a Grails plugin called AutoBase that lets us do it in nice Groovy Builder syntax, which is preferable.
  34. Must we rewrite our SQL in XML? We must. It&#x2019;s painful and unappetizing, but worth it! Also, there&#x2019;s a Grails plugin called AutoBase that lets us do it in nice Groovy Builder syntax, which is preferable.
  35. Must we rewrite our SQL in XML? We must. It&#x2019;s painful and unappetizing, but worth it! Also, there&#x2019;s a Grails plugin called AutoBase that lets us do it in nice Groovy Builder syntax, which is preferable.
  36. The changelog is a script that builds your schema one DDL statement at a time. Each changeSet is converted into a dialect-specific SQL statement and is executed in the database, then marked as complete in a log table.
  37. Extracts the database&#x2019;s metadata and generates a changelog. This is the first step is getting started on a database that already exists.
  38. Since Liquibase tracks the status of all changesets in the changelog, we&#x2019;ll need to tell it that our newly extracted changelog is in sync with the actual database. This command usually shouldn&#x2019;t be executed except as the second step getting started with the tool.
  39. Plays any new changeSets in the changeLog against the database. This is the statement you&#x2019;ll use the most during evolutionary database development with Liquibase.
  40. Marks the database for a future rollback.
  41. Rolls back changesets to given tag.
  42. Supposed to document the differences between the database and the changelog. I&#x2019;ve not had good luck with this so far against MySQL and SQLServer databases.
  43. Evolutionary Database Development is not controversial among software developers, because we are largely persuaded of the core propositions. Moreover, Liquibase seems like a reasonable tool to help. Now let&#x2019;s talk about some practices to put in place in a brownfield effort.
  44. People are using it, it works, it has literally years of knowledge and business process encoded in it. It&#x2019;s also ugly and outdated, and its schema seems to have been built by the DBA Club after school. But you&#x2019;re replacing it, with Grails...!
  45. You want oil changes on the jalopy to take effect in the sportscar. When you put miles on the jalopy&#x2019;s odometer, they have to show up on the new car. That&#x2019;s tricky. How to do it? You&#x2019;ve got options.
  46. Write a big data migration script, test it rigorously, migrate all legacy features to the new app, and schedule a hard cutover. Not only will this never happen in the present economy, but you&#x2019;re a little bit crazy if you attempt it. It&#x2019;s way too risky to stake your reputation on it.
  47. Write the new app with its ORM layer (GORM in this case) mapping the nice, clean domain model onto the legacy database. This will work, but offers no hope of refactoring the old schema, which may sorely need reform.
  48. Write the new app the way you want it. Design a good, expressive domain model in the language of the business. Let the ORM layer create the schema, possibly with some tweaking. Then keep the legacy data connected to the new schema. But brownfield data integration is tricky...
  49. Need to write data migration scripts to populate the new schema with the mapped legacy schema at T0 (with the app off). Can do in SPs, Talend, Groovy, etc. Need to keep them synced with [cue the incidental music] TRIGGERS!
  50. Need to write data migration scripts to populate the new schema with the mapped legacy schema at T0 (with the app off). Can do in SPs, Talend, Groovy, etc. Need to keep them synced with [cue the incidental music] TRIGGERS!
  51. Integration tests run against your new schema, so they&#x2019;re easy. Resist the temptation to write mapping scripts to generate test data, and just hand-code it.
  52. It&#x2019;s a tall order to write automated tests for this. The most realistic option is automated spot-checking code that randomly picks legacy records and makes assertions on the post-migration records in the new schema.
  53. Also somewhat labor-intensive to test, but essential. Brownfield integration with triggers is probably new to the team, and if legacy and new-product teams are different, the legacy team will tend to finger-point and engage in magical thinking about the unknown. Confidence is key!
  54. We&#x2019;ve seen how to think about database development in the same way we think about Agile software development. We&#x2019;ve reviewed Liquibase, which enforces the discipline of controlling our changes in a repository and breaking them down into single steps which are managed individually. We&#x2019;ve even talked about how to migrate real systems.