Fix NOT NULL handling in the entity storage and 'primary key' changes when updating the storage definition of an identifier field