I just attempted to install the feeds: file module which includes this module as a dependency. I used drush to perform the install:

drush dl feeds_file

This prompted to download this file_entity module. I then executed

drush en feeds_file

which enabled both feeds_file and file_entity. I then executed

drush updb and got these results

The following updates are pending:

file_entity module :
7101 - Update all files with empty types to use the first part of filemime. For example, an png image with filemime 'imagepng' will be assigned a file type of 'image'.
7102 - Empty update function to trigger an entity cache rebuild.
7103 - Empty update function.
7104 - Assign view file permission when updating without the Media module.
7200 - Create the {image_dimensions} database table.
7201 - Add the {file_type}, {file_type_mimetypes} and {file_type_streams} tables.
7202 - Drupal 7.8 disallows empty string as the value for a bundle key, so update empty {file_managed}.type records to 'undefined' instead.
7203 - Update permission names.
7204 - Add title and alt text to image file types.

Do you wish to run all pending updates? (y/n): y
Performed update: file_entity_update_7101 [ok]
Performed update: file_entity_update_7102 [ok]
Performed update: file_entity_update_7103 [ok]
SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'module' cannot be null [error]
Performed update: file_entity_update_7104 [ok]
Finished performing updates.

I do not have the media module installed in this Drupal instance. So there is no conflict possible with that module. After getting this error. I did attempt to use the update.php feature through the browser in case it made a difference. However, I got the same integrity constraint violation error.

Comments

jlk4p’s picture

NOTE: I created a new Drupal site installation and installed the file_entity module first and then installed the feeds_file module and did not see this error in that instance. I did previously have the media module installed on the other Drupal instance but I had disabled it, uninstalled it, and deleted its directory. I'm wondering if some remnants of the media module caused the file_entity module to fail installation.

mrP’s picture

Status: Active » Closed (works as designed)

Its actually a problem with the user_role_grant_permissions() function in Drupal core -- see #737816: user_role_grant_permissions() throws PDOException when used with non-existent permissions (e.g. a permission for a disabled/uninstalled module). There is a patch for D7.22 in the same issue at comment #34.

One really easy workaround that doesn't involve patching core is to enable the media module since file_entity_update_7104 only has to do something if (!module_exists('media'))

jlk4p’s picture

Thank you for this explanation. I have applied the recommended patch to avoid this issue in the future.

vacilando’s picture

Version: 7.x-2.0-unstable7 » 7.x-2.0-alpha2
Status: Closed (works as designed) » Active

I have downloaded a fresh 7.x-2.0-alpha2, ran drush updatedb and got this error. Means file_entity_update_7104 has not executed nor any subsequent updates (currently through to file_entity_update_7215).

Seems like this needs solving, so setting this back to active state.

NB:
Running on Drupal 7.23.
Switching the Media module on to fix this is not a solution unless File Entity depended on Media.

mrP’s picture

Version: 7.x-2.0-alpha2 » 7.x-2.x-dev

Yeah, it could use some work.

file_entity_update_7104 should probably have a check to make sure that the 'view file' permission actually exists before trying to grant it.

I'm guessing in your case it doesn't.

devin carlson’s picture

Status: Active » Needs review
StatusFileSize
new808 bytes

This update hook was introduced in #1290634: Install view file permission to all roles by default.

Drupal core doesn't seem to use user_role_grant_permission() for the reasons outlined in this issue (a module could be disabled or the permissions could be renamed or removed).

It seems that manually altering the database is recommended, such as done in contact_update_7002(). The attached patch changes the update to add the role permissions manually.

devin carlson’s picture

Status: Needs review » Needs work

The last submitted patch, manually-add-role-permissions-1961466-6.patch, failed testing.

devin carlson’s picture

Status: Needs work » Needs review
devin carlson’s picture

The update should probably do a merge à la contact_update_7002() just in case the permission already exists.

devin carlson’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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