[dev] DB Migration questions

Chuck Hagenbuch chuck at horde.org
Sun May 30 01:09:36 UTC 2010


Quoting Michael M Slusarz <slusarz at horde.org>:

> Quoting Jan Schneider <jan at horde.org>:
>
>> Zitat von Michael M Slusarz <slusarz at horde.org>:
>>
>>> Quoting Jan Schneider <jan at horde.org>:
>>>
>>>> For a fresh install, just run "db_migrate imp". Since there is no  
>>>> schema version in the database, all scripts will be run.
>>>>
>>>> If upgrading from IMP 4 to 5 run "db_migrate imp 1" (or 2?).  
>>>> Since a version is provided, the database is not checked for a  
>>>> schema version and only the upgrade scripts will be run.
>>>
>>> Couldn't this easily be handled by some checks in the migration  
>>> scripts though?  i.e. the migration scripts are run (db_migrate  
>>> imp), if no schema table is found we attempt to run ALL scripts,  
>>> but table creation scripts could easily add a table exists check  
>>> and skip the creation if the table already exists.  This prevents  
>>> users from having to know what exact migrate version number they  
>>> need to enter.
>>
>> This seems a bit fragile to me. I think explicitly providing a  
>> schema version with the migration script is much safer than  
>> assuming some schema version from the mere existence of a table.
>
> I would still prefer an approach where people either on an upgrade  
> path (from the previous version) or a new install simply has to run  
> "../db_migrate [app]".  If just for the fact that it makes  
> installation, and the corresponding installation docs, much cleaner.  
>  I subscribe to the thought that this is one of the main areas that  
> H4 needs to improve on - ease of installation.

I strongly agree here, too. For upgrades from H3, what about having a  
wrapper script that knows which migration version to start on,  
depending on which H3 version you're upgrading from?

-chuck


More information about the dev mailing list