Hello all,
Here is my problem: i have a stable version of my application with a fully filled database. Everything works fine, unless i want to modify the code of some of my php page files (inheritance within the sitetree).
More precisely, when i modify my pages.php on my dev computer, with almost no content in my database but some testing contents, i rebuild successfully.
But when i rebuild on the same application but this time using a filled database, an error occurs. Below the error generated by the build command.
Notice: i'm working with silverstripe 2.3.1 using the "i18n patch".
Environment Builder (formerly db/build)
http://localhost/SilverStripe-v2.3.1/
dev→ build
Building Database
Creating database tables
[...]
[Notice] Undefined variable: alterList
GET /SilverStripe-v2.3.1/dev/build
Line 199 in D:\SNCM\wamp\www\SilverStripe-v2.3.1\sapphire\core\model\MySQLDatabase.php
Source
190 * @param $newIndexes New indexes, a map of index name => index type
191 * @param $alteredFields Updated fields, a map of field name => field schema
192 * @param $alteredIndexes Updated indexes, a map of index name => index type
193 */
194 public function alterTable($tableName, $newFields = null, $newIndexes = null, $alteredFields = null, $alteredIndexes = null) {
195 $fieldSchemas = $indexSchemas = "";
196
197 if($newFields) foreach($newFields as $k => $v) $alterList[] .= "ADD `$k` $v";
198 if($newIndexes) foreach($newIndexes as $k => $v) $alterList[] .= "ADD " . $this->getIndexSqlDefinition($k, $v);
199 if($alteredFields) foreach($alteredFields as $k => $v) $alterList[] .= "CHANGE `$k` `$k` $v";
200 if($alteredIndexes) foreach($alteredIndexes as $k => $v) {
201 $alterList[] .= "DROP INDEX `$k`";
202 $alterList[] .= "ADD ". $this->getIndexSqlDefinition($k, $v);
203 }
204
205 $alterations = implode(",\n", $alterList);
Trace
MySQLDatabase->alterTable(SiteTree,Array,Array,Array,Array)
Line 163 of Database.php
Database->endSchemaUpdate()
Line 193 of DatabaseAdmin.php
DatabaseAdmin->doBuild(,1)
Line 100 of DatabaseAdmin.php
DatabaseAdmin->build()
Line 130 of DevelopmentAdmin.php
DevelopmentAdmin->build(HTTPRequest)
Line 107 of RequestHandler.php
RequestHandler->handleRequest(HTTPRequest)
Line 122 of Controller.php
Controller->handleRequest(HTTPRequest)
Line 277 of Director.php
Director::handleRequest(HTTPRequest,Session)
Line 121 of Director.php
Director::direct(/dev/build)
Line 115 of main.php