News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Lorna Mitchell's Blog:
Script for Database Patching at Deploy Time
April 15, 2011 @ 08:51:31

As a part of one of her projects, Lorna Mitchell had a need to deploy database patches as a part of her overall deployment process. Obviously, doing this manually every time can be a hassle so she came up with a script that does the work for her (based on a patch_history table).

My current project (BiteStats, a simple report of your google analytics data) uses a basic system where there are numbered patches, and a patch_history table with a row for every patch that was run, showing the version number and a timestamp. When I deploy the code to production, I have a script that runs automatically to apply the patches.

The script uses the number-based patch names (such as patch1.sql) and finds the latest ones that haven't been applied based on the highest values for the patch_number column in the database. This number is updated by the patches themselves when they're run to avoid any confusion in the script itself. She has it running as a part of her phing build process as a part of a Zend Framework application.

0 comments voice your opinion now!
deployment database patch number history mysql table phing


blog comments powered by Disqus

Similar Posts

Brian Swan's Blog: SQL Server Driver for PHP Connection Options: Connection Pooling

Zend Developer Zone: Case Study w/ Zend Core for IBM with DB2 9 - 10k Active DB Connections

CSS-Tricks.com: PHP for Beginners: Building Your First Simple CMS

Christian Stocker's Blog: Upload Progress Meter for Windows

TotalPHP.com: Creating a text or csv file of information from your database


Community Events

Don't see your event here?
Let us know!


laravel5 video introduction library api extension conference interview laravel language series psr7 opinion voicesoftheelephpant development podcast unittest release framework community

All content copyright, 2015 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework