When i installed newsletter I got a database error like "table field_data_field_institution already exists" . In the newsleter.install file in function newsletter_fields_instances() it creates the fields for each taxonomy. So i have a taxonomy called "institution" and one of my nodes has a field called "institution" . So when newsletter installs, it tries to make the table field_data_field_institution but it already exists for my node field.
I added a simple check for that field to get it installed. Not sure if the module will still work. testing it. A general solution might be to check if field already exists and if so just use the existing field.
function newsletter_fields_instances() {
$vocabularies = taxonomy_get_vocabularies();
foreach ($vocabularies as $vocabulary) {
// Field names have 32 char limit.
$field_name = 'field_' . substr($vocabulary->machine_name, 0, 26);
// I already have a field_institution on one of my nodes if ($field_name == 'field_institution')
{
$field_name .= '_news';
}
$fields[] = array(
'field_name' => $field_name,
'type' => 'taxonomy_term_reference',
'cardinality' => FIELD_CARDINALITY_UNLIMITED,
....
Thanks
Comments
Comment #1
rsbecker CreditAttribution: rsbecker commentedThis is a major problem. It seems that when newsletter installs it tries to put every term reference field on the newsletter template. I don't know why that is, but when it throws this error the installation breaks and tables it needs, i.e. the field_newsletter_body, field_newsletter_categories, field_newsletter_list, field_newsletter_template, aren't created.
Then, if you try to uninstall the module it doesn't clean up after itself. Therefore, you cannot reinstall because some of the fields already exist. Either there needs to be more cleanup or there need to be traps to handle fields that exist.
The following error is thrown when attempting to uninstall after a failed install. The error is the same every time, even though there never is a field_deleted_29 or field_deleted_290 in the db.
This is true of the latest dev version as well.