Closed (fixed)
Project:
Drupal core
Version:
8.6.x-dev
Component:
database system
Priority:
Major
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
16 Nov 2015 at 21:04 UTC
Updated:
25 Jul 2018 at 14:14 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
catchComment #3
effulgentsia commentedComment #5
daffie commentedMost if not all primary keys are of the serial type. Does anybody know if there are primary keys that are not of the serial type?
Comment #6
chx commentedEdited: deleted. This was solely an api.drupal.org link but I have confidence in the good developers of Drupal core that they would find a way to get insulted even by that so I deleted it.
Comment #11
daffie commentedThis patch should fix the testbot fail for the new MySQL 5.7 environment.
Comment #12
daffie commentedSecond try.
Comment #13
daffie commentedThird try.
Comment #14
amateescu commentedI've been working on this as well from the angle of the initial scope, which is to throw our own db schema exception when a user tries to define a primary key without
'not null' => TRUE.The "fail" patch shows the new exception being thrown, and the "pass" one includes the fixes from #13 :)
Comment #15
daffie commented@amateescu: I like your idea with the added method to make sure that every primary key does have a allows null value. What I miss is tests where the thrown exception is caught.
Comment #16
amateescu commentedThe new exception is not meant to be caught by default, it's simply there to provide a friendlier message to module authors :)
Comment #18
daffie commentedComment #19
amateescu commentedThis should fix the sqlite driver by making its schema introspection return the proper 'not null' status of a field if it's part of the primary key.
Comment #20
amateescu commented@daffie, sorry, I didn't understand your request from #15 at first read :/ Here's full test coverage for the exception, which already caught a bug in the pgsql implementation.
Comment #21
daffie commentedYou have made the same changes as I did to the SchemaTest class to fix the problem for MySQL 5.7.
I like your idea for throwing exception when a primary key field does not have the is not null option set.
You have added the by me requested tests.
I all looks good now to me.
For me it is RTBC.
Great work @amateescu.
Comment #23
catchCommitted 72cd973 and pushed to 8.6.x. Thanks!