Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.8.6

Bug #8820 compareDefintion() problem
Submitted: 2006-09-30 16:25 UTC
From: kuu at pochta dot ru Assigned: ifeghali
Status: Closed Package: MDB2_Schema (version 0.6.0)
PHP Version: 5.1.1 OS: win32
Roadmaps: (Not assigned)    
Subscription  


 [2006-09-30 16:25 UTC] kuu at pochta dot ru (Victor Socolov)
Description: ------------ I am saving database structure to file and just than i am trying to restore database from that file. MDB2_Scheme is trying to update non-changing id field. MDB2 and MDB2_Driver_Mysql versions are last. Test script: --------------- 1. Saving db structure. // Db::$db is MDB2 object. $schema = &MDB2_Schema::factory( Db::$db ); $dbDef = $schema->getDefinitionFromDatabase(); $schema->dumpDatabase( $dbDef, array( 'output_mode'=>'file', 'output'=>'config/db.xml' ), MDB2_SCHEMA_DUMP_STRUCTURE ); 2. Updating database schema without changing db.xml. $schema = &MDB2_Schema::factory( Db::$db ); $dbCur = $schema->getDefinitionFromDatabase(); if (file_exists('config/db.xml')) { $dbNew = $schema->parseDatabaseDefinitionFile( 'config/db.xml' ); } echo $schema->updateDatabase( $dbNew, $dbCur )->getDebugInfo(); 3. Error is in MDB2_Driver_Mysql, line 790: if ($previous_default !== $default) { $change['default'] = true; } $previous_default is int and $previous is string. To fix it I replaced '!==' with '!='. Expected result: ---------------- No changes. Actual result: -------------- Error: _doQuery: [Error message: Could not execute statement] [Last query: ALTER TABLE subscribers CHANGE id id INT NOT NULL AUTO_INCREMENT PRIMARY KEY] [Native code: 1068] [Native message: Multiple primary key defined]

Comments

 [2006-10-27 01:11 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2006-10-28 04:42 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!