Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
Problem/Motivation
When enabling flag_lists, it fails with `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`. Must be specific to a mysql version or settings for it not to have been a problem yet? I'm using version `mysql Ver 14.14 Distrib 5.7.17, for Linux (x86_64)`.
Proposed resolution
Patch attached.
Remaining tasks
Needs review.
User interface changes
None.
API changes
None.
Data model changes
None.
Comment | File | Size | Author |
---|---|---|---|
#6 | flag_lists-mysql_install_primary_null_error-2859609-6.patch | 780 bytes | sl27257 |
#2 | flag_lists-mysql_install_primary_null_error-2859609-2.patch | 403 bytes | kimberleycgm |
Comments
Comment #2
kimberleycgmComment #3
kimberleycgmChanging the schema of flag_lists_types to set the type field to not null allows the module to be installed, and it already has the default set so I don't think this will cause issues anywhere else?
Comment #4
kimberleycgmComment #5
sl27257Thanks!
Will look into it :)
BR
/Thomas
Comment #6
sl27257I have now added an update of an existing database as well.
Comment #7
patoshi CreditAttribution: patoshi commentedstill getting the same error on the latest mar-2017 dev version:
http://prntscr.com/ggztvt
The following extensions will be enabled: flag_lists
Do you really want to continue? (y/n): y
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 in /var/www/hotsite_d7/docroot/includes/database/database.inc:2227 [error]
Stack trace:
#0 /var/www/hotsite_d7/docroot/includes/database/database.inc(2227): PDOStatement->execute(Array)
#1 /var/www/hotsite_d7/docroot/includes/database/database.inc(697): DatabaseStatementBase->execute(Array, Array)
#2 /var/www/hotsite_d7/docroot/includes/database/schema.inc(667): DatabaseConnection->query('CREATE TABLE {f...')
#3 /var/www/hotsite_d7/docroot/includes/database/database.inc(2776): DatabaseSchema->createTable('flag_lists_type...', Array)
#4 /var/www/hotsite_d7/docroot/includes/common.inc(7114): db_create_table('flag_lists_type...', Array)
#5 /var/www/hotsite_d7/docroot/includes/module.inc(479): drupal_install_schema('flag_lists')
#6 /vendor/drush/drush/commands/core/drupal/environment_7.inc(143): module_enable(Array)
#7 /vendor/drush/drush/commands/pm/pm.drush.inc(1167): drush_module_enable(Array)
#8 /vendor/drush/drush/includes/command.inc(422): drush_pm_enable('flag_lists')
#9 /vendor/drush/drush/includes/command.inc(231): _drush_invoke_hooks(Array, Array)
#10 /vendor/drush/drush/includes/command.inc(199): drush_command('flag_lists')
#11 /vendor/drush/drush/lib/Drush/Boot/BaseBoot.php(67): drush_dispatch(Array)
#12 /vendor/drush/drush/includes/preflight.inc(66): Drush\Boot\BaseBoot->bootstrap_and_dispatch()
#13 /vendor/drush/drush/drush.php(12): drush_main()
#14 {main}
Comment #9
sl27257Thanks for the reminder!
Pushed!
BR
/Thomas
Comment #10
sl27257Changing status
Comment #12
sl27257