Needs review
Project:
Data
Version:
8.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
14 Oct 2017 at 16:54 UTC
Updated:
1 Feb 2018 at 10:14 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
alansaviolobo commentedThis line in TableConfig::createTable() is required to generate the correct sql
Comment #3
josebc commentedI'm facing something similar in the case of the primary key not being a serial "SQLSTATE[42000]: Syntax error or access violation: 1171 All parts of a PRIMARY KEY must be NOT NULL;"
Adding $table_definition['fields'][$field['name']]['not null'] = TRUE; in
if ($field['primary']) {
$primary_keys[] = $field['name'];
$table_definition['fields'][$field['name']]['not null'] = TRUE;
}
fixes the issue, however I think the UI should allow for adding "NOT NULL" columns
Comment #4
josebc commentedPatch to add option for not null
Comment #5
joachim commentedIs that the right place for this? It's only getting added if the field's a primary key AFAICT.
Comment #6
josebc commentedThis is more like a fallback to make sure no "All parts of a PRIMARY KEY must be NOT NULL" happen in case PK its not set to NOT NULL from UI, the ones added from there are added from
+ 'not null' => $field['not_null'],
Not sure if its the best way to do it though