Created
May 29, 2018 14:02
-
-
Save hudri/2731c8184c050c724be5f5aa8b577abb to your computer and use it in GitHub Desktop.
Drupal 8: Insert default values for in newly added paragraphs fields
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
insert into paragraph__FIELD_NEWFIELD (bundle, deleted, entity_id, revision_id, langcode, delta, FIELD_NEWFIELD_value) | |
select type, 0, id, revision_id, langcode, 0, DEFAULT_FIELD_VALUE from paragraphs_item where type = 'PARENT_PARAGRAPH_TYPE'; | |
insert into paragraph_revision__FIELD_NEWFIELD (bundle, deleted, entity_id, revision_id, langcode, delta, FIELD_NEWFIELD_value) | |
select type, 0, id, revision_id, langcode, 0, DEFAULT_FIELD_VALUE from paragraphs_item where type = 'PARENT_PARAGRAPH_TYPE' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
do this ONCE IMMEDTIALY after creating adding the new field to the paragraph. no security checks at all. not tested with multi cardinality, multi language or multi revisions.