SlideShare a Scribd company logo
Database Version Control Without Pain




                           Harrie Verveer
                          June 11th 2010
Database Version Control
What’s the problem?




                           2
http://www.sxc.hu/photo/754535
http://www.sxc.hu/photo/1207911
http://en.wikipedia.org/wiki/File:STS120LaunchHiRes.jpg
http://www.sxc.hu/photo/1255121
Why Database Version Control




                               7
Simple Patching Strategy
The basic idea




                           8
Simple patching strategy




                           9
Example patch file

patch-001.sql




                     10
http://www.sxc.hu/photo/1214820
Simple patching strategy

                      Development
                            Write code
                        Write DB patches
                     Apply patches to own DB




     Apply patches                             Commit




                          Update


                                                        12
Fixing patches

patch-002.sql




                 13
Fixing patches

patch-002.sql




                 13
Fixing patches

patch-002.sql




                 13
Fixing patches

patch-003.sql




                 14
Fixing patches

patch-003.sql




     Never modify a patch file once
       it’s under version control


                                      14
Undo patch files

undo-001.sql




                   15
http://www.freefoto.com/preview/41-07-7
Bonus points




               Install.sql




                             17
Bonus points




         Initial dummy content




                                 18
http://www.sxc.hu/photo/643214
http://www.sxc.hu/photo/946855
Automating the process
Faster & Safer




                         21
http://www.sxc.hu/photo/314594
Typical patch script




                       23
Typical patch script

update.sh




                       24
http://www.sxc.hu/photo/1196126
Branches
Merge problems




                 26
Branches
Trunk
    patch-001.sql

    patch-002.sql


    patch-003.sql




                    27
Branches
Trunk
    patch-001.sql

    patch-002.sql


    patch-003.sql
                         Branch A
         create branch

    patch-004.sql
                               patch-004.sql
    patch-005.sql

                               patch-005.sql
             Merge




                                               28
Branches
Trunk
    patch-001.sql

    patch-002.sql


    patch-003.sql
                         Branch A
         create branch

    patch-004.sql
                                               patch-006.sql
                               patch-004.sql
    patch-005.sql
                                               patch-007.sql
                               patch-005.sql
             Merge




                                                               28
Branches
Trunk
    patch-001.sql                             Branch A
                         create branch
    patch-002.sql

                                                    patch-002.sql
    patch-003.sql
                         Branch B
         create branch
                                                    patch-003.sql
              Merge

                                   patch-004.sql    patch-004.sql
    patch-004.sql
                                   patch-005.sql

    patch-005.sql                     Merge


                                                    patch-005.sql
                                      Merge
             Merge


                                                                    29
Separate sequence

db/patches/trunk/   db/patches/branchA/

patch-001.sql       patch-001.sql
patch-002.sql       patch-002.sql
patch-003.sql




                                          30
Separate sequence

db/patches/trunk/           db/patches/branchA/

patch-001.sql               patch-001.sql
patch-002.sql               patch-002.sql
patch-003.sql


                     Trunk version    3
                    BranchA version   2




                                                  30
Patchfile naming




       patch_20100611_1430.sql




                                 31
Patch log




            32
http://www.sxc.hu/photo/692740
Phing & DB Deploy
Avoiding the NIH syndrome




                            34
http://phing.info/




                     35
Phing




        36
37
DB Deploy




            38
DB Deploy

db/patches/1-create_user_table.sql




                                     39
Phing & DB Deploy




                    40
DB Deploy

changelog table:




                   41
DB Deploy

changelog table:




                   41
DB Deploy




            PHP




                  42
DB Deploy




            SQL




                  43
DB Deploy




            Features




                       44
Liquibase
A different approach




                       45
Liquibase




            www.liquibase.org




                                46
Liquibase




            47
Liquibase




            48
Liquibase




            49
Liquibase

  Updating
  Reverting
  Tagging
  Generate XML
  Diff




                 50
http://www.sxc.hu/photo/1241520
Liquibase




            Branches




                       52
Liquibase




            DBMS Support




                           53
Liquibase




            Documentation




                            54
Liquibase




            Java




                   55
Akrabat DB Schema Manager
Zend Framework specific solution




                                   56
Akrabat DB Schema Manager

  Zend Framework
  Proposed by Rob Allen in 2006
  Recently implemented
  Might be in ZF in the near future

http://github.com/akrabat/Akrabat




                                      57
Writing the patch

scripts/migrations/001-CreateUserTable.php




                                             58
Writing the patch

scripts/migrations/001-CreateUserTable.php




                                             59
Akrabat DB Schema Manager




              PHP Patches




                            60
Akrabat DB Schema Manager




      Easy syntax if you know ZF




                                   61
Akrabat DB Schema Manager




              Easy to use




                            62
Akrabat DB Schema Manager




            Branch merging




                             63
Doctrine Migrations




                      64
Doctrine Migrations




         http://www.doctrine-project.org/




                                            65
Doctrine Migrations




                      66
Doctrine Migrations




            Update-to-version




                                67
Doctrine Migrations




             Generate patches




                                68
