/** * Check that updates to a dataobject's indexes are reflected in DDL */ public function testIndexesRerequestChanges() { $db = DB::getConn(); DB::quiet(); // Table will have been initially created by the $extraDataObjects setting // Update the SearchFields index here Config::inst()->update('DataObjectSchemaGenerationTest_IndexDO', 'indexes', array('SearchFields' => array('value' => 'Title'))); // Verify that the above index change triggered a schema update $db->beginSchemaUpdate(); $obj = new DataObjectSchemaGenerationTest_IndexDO(); $obj->requireTable(); $needsUpdating = $db->doesSchemaNeedUpdating(); $db->cancelSchemaUpdate(); $this->assertTrue($needsUpdating); }
/** * Check that updates to a dataobject's indexes are reflected in DDL */ public function testIndexesRerequestChanges() { $db = DB::getConn(); DB::quiet(); // Table will have been initially created by the $extraDataObjects setting // Update the SearchFields index here $oldIndexes = DataObjectSchemaGenerationTest_IndexDO::$indexes; DataObjectSchemaGenerationTest_IndexDO::$indexes['SearchFields']['value'] = '"Title"'; // Verify that the above index change triggered a schema update $db->beginSchemaUpdate(); $obj = new DataObjectSchemaGenerationTest_IndexDO(); $obj->requireTable(); $needsUpdating = $db->doesSchemaNeedUpdating(); $db->cancelSchemaUpdate(); $this->assertTrue($needsUpdating); // Restore old indexes DataObjectSchemaGenerationTest_IndexDO::$indexes = $oldIndexes; }