[doc] DB migration mechanism

Jan Schneider jan at horde.org
Thu Dec 18 10:37:02 UTC 2014


FWIW, the dev mailinglist is the better place to ask such questions.

Zitat von Sebastian Birnbach <birnbacs at gmail.com>:

> Thanks all. I took the liberty to write this down in
> http://wiki.horde.org/UpdatingYourDatabaseSchema.
>
>   Sebastian
>
> 2014-12-18 9:45 GMT+01:00 Ralf Lang <lang at b1-systems.de>:
>>
>> Hallo Sebastian, please do not top post but answer inline or below.
>>
>> On 18.12.2014 09:24, Sebastian Birnbach wrote:
>> > Thanks Ralph but this still leaves some questions open.
>> >
>> > I understand the migration mechanism is provided to allow a DB schema
>> > update without losing data.
>> >
>> > File naming appears to follow this pattern:
>> > <n>_<appname>_[base|upgrade]_<name>.php.
>> > The class defined in the file must then be called
>> > <Appname>[Base|Upgrade]<Name>.
>> >
>> > Questions:
>> > * what is the difference between base and upgrade? If the scripts are
>> > always executed in ascending order this difference is not self
>> explanatory.
>>
>> As far as I know, there is no relevant difference. The class name simply
>> must match.
>>
>> > * are there more choices to [base|upgrade]?
>> You can call it whatever you want. In an inhouse application, wie simply
>> call the <n>_<app>_<changename>.php
>>
>> > * The admin console appears to detect if a file in migration/ was not
>> > executed. However, it does not test if one of the files was modified
>> > after last time it was executed, right? So for repeated execution
>> > (development) I must use
>> > horde-db-migrate <appname> down; horde-db-migrate <appname> up
>> Doing "down" runs down through all steps and means data loss. You can
>> tell it a target revision.
>> The sequence table only stores the current schema number. It does not
>> store the applied schema itself.
>>
>>
>> > * speaking of horde-db-migrate, I have some issues there (maybe not the
>> > correct mailing list, please forgive)
>> >   + upon usage it outputs about 100 warnings, mostly about violated PHP
>> > strict standards and the use of deprecated functions.
>> This depends on the PHP version and configuration. Horde 5.0 is targeted
>> at PHP 5.3.x - If you see any deprecation warning with the latest (git
>> or release) horde version on a recent PHP, you should probably open a
>> ticket on bugs.horde.org or submit a patch to github.
>>
>>
>> >   + it will run under permissions of any user but only produce
>> > meaningful output if run as superuser
>> > Is this normal?
>>
>> I usually always run the horde cli scripts in a non-privileged system
>> user. This works for me.
>>
>> --
>> Ralf Lang
>> Linux Consultant / Developer
>> Tel.: +49-170-6381563
>> Mail: lang at b1-systems.de
>> B1 Systems GmbH
>> Osterfeldstraße 7 / 85088 Vohburg / http://www.b1-systems.de
>> GF: Ralph Dehner / Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB 3537
>>
>>



-- 
Jan Schneider
The Horde Project
http://www.horde.org/
https://www.facebook.com/hordeproject



More information about the doc mailing list