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.
Please credit contributors to duplicate issue #2405017: Cannot migrate boolean fields of type text
Problem/Motivation
When migrating I'm seeing the following exceptions on what seems to be every insert for this field.
Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[22007]: [error]
Invalid datetime format: 1366 Incorrect integer value: 'No' for
column 'field_featured_content_value' at row 1: INSERT INTO
{node__field_featured_content} (entity_id, revision_id, bundle,
delta, langcode, field_featured_content_value) 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); Array
(
[:db_insert_placeholder_0] => 31406
[:db_insert_placeholder_1] => 31840
[:db_insert_placeholder_2] => mytype
[:db_insert_placeholder_3] => 0
[:db_insert_placeholder_4] => und
[:db_insert_placeholder_5] => No
)
Not 100% sure what the problem is. Obviously the datetime type check makes no sense. My guess is that its related to this field using the feature of allowed values that allows you to supply only keys and they will be translated into keys and values. Allowed values for this field:
No
Featured
Proposed resolution
?
Remaining tasks
?
User interface changes
?
API changes
?
Data model changes
None
Commit Credit
@phenaproxima, @neclimdul, @benjy, @svendecabooter
Comment | File | Size | Author |
---|---|---|---|
#19 | 2588827-19.patch | 12.9 KB | phenaproxima |
#5 | 2588827-5.patch | 18.36 KB | phenaproxima |
#2 | cck_migrations_seem_to-2588827-2.patch | 14.01 KB | neclimdul |
|
Comments
Comment #2
neclimdulLets see if this triggers the error.
Has #2588421: CckLinks double unserialized attributes array changes because they'll conflict.
Comment #4
neclimdulExceptions, lost data, failed migrations, easily triggered. Going to bump to major.
Comment #5
phenaproximaHopefully this will help.
Comment #7
phenaproximaWho wrote that annoying "one more time" song? The one with the auto-tune?
Was it Cher?(It was Daft Punk. Thanks, @neclimdul)Comment #9
neclimdulInterdiff is a little weird but just removing unrelated automated changes to the database. Things that happened as a result of making changes in the UI but where being asserted and aren't related to this patch.
Note, this is RTBC in my opinion. It fixed the failures in our migration.
Comment #10
mikeryanI had hoped to test this manually with a D7 site that has a boolean user field, but unfortunately user fields are not yet supported in the D7 migration. Code looks good though, so RTBC.
Comment #14
benjy CreditAttribution: benjy at PreviousNext commentedI closed #2405017: Cannot migrate boolean fields of type text as a duplicate, it would be good if we could credit svendecabooter here for working on that issue.
This is similar to what i meant on IRC, once we start manually manipulating the dumps, we can't truly say the database exactly represents what Drupal 6 could look like.
NW because we need some tests here.
Comment #15
benjy CreditAttribution: benjy at PreviousNext commentedComment #16
phenaproximaRe-added the test from #7.
Comment #17
benjy CreditAttribution: benjy at PreviousNext commentedLooks good, just one thing:
I think we could do without this block entirely?
Comment #18
phenaproximaWe need to keep that because we need some way to get the process array out of the mock migration (processCckFieldValues() alters the migration directly and does not return a value). Granted, we could just use a real migration entity instead of a prophesied mock, but since this is a unit test I'd rather reduce the number of x-factors that could potentially influence the outcome. :)
Comment #19
phenaproximaAdded a comment to the test explaining the slightly strange thing we're doing with the mock. (Since no actual code was changed, I'm leaving out the interdiff due to changes merged into the D6 fixture.)
Comment #20
neclimdulAwesome!
Comment #22
neclimdulRemoving some files from the active list so they don't get tested.
Comment #25
phenaproximaComment #27
webchickCommitted and pushed to 8.0.x. Thanks!