Problem/Motivation

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 {flexicolor_preset_selector} ( `machine` VARCHAR(32) DEFAULT NULL COMMENT 'Unique ID for environments.', `fpmachine` VARCHAR(32) DEFAULT NULL COMMENT 'Flexicolor Preset', `fsmachine` VARCHAR(32) DEFAULT NULL COMMENT 'Flexicolor Selector', `color` VARCHAR(7) NOT NULL COMMENT 'Preset Selector Color', PRIMARY KEY (`fpmachine`, `fsmachine`), UNIQUE KEY `name` (`machine`) ) ENGINE = InnoDB DEFAULT CHARACTER SET utf8 COMMENT 'Create a preset based on the selectors'; Array ( ) in db_create_table() (line 2803 of …/includes/database/database.inc).

Steps to reproduce

Install 2.x fresh, not through update.

Proposed resolution

Update schema.

Remaining tasks

User interface changes

API changes

Data model changes

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

TommyK created an issue. See original summary.

TommyK’s picture

Status: Active » Needs review
FileSize
1.5 KB

patch attached

TommyK’s picture

updated patch

guilhermevp’s picture

Status: Needs review » Needs work
FileSize
72.62 KB
27.11 KB
17.71 KB

I was able to reproduce the error and the patch do solves it. Also recommend that the fix is commited asap since it can generate a really nasty site break. But the patch has a minor issue that should be solved before commiting it, patch has a whitespace, where it should be clean. That being fixed, the patch is RTBC.

lint error

TommyK’s picture

Status: Needs work » Needs review
FileSize
1.46 KB

thanks for the whitespace note; I hadn't noticed when patching late at night

update attached

guilhermevp’s picture

Status: Needs review » Reviewed & tested by the community
FileSize
19.64 KB

Whitespaces are no more!

RTBC.

  • TommyK committed 3e55158 on 7.x-2.x
    Issue #3207539 by TommyK, guilhermevp: PRIMARY KEY parts must be NOT...
TommyK’s picture

Status: Reviewed & tested by the community » Fixed

thanks for the reviews! fix committed

Status: Fixed » Closed (fixed)

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