Doctrine Migrations




 Useful if you’re already using Doctrine
                   ORM




                                           69
Summary




          70
Summary

 Patchfiles                 Akrabat DB Schema Manager
                            http://akrabat.com
 • Automating
                            http://github.com/akrabat/Akrabat
 • Branch merging

                            Doctrine Migrations
 Phing + DB Deploy          http://www.doctrine-project.org
 http://phing.info
 http://dbdeploy.com


 Liquibase
 http://www.liquibase.org




                                                                71
Questions ?




              72
Contact me

Harrie Verveer
Software Engineer at Ibuildings


E-mail:
harrie@ibuildings.nl


Skype:
harrie-ibuildings


Twitter:
@harrieverveer




               http://joind.in/1544
                                      73
Ad

More Related Content

What's hot (20)

PDF
MySQL Group Replication
65 slides6.7K views
PDF
Towards Holistic Continuous Software Performance Assessment
92 slides590 views
PPTX
Oracle Enterprise Manager 12c: The Oracle Monitoring tool of choice – Why yo...
173 slides5.5K views
PDF
MySQL Group Replicatio in a nutshell - MySQL InnoDB Cluster
192 slides2.5K views
PDF
Java MySQL Connector & Connection Pool Features & Optimization
92 slides6.7K views
PPTX
Awr doag
46 slides794 views
PDF
Oracle Database SQL Tuning Concept
83 slides2.4K views
PPTX
Oracle Database 12c - The Best Oracle Database 12c Tuning Features for Develo...
82 slides1.9K views
PDF
Tanel Poder - Performance stories from Exadata Migrations
28 slides6.5K views
PPTX
Mark Farnam : Minimizing the Concurrency Footprint of Transactions
43 slides1.1K views
PDF
Database Automation with MySQL Triggers and Event Schedulers
42 slides4.1K views
PDF
MySQL Replication Performance in the Cloud
36 slides224 views
PPTX
Best New Features of Oracle Database 12c
72 slides20.6K views
PDF
Advanced Oracle Troubleshooting
42 slides2.4K views
PPT
Best practices for share point solution deployment
31 slides9.1K views
PDF
In Memory Database In Action by Tanel Poder and Kerry Osborne
40 slides1.5K views
PDF
SPSD SharePoint Solution Deployer
21 slides13.6K views
PPTX
DBCC - Dubi Lebel
49 slides1.3K views
PDF
Pitfalls of migrating projects to JDK 9
44 slides3K views
PPTX
Managed Beans: When, Why and How
72 slides3K views
MySQL Group Replication
65 slides6.7K views
Towards Holistic Continuous Software Performance Assessment
92 slides590 views
Oracle Enterprise Manager 12c: The Oracle Monitoring tool of choice – Why yo...
173 slides5.5K views
MySQL Group Replicatio in a nutshell - MySQL InnoDB Cluster
192 slides2.5K views
Java MySQL Connector & Connection Pool Features & Optimization
92 slides6.7K views
Awr doag
46 slides794 views
Oracle Database SQL Tuning Concept
83 slides2.4K views
Oracle Database 12c - The Best Oracle Database 12c Tuning Features for Develo...
82 slides1.9K views
Tanel Poder - Performance stories from Exadata Migrations
28 slides6.5K views
Mark Farnam : Minimizing the Concurrency Footprint of Transactions
43 slides1.1K views
Database Automation with MySQL Triggers and Event Schedulers
42 slides4.1K views
MySQL Replication Performance in the Cloud
36 slides224 views
Best New Features of Oracle Database 12c
72 slides20.6K views
Advanced Oracle Troubleshooting
42 slides2.4K views
Best practices for share point solution deployment
31 slides9.1K views
In Memory Database In Action by Tanel Poder and Kerry Osborne
40 slides1.5K views
SPSD SharePoint Solution Deployer
21 slides13.6K views
DBCC - Dubi Lebel
49 slides1.3K views
Pitfalls of migrating projects to JDK 9
44 slides3K views
Managed Beans: When, Why and How
72 slides3K views

Viewers also liked (6)

KEY
Database version control - pf congres version
82 slides1.2K views
PDF
Database version control without pain - the PHP Barcelona version
97 slides4.6K views
PPTX
Database Change Management
6 slides548 views
PDF
Database version control without pain - the PHPNW10 version
98 slides2.4K views
PPTX
Database versioning with liquibase
16 slides2.9K views
PDF
Leveraging Open Source for Database Development: Database Version Control wit...
32 slides438 views
Database version control - pf congres version
82 slides1.2K views
Database version control without pain - the PHP Barcelona version
97 slides4.6K views
Database Change Management
6 slides548 views
Database version control without pain - the PHPNW10 version
98 slides2.4K views
Database versioning with liquibase
16 slides2.9K views
Leveraging Open Source for Database Development: Database Version Control wit...
32 slides438 views
Ad

Similar to Database version control DPC version (20)

