Database update function backup_migrate_update_7303 is causing a sql error:
"SQLSTATE[42000]: Syntax error or access violation: 1171 All parts of a PRIMARY KEY must be NOT NULL; if you need NULL in a key, use UNIQUE instead"
I think below line is the problem
db_add_field($table, $id,
array(
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
'description' => 'Primary ID field for the table. Not used for anything except internal lookups.',
// Do not export database-only keys.
'no export' => TRUE,
),
array('primary key' => array($id))
);

Subsequent calls to `drush updatedb` causes the below sql error:
"SQLSTATE[42000]: Syntax error or access violation: 1072 Key column 'source_id' doesn't exist in table "

Comments

khaldoon_masud created an issue. See original summary.

4kant’s picture

same here...

mikegodin’s picture

This is a long-standing incompatibility between Drupal 7 core and MySQL 5.7+, where a "serial", aka "auto_increment" column cannot be added to a table. There is a discussion, and a drupal core patch which resolves the problem for MySQL, but breaks PostgreSQL and SQLite.

DamienMcKenna’s picture

Thanks mikegodin!

izmeez’s picture

Thanks this helped point me in the right direction.