I can't save a new database backup destination or schedule a backup with a source where the database name is lengthy.

The following fatal error appears in my drupal log when saving a destination:

PDOException: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'destination_id' at row 1: INSERT INTO {backup_migrate_destinations} (destination_id, name, type, location, settings) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4); Array ( [:db_insert_placeholder_0] => db:our_data_contactcivicrm:default [:db_insert_placeholder_1] => our_data_contactcivicrm [:db_insert_placeholder_2] => mysql [:db_insert_placeholder_3] => mysql://civicrm:xxxxxxxx@localhost/our_data_contactcivicrm [:db_insert_placeholder_4] => a:0:{} ) in drupal_write_record() (line 6884 of /path/to/my/drupal/includes/common.inc).

A similar error appears when saving a schedule.

The column backup_migrate_destinations.destination_id and backup_migrate_schedules.source_id are defined as varchar(32). However, the module creates values for destination_id and source_id which may be longer than 32 characters, which leads to the fatal error. (For example see the method destinations of class backup_migrate_destination_db_mysql in includes/destinations.db.mysql.inc.)

Changing the length of these columns to 255 on my installation solved the problem.

In MySQL, database names may be as long as 64 characters (see http://dev.mysql.com/doc/refman/5.5/en/identifiers.html) so IDs built from database names need to live in a column that can accomodate that length.

Comments

sarojg’s picture

I'm new to all this, but planning a CiviCRM implementation for a local nonprofit. May I ask where you reset the column size?

ronan’s picture

Status: Active » Fixed

Fixed in dev. There's no upgrade path because it's a fairly rare problem, but if you're having this issue uninstall and then reinstall B&M.

pobster’s picture

Status: Fixed » Active

It fails our build when the schema module reports a mismatch. There should at least be an upgrade path to db_change_field() for the altered field lengths.

I'll make a patch later, I'm at work right now.

Pobster

ronan’s picture

Status: Active » Fixed

The latest dev has an update hook.

pobster’s picture

Status: Fixed » Needs review

http://drupal.org/node/150220

You should never use _schema() calls when writing update hooks.

Pobster

ronan’s picture

Status: Needs review » Fixed

Ok, fixed now.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.