The following error is thrown when I run the "upgrade_d7_file_entity_image" migration:
Drupal\Core\Database\IntegrityConstraintViolationException: SQLSTATE[23000]: Integrity constraint violation: [error]
1048 Column 'status' cannot be null: INSERT INTO {media_field_data} (mid, vid, bundle, langcode, status,
name, thumbnail__target_id, thumbnail__alt, thumbnail__title, thumbnail__width, thumbnail__height, uid,
created, changed, default_langcode, revision_translation_affected) VALUES (:db_insert_placeholder_0,
:db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4,
:db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8,
:db_insert_placeholder_9, :db_insert_placeholder_10, :db_insert_placeholder_11, :db_insert_placeholder_12,
:db_insert_placeholder_13, :db_insert_placeholder_14, :db_insert_placeholder_15); Array
(
[:db_insert_placeholder_0] => 461
[:db_insert_placeholder_1] => 461
[:db_insert_placeholder_2] => image
[:db_insert_placeholder_3] => en
[:db_insert_placeholder_4] =>
[:db_insert_placeholder_5] => featured-item.png
[:db_insert_placeholder_6] => 461
[:db_insert_placeholder_7] =>
[:db_insert_placeholder_8] =>
[:db_insert_placeholder_9] => 820
[:db_insert_placeholder_10] => 250
[:db_insert_placeholder_11] => 0
[:db_insert_placeholder_12] =>
[:db_insert_placeholder_13] => 1561057011
[:db_insert_placeholder_14] => 1
[:db_insert_placeholder_15] => 1
)
in Drupal\Core\Database\Connection->handleQueryException() (line 683 of core/lib/Drupal/Core/Database/Connection.php).
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | 3063113-fix_status_field_mapping-2.patch | 1.91 KB | slv_ |
Comments
Comment #2
slv_ commentedI also experienced this recently and looked into it. The problem here comes from the default mapping at "migrations/d7_file_entity.yml":
"Status" is mapped to the "published" field, which is not really present in default drupal setups, nor added by entity_file. It's only present when https://www.drupal.org/project/file_admin is on the Drupal 7 installation. Same happens with the "created" column. That module has a rather low adoption, so the default mapping for those two fields should be:
Aside of the mapping, I've updated the `fields()` method in the source plugin to specify that certain fields are only available if the file_admin module is present in the Drupal 7 installation. No other work done to use one or the other automatically, I think supporting that module out of the box is out of the scope of this task.
Patch attached!
Comment #3
slv_ commentedComment #5
juampynr commentedCommitted. Thanks!