After upgrading to 1.13 I am getting some problems on my local setup when doing drush si for my child distro.

WD php: Notice: Undefined index: delete terms in         [notice]
employee_type in user_role_grant_permissions() (line             
3111 of                                                          
/home/codio/workspace/modules/user/user.module).                 
exception 'PDOException' with message                 [error]    
'SQLSTATE[23000]: Integrity constraint violation: 1048           
Column 'module' cannot be null' in                               
/home/codio/workspace/includes/database/database.inc:2171        
Stack trace:                                                     
#0                                                               
/home/codio/workspace/includes/database/database.inc(2171):      
PDOStatement->execute(Array)                                     
#1                                                               
/home/codio/workspace/includes/database/database.inc(683):       
DatabaseStatementBase->execute(Array, Array)                     
#2                                                               
/home/codio/workspace/includes/database/mysql/query.inc(36):     
DatabaseConnection->query('INSERT INTO {ro...', Array,           
Array)

It is related to defaultconfig user permissions. If I comment out all the permissions in my modules the error goes away. However, before upgrading I was able to succesfully build it all.

Comments

lsolesen’s picture

Status: Active » Fixed

Seems to be caused by accidentally downloading drush 7 when setting up a new box.

lsolesen’s picture

Status: Fixed » Active

Hm, seems it is also the case using drush 6.

WD php: PDOException: SQLSTATE[23000]: Integrity      [error]    
constraint violation: 1048 Column 'module' cannot be             
null: INSERT INTO {role_permission} (rid, permission,            
module) VALUES (:db_insert_placeholder_0,                        
:db_insert_placeholder_1, :db_insert_placeholder_2);             
Array                                                            
(                                                                
    [:db_insert_placeholder_0] => 3                              
    [:db_insert_placeholder_1] => delete terms in                
employee_type                                                    
    [:db_insert_placeholder_2] =>                                
)                                                                
 in user_role_grant_permissions() (line 3113 of                  
/home/codio/workspace/modules/user/user.module).                 
WD php: Warning: Cannot modify header information -   [warning]  
headers already sent by (output started at                       
/home/codio/drush/includes/output.inc:38) in                     
drupal_send_headers() (line 1224 of                              
/home/codio/workspace/includes/bootstrap.inc).                   
PDOException: SQLSTATE[23000]: Integrity constraint violation: 10
48 Column 'module' cannot be null: INSERT INTO {role_pe
rmission} (rid, permission, module) VALUES (:db_insert_placeholde
r_0, :db_insert_placeholder_1, :db_insert_placeholder_2); Array  
(                                                                
    [:db_insert_placeholder_0] => 3                              
    [:db_insert_placeholder_1] => delete terms in employee_type  
    [:db_insert_placeholder_2] =>                                
)                                                                
 in user_role_grant_permissions() (line 3113 of /home/codio/works
pace/modules/user/user.module).                                  
Drush command terminated abnormally due to an         [error]    
unrecoverable error.
lsolesen’s picture

I tried cloning the most recent defaultconfig and only applied this patch: https://www.drupal.org/files/issues/defaultconfig-rebuild-2008178-9.patch. That fixed it for me.

Though that gives me a lot of warnings afterwards with permissions not defined.

dsnopek’s picture

Is the module that has the defaultconfig for those permissions the same module that is declaring the permissions (ie. declaring the "employee_type" taxonomy)?

This error is usually caused by Features trying to set the permissions with defaultconfig BEFORE creating the thing that defines the permission (ie. the taxonomy). In Panopoly, we've had to work around this in a couple places, for example, Panelizer permissions in panopoly_pages (see panopoly_pages_modules_enabled()).

Anyway, if that is the case, the really weird thing is how it worked for you before the update! Maybe it's because of the update to Features 2.2? Can you try downgrading Features to 2.0 and seeing if that fixes drush si?

lsolesen’s picture

employee_type taxonomy is in the same module. Downgrading to features 2.0 does not seem to solve the issue. Also it does not seem to be reproduced on my tests?

https://travis-ci.org/vih/vih-build/jobs/39525956#L614

dsnopek’s picture

employee_type taxonomy is in the same module.

Ok, in this case, I think you need to do the same thing that panopoly_pages is doing for Panelizer permissions: setting those permissions in hook_modules_enabled(). I don't know any other solution to this problem, otherwise I would have used it in panopoly_pages. ;-)

See panopoly_pages_modules_enabled() for an example of how to do this:

http://cgit.drupalcode.org/panopoly_pages/tree/panopoly_pages.module

dsnopek’s picture

Status: Active » Postponed (maintainer needs more info)

This sounds suspiciously like this issue which has a patch: #2183937: Error on install of Panopoly-based install profile: "Column 'module' cannot be null" when profile starts with "e"

Can you try with the latest Panopoly and that patch and let us know if this is still happening? Thanks!

EDIT: Sorry, it's not fixed yet, but it has a patch.

dsnopek’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)

No response for a long time! Closing for now, but feel free to re-open if you add them.