Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
File fields required 'display' and 'description' otherwise they throw a fatal error at the database layer when being saved. This prevents the entire node being saved.
Running d6_cck_field_values:story [ok]
SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'field_file_display' cannot be null: INSERT INTO {node__field_file} (entity_id, [error]
revision_id, bundle, delta, langcode, field_file_target_id, field_file_display, field_file_description) 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); Array
(
[:db_insert_placeholder_0] => 2
[:db_insert_placeholder_1] => 2
[:db_insert_placeholder_2] => story
[:db_insert_placeholder_3] => 0
[:db_insert_placeholder_4] => und
[:db_insert_placeholder_5] => 3
[:db_insert_placeholder_6] =>
[:db_insert_placeholder_7] =>
)
(/Users/bendougherty/Sites/d8/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php:913)
Proposed resolution
We need to have per field processing for the file field, we're already introducing something similar for links in #2233883: Link migration needs to convert source url into the appropriate route format for storage
Remaining tasks
Add a test.
User interface changes
API changes
Comment | File | Size | Author |
---|---|---|---|
#10 | interdiff.txt | 1.79 KB | benjy |
#10 | 2394567-10.patch | 8.38 KB | benjy |
#9 | interdiff.txt | 7.4 KB | benjy |
#9 | 2394567-9.patch | 8.02 KB | benjy |
#7 | 2394567-6.patch | 1.96 KB | benjy |
Comments
Comment #1
benjy CreditAttribution: benjy commentedThis patch won't apply until #2233883: Link migration needs to convert source url into the appropriate route format for storage lands.
Comment #2
benjy CreditAttribution: benjy commentedComment #4
eliza411 CreditAttribution: eliza411 commentedWhen I try to apply this to 8.0.x (3359738e), it won't apply cleanly and says:
error: core/modules/migrate_drupal/src/Plugin/migrate/process/d6/CckFile.php: No such file or directory
Comment #5
benjy CreditAttribution: benjy commentedJust needed a re-roll now the link patch has gone in.
Comment #7
benjy CreditAttribution: benjy commentedTry again.
Comment #8
benjy CreditAttribution: benjy commentedComment #9
benjy CreditAttribution: benjy commentedNew patch attached fixes a few issues and updates the dumps so we can add a test.
Comment #10
benjy CreditAttribution: benjy commentedUpdates so we now have support for both the contrib filefield module and core's file attachments, plus an extra test for the target id.
I did however find that the upload field migrations aren't working, opened: #2400827: D6->D8 Upload Field Migrations not working
Comment #11
chx CreditAttribution: chx commentedThat looks good.
Comment #12
alexpottMigrate is not frozen in beta. Committed 41a3319 and pushed to 8.0.x. Thanks!