Last active
March 21, 2020 06:08
-
-
Save jordanlgraham/79f963187debb2ea66090fd87ffc15ae to your computer and use it in GitHub Desktop.
This file contains hidden or 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
diff --git a/docroot/modules/contrib/paragraphs/paragraphs.install b/docroot/modules/contrib/paragraphs/paragraphs.install | |
index 1ab331447..3accef3bb 100644 | |
--- a/docroot/modules/contrib/paragraphs/paragraphs.install | |
+++ b/docroot/modules/contrib/paragraphs/paragraphs.install | |
@@ -220,6 +220,29 @@ function paragraphs_update_8013() { | |
$definition_update_manager = \Drupal::entityDefinitionUpdateManager(); | |
$entity_type = $definition_update_manager->getEntityType('paragraph'); | |
+ // Update the field storage definitions of the parent fields | |
+ // as done in 8019. | |
+ $last_installed_schema = \Drupal::service('entity.last_installed_schema.repository'); | |
+ foreach (['parent_id', 'parent_type', 'parent_field_name'] as $field_name) { | |
+ $column_schema = [ | |
+ 'type' => 'varchar_ascii', | |
+ 'length' => $field_name == 'parent_id' ? 255 : 32, | |
+ 'binary' => FALSE, | |
+ 'not null' => FALSE, | |
+ ]; | |
+ // Update the field storage repository. | |
+ $storage_definition = $definition_update_manager->getFieldStorageDefinition($field_name, 'paragraph'); | |
+ $storage_definition->setRevisionable(TRUE); | |
+ $last_installed_schema->setLastInstalledFieldStorageDefinition($storage_definition); | |
+ | |
+ // Update the stored field schema. | |
+ // @todo: There has to be a better way to do this. | |
+ $key = 'paragraph.field_schema_data.' . $field_name; | |
+ $field_schema = \Drupal::keyValue('entity.storage_schema.sql')->get($key); | |
+ $field_schema['paragraphs_item_revision_field_data']['fields'][$field_name] = $column_schema; | |
+ \Drupal::keyValue('entity.storage_schema.sql')->set($key, $field_schema); | |
+ } | |
+ | |
// Update the revision metadata keys to remove revision uid which is removed | |
// in 8017 and 8021. | |
if ($metadata_keys = $entity_type->get('revision_metadata_keys')) { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment