Hi.

On Mon 2003-02-03 at 10:19:59 +0100, [EMAIL PROTECTED] wrote:
[...]
> >That can be made to work with several versions. In other words, it
> >would not check a version number saved in the database, but determine
> >the version by the database structure itself.
> >
> >That would give #2 with the assurance that an update script is only
> >run, if the database structure is as expected, no matter happened to
> >the database in-between (it is fascinating what clients can do to
> >files they are not supposed to even know about ;-).
> 
> Sound like a good idea, ie that I should use a md5 hash to recognise the 
> structure. and use that as a sort of versioning of the tables...
> 
> I think the md5 would have to be calculated ona per table basis, since 
> if we introduce some bug-fixes in one module only and it requires a 
> table-update, this would be recognised in a future update...

Of course it is up to you, but I wouldn't do it this way. Changing one
table but not another could break your application. I would call your
bug-fixes a new version and handle it accordingly.

> the question is then, do "select create table TEST" work exactly the
> same on different os:s ie if I have the same table on a windows
> machine and on a linux machine, does the above query return the
> exact same result?  even eith line endings? or could they return 2
> different queries and therefore making the md5 calculating prove
> worthless?

Interesting point. I did not think about this before (have no
cross-platform issues here).

Well, if you use mysqldump, you get different versions anyhow (because
it contains info about server, etc.). On UNIX at least, it is quite
easy to accomodate for lines ending.

Hm. There is a another problem. Newer versions of mysqldump use SHOW
CREATE TABLE, AFAIK, and therefore the dump will look server-dependend
(comments for 4.0 features or such).

In short, it is not as stable as needed regarding md5sums across
either, platforms or MySQL versions. Missed that, as I concentrated on
what you asked for, changes in your database.

The cross-platform part can be solved relatively easily by either
normalizing the dumps before building the checksum (which is not too
hard), or by simply having two checksums (the MS Windows and the UNIX
one) pointing to the same update-script.

For the MySQL versions issue, it should be enough to keep a older 3.23
mysqldump around, and use always the same. This may break somewhen
(MySQL 5.0?), but it should give you mid-term stability for the process.

> or are there other ways to get to the database structure that work the 
> same on different platforms...?

Hm. Write your on mysqldump? (That's not as hard as it sounds, because
you don't have to start from scratch, but only modify the existing
one.)

HTH,

        Benjamin.

-- 
[EMAIL PROTECTED]

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to