Hi,

could you explain me please, how I'm supposed to solve the following task with 
DbSchema:

My extensions for ezp have a subdir schemas/ containing the table definitions 
for the persistent objects of the extension. Maybe they have also definitions 
for existent ezp tables, which normally means, that additional columns should 
be added.

>From the documentation of DbSchema I see two approaches, but don't know which 
one solves my problem:

a) 
 $schema =  ezcDbSchema::createFromFile(...);
 $schema->writeToDb

Does this one overwrite my existent db?

b) 
$schemaOld          = ezcDbSchema::createFromDb
$schemaAdditions =  ezcDbSchema::createFromFile(...);
$diff = ezcDbSchemaComparator::compareSchemas( $schemaOld, $schameAdditions );
$diff->applyToDb

But this one seems to delete the original tables that are not definied in 
schemaAdditions. It is also not nice to rebuild schemaOld for every 
extension/addition.

(BTW: There seems to be an error in the docblock of 
ezcDbSchemaComparator::compareSchemas. The second parameter is documented 
twice.)

c)
Save the diffs in the extension. But where is the format defined?

Cheers,

-- 
Thomas Koch, Software Developer

Young Media Concepts GmbH
Sonnenstr. 4
CH-8280 Kreuzlingen
Switzerland

Tel    +41 (0)71 / 508 24 86
Fax    +41 (0)71 / 560 53 89
Mobile +49 (0)170 / 753 89 16
Web    www.ymc.ch
-- 
Components mailing list
Components@lists.ez.no
http://lists.ez.no/mailman/listinfo/components

Reply via email to