Score:0

Migrating URLs without titles into a link field (where the link title is optional) without them becoming NULL

ph flag

I'm migrating URLs that don't have corresponding titles into a link field, and when I either don't define the title, or use the default_value plugin to set the default value to '', the value actually gets set to NULL, instead of an empty string, which breaks my link formatter, that expects link titles to be strings (even if the strings are empty):

    process:
      field_link/title:
        - plugin: default_value
          default_value: ''

How can I insert the titles as an empty string, instead of NULL?

Score:3
ph flag

I found the solution was to create an empty string as a constant, in the migration source, and then reference that:

source:
  constants:
    empty: ''

process:
  field_link/title: constants/empty
Jaypan avatar
de flag
Nice post, thank you for sharing.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.