Re: Diff on a database structure 
Hi Jen,

Thanks for your suggestion, I don't have a master build script, I do it 
be hand through phpMyAdmin and then use the backup feature of that if I 
want to move it.

I'm really looking for something that I can say to: "compare this 
database with this one and tell me what the differences are" and it can 
give me something like:

table.column has type VARCHAR(255) in DB1 but type TEXT in DB2
table.column is indexed in DB1 but not in DB2
table.column_2 does not exist in DB2
table_2 does not exist in DB2

And also possibly a machine readable output format so I can process 
making DB2 the same as DB1 automatically, although I think I may prefer 
to still make the change manually. Not sure of details yet but need 
options first :)

Obviously I may end up writing some or all of it myself but it seems 
like something someone else has probably done and it would save me time 
if it's out there somewhere or at least a starting point such as the 
diff analysis.

Cheers,
Nigel

Jeni Zundel wrote:
> Nigel - 
> 
> Do you have a master build script for building the db structures?
> 
> We used to do this at a software company I worked at; where we had to do reasonably frequent builds and changes to the db structure, so we needed a build process to be fairly streamlined:
> 
> We would have separate create scripts for our db objects - like tables, triggers (rarely used, but still), indices, tablespaces, etc.; then, we would have a master script that would invoke each of the object scripts.  
> 
> If you had it set up like this, you could probably run a fairly quick diff on your object scripts using a glob with perl to find your diffs.  If you set it up to have a directory structure to sort scripts by db object type (c:/tables, c:/tablespaces, c:/ views, etc.) then you can diff by subdir & only run what you need to rebuild for an update.  
> 
> I don't know if this helps or if this was already obvious to you.
> 
> Thanks,
> Jen
>  
> On Monday, May 07, 2007, at 09:14AM, "Nigel Peck"  wrote:
>> Hi,
>>
>> When I'm developing web applications I have a dev version of the 
>> scripts, modules and database and a live version. Nothing new there.
>>
>> I'm trying to automate the process of moving the dev site to the live 
>> site (the dev sites are on a Fedora server on my desk and the live sites 
>> on a Redhat server in a data centre 200 miles away).
>>
>> I've written scripts to copy the scripts and modules (and other 
>> associated files) to my local machine and ftp them to the live server 
>> and these work fine.
>>
>> However the final stage is to be able to bring the database structures 
>> into sync. Currently I keep a list of all the fields/tables/changes I've 
>> made and do this manually. I also check the table strcutres by hand to 
>> be sure I didn't miss anything.
>>
>> I'd like to find a way of comparing the two MySQL database strcutures 
>> and getting a list of the differences, anyone know of any 
>> modules/methods for doing this?
>>
>> Thanks in advance,
>>
>> Nigel
>>
>> --
>> MIS Web Design
>> http://www.miswebdesign.com/
>>
>> MIS Web Design Limited is registered in England and Wales with company 
>> number 04561623. Our VAT Registration Number is 803-939-126.
>>
>>
>> -- 
>> To unsubscribe, e-mail: beginners-unsubscribe@perl.org
>> For additional commands, e-mail: beginners-help@perl.org
>> http://learn.perl.org/
>>
>>
>>
>>
> 

-- 
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/


