[doc] DB migration mechanism

Ralf Lang lang at b1-systems.de
Thu Dec 18 08:45:44 UTC 2014


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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: OpenPGP digital signature
URL: <http://lists.horde.org/archives/doc/attachments/20141218/5141fbb5/attachment.bin>


More information about the doc mailing list