PPT
Evolutionary Database Design
21 slides1.2K views
PDF
Gaelyk - Web Apps In Practically No Time
45 slides408 views
KEY
Simple SQL Change Management with Sqitch
260 slides9.9K views
PDF
Database Refactoring
40 slides14.2K views
PPT
Less03 db dbca
23 slides2.5K views
PDF
Not so blind SQL Injection
96 slides10.1K views
PDF
orical
37 slides1.9K views
KEY
Sane SQL Change Management with Sqitch
297 slides3.8K views
PDF
Patterns and Tools for Database Versioning, Migration, Data Loading and Test ...
32 slides5.2K views
PPT
Build Automation of PHP Applications
28 slides7K views
PDF
Trunk and branches for database configuration management
11 slides10.7K views
PPT
Db trends final
65 slides2.3K views
PDF
Flywaydb
60 slides1.6K views
PDF
Business Intelligence Release Management Best Practices
17 slides2K views
PPTX
Meetup Oracle Database MAD_BCN: 1.3 Gestión del ciclo de vida de Oracle Datab...
PPTX
Summer training oracle
26 slides1.4K views
PDF
BADCamp 2008 DB Sync
85 slides695 views
PDF
php_mysql_tutorial
64 slides2.3K views
PDF
php_mysql_tutorial
64 slides1K views
PDF
Bar Camp Auckland - Mongo DB Presentation BCA4
20 slides952 views
Evolutionary Database Design
21 slides1.2K views
Gaelyk - Web Apps In Practically No Time
45 slides408 views
Simple SQL Change Management with Sqitch
260 slides9.9K views
Database Refactoring
40 slides14.2K views
Less03 db dbca
23 slides2.5K views
Not so blind SQL Injection
96 slides10.1K views
orical
37 slides1.9K views
Sane SQL Change Management with Sqitch
297 slides3.8K views
Patterns and Tools for Database Versioning, Migration, Data Loading and Test ...
32 slides5.2K views
Build Automation of PHP Applications
28 slides7K views
Trunk and branches for database configuration management
11 slides10.7K views
Db trends final
65 slides2.3K views
Flywaydb
60 slides1.6K views
Business Intelligence Release Management Best Practices
17 slides2K views
Meetup Oracle Database MAD_BCN: 1.3 Gestión del ciclo de vida de Oracle Datab...
Summer training oracle
26 slides1.4K views
BADCamp 2008 DB Sync
85 slides695 views
php_mysql_tutorial
64 slides2.3K views
php_mysql_tutorial
64 slides1K views
Bar Camp Auckland - Mongo DB Presentation BCA4
20 slides952 views
Ad

Recently uploaded (20)

PDF
Electronic commerce courselecture one. Pdf
31 slides42 views
PPTX
Understanding_Digital_Forensics_Presentation.pptx
40 slides65 views
PDF
Chapter 2 Digital Image Fundamentals.pdf
33 slides123 views
PDF
Advanced IT Governance
PDF
How Onsite IT Support Drives Business Efficiency, Security, and Growth.pdf
11 slides100 views
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
15 slides35 views
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
40 slides41 views
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
10 slides62 views
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
59 slides56 views
PDF
solutions_manual_-_materials___processing_in_manufacturing__demargo_.pdf
357 slides63 views
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
1 slide112 views
PDF
Empathic Computing: Creating Shared Understanding
66 slides40 views
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
10 slides47 views
PDF
KodekX | Application Modernization Development
9 slides42 views
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
12 slides56 views
PDF
HCSP-Presales-Campus Network Planning and Design V1.0 Training Material-Witho...
1082 slides60 views
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
9 slides80 views
PDF
AI And Its Effect On The Evolving IT Sector In Australia - Elevate
6 slides32 views
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
10 slides58 views
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
47 slides917 views
Electronic commerce courselecture one. Pdf
31 slides42 views
Understanding_Digital_Forensics_Presentation.pptx
40 slides65 views
Chapter 2 Digital Image Fundamentals.pdf
33 slides123 views
Advanced IT Governance
How Onsite IT Support Drives Business Efficiency, Security, and Growth.pdf
11 slides100 views
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
15 slides35 views
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
40 slides41 views
Advanced methodologies resolving dimensionality complications for autism neur...
10 slides62 views
“AI and Expert System Decision Support & Business Intelligence Systems”
59 slides56 views
solutions_manual_-_materials___processing_in_manufacturing__demargo_.pdf
357 slides63 views
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
1 slide112 views
Empathic Computing: Creating Shared Understanding
66 slides40 views
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
10 slides47 views
KodekX | Application Modernization Development
9 slides42 views
Per capita expenditure prediction using model stacking based on satellite ima...
12 slides56 views
HCSP-Presales-Campus Network Planning and Design V1.0 Training Material-Witho...
1082 slides60 views
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
9 slides80 views
AI And Its Effect On The Evolving IT Sector In Australia - Elevate
6 slides32 views
Diabetes mellitus diagnosis method based random forest with bat algorithm
10 slides58 views
Dropbox Q2 2025 Financial Results & Investor Presentation
47 slides917 views

Database version control DPC version

Editor's Notes

  • #67: ORM = Object Relations Mapper