When importing a content type using the Features module, an exception is raised if a datatable already exists. Would it be better to just ignore these instead of raising an exception. I found a potential solution at https://drupal.org/node/1551132.
Below is the code in question: /incudes/database/schema.inc
Current code
public function createTable($name, $table) {
if ($this->tableExists($name)) {
throw new DatabaseSchemaObjectExistsException(t('Table %name already exists.', array('%name' => $name)));
}
$statements = $this->createTableSql($name, $table);
foreach ($statements as $statement) {
$this->connection->query($statement);
}
}
Proposed Solution
//https://drupal.org/node/1551132
public function createTable($name, $table) {
if ($this->tableExists($name)) {
drupal_set_message(t('table already existed: ' . $name));
return;
//throw new DatabaseSchemaObjectExistsException(t('Table %name already exists.', array('%name' => $name)));
}
$statements = $this->createTableSql($name, $table);
foreach ($statements as $statement) {
$this->connection->query($statement);
}
}
When importing a content type using the Features module, an exception is raised if a datatable already exists. Would it be better to just ignore these instead of raising an exception. I found a potential solution at https://drupal.org/node/1551132.
Below is the code in question: /incudes/database/schema.inc
Current code
public function createTable($name, $table) { if ($this->tableExists($name)) { throw new DatabaseSchemaObjectExistsException(t('Table %name already exists.', array('%name' => $name))); } $statements = $this->createTableSql($name, $table); foreach ($statements as $statement) { $this->connection->query($statement); } }
Proposed Solution
//https://drupal.org/node/1551132 public function createTable($name, $table) { if ($this->tableExists($name)) { drupal_set_message(t('table already existed: ' . $name)); return; //throw new DatabaseSchemaObjectExistsException(t('Table %name already exists.', array('%name' => $name))); } $statements = $this->createTableSql($name, $table); foreach ($statements as $statement) { $this->connection->query($statement); } }