Re: SQL Source Control

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Richard Davey wrote:
> Hi all,
> 
> I know a lot of you use various means for PHP source control (CVS, SVN,
> etc), which is all well and fine, but how do you manage source control
> on your databases?
> 
> Say you've got an upgrade to a site, all of the new PHP files are
> controlled by SVN, so you can rollback at any time, but say the upgrade
> includes several key modifications to a MySQL table and perhaps the
> changing of some core data.
> 
> How (if at all?!) do you handle the versioning of the database and data
> itself, so you can keep both PHP and SQL structure in sync?

lets forget that updating SQL schemas on massive DBs will likely take
so much time that you will have to plan in downtime on the systems involved ...
that's clearly out of the scope of this question.

my strategy is also pretty weak in this regard but generally:

I write my code in such a way that older code can run with newer db schemas,
which basically means I add stuff but never remove it (tables, fields, etc) ...
schema updates are always 'expansive'.

If I'm feeling very tidy I'll create a seperate CVS module for the schema and
updates/rollbacks. this involves writing sql files that update for each version of
the project I have/will rollout ... and also sql files that perform the reverse/rollback
actions between project versions. (when I'm being tidy I always do DB schema update when
the major version number of a project changes) I end up with files named something like:

v1-to-v2.sql
v2-to-v3.sql
v2-to-v1.sql
v3-to-v2.sql

then I include a script which I can call with the desired version number and it works
out which sql files it needs to run and in which order (the current version is
either stored in the DB or stored in a txt file outside of CVS) ... I have considered making
this 'change version' script also automatically perform the required 'cvs up -r Foo' command on the
actual project files but I have not got round to ever actually do it (time, money, inspiration, lackof)

- maybe that brainfart inspires somewhat, then again maybe you'll pass out fom the smell :-)

> 
> Cheers,
> 
> Rich

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux