Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
While upgrading via drush to the latest stable I encountered the following 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 [error]
Performed update: system_update_7061 [ok]
This error was encountered with:
- php 5.5.31
- mysql 5.7.10
Comment | File | Size | Author |
---|---|---|---|
#2 | upgrade_fails_mysql57-2665362-2.patch | 638 bytes | msti |
Comments
Comment #2
mstiMysql 5.7.3 adds significant changes: http://dev.mysql.com/doc/relnotes/mysql/5.7/en/news-5-7-3.html
This patch adds a
'not null' => TRUE
to the database fieldComment #3
SuneK CreditAttribution: SuneK commentedThis is also present in Drupal 7.43 when upgrading from Drupal 6. With PHP 5.6.20 and MySQL 5.7.9.1 I get
PDOException: 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: CREATE TABLE {system_update_7061} ( `vid` INT DEFAULT NULL, PRIMARY KEY (`vid`) ) ENGINE = InnoDB DEFAULT CHARACTER SET utf8 COMMENT 'Stores temporary data for system_update_7061.'; Array ( ) in db_create_table() (line 2720 of D:\Drupal\includes\database\database.inc).
for system_update_7061.
In my case I solved it by changing line 2796 of system.install to
Comment #4
gregglesThis patch looks good to me. It is probably also important/necessary to add #2615496: A serial/primary key field can not be added to an existing table for some databases to fully fix this problem.
Comment #5
mfbThere's a RTBC duplicate @ #2981248: MySQL 5.7 incompatibility in system upgrade 7061
Comment #6
mfbTests are passing on MySQL 5.7 so setting to RTBC.
Comment #7
joseph.olstadthis didn't make it into 7.60, bumping to 7.61
Comment #8
joseph.olstadclosing in favour of:
Comment #9
PolThis has been fixed in 7.x today.
Thanks all.
Comment #10
joseph.olstadC'est moi qui te remercie, Bonne année Pol!