When updating to 8.5.1 from 8.4.5/8.4.6, the block_content update 4800 does not run. NO matter how many times I tried to run update.php, I still can not see the new field added to the database.
And always see what's in the attached images.

oh, and my custom blocks can not be seen except by an admin.

the modules I have installed are the following:

----------------------- ----------------------------------------------------------------------- --------- ---------------- 
  Package                 Name                                                                    Status    Version         
 ----------------------- ----------------------------------------------------------------------- --------- ---------------- 
  Core                    Actions (action)                                                        Enabled   8.5.1           
  Custom                  Add Error Pages (add_error_pages)                                       Enabled                   
  Field types             Address (address)                                                       Enabled   8.x-1.3         
  Administration          Admin Toolbar (admin_toolbar)                                           Enabled   8.x-1.23        
  Administration          Admin Toolbar Extra Tools (admin_toolbar_tools)                         Enabled   8.x-1.23        
  Core                    Aggregator (aggregator)                                                 Enabled   8.5.1           
  Core                    Automated Cron (automated_cron)                                         Enabled   8.5.1           
  Core                    Ban (ban)                                                               Enabled   8.5.1           
  Core                    BigPipe (big_pipe)                                                      Enabled   8.5.1           
  Core                    Block (block)                                                           Enabled   8.5.1           
  Core                    Custom Block (block_content)                                            Enabled   8.5.1           
  Layout                  Bootstrap Layouts (bootstrap_layouts)                                   Enabled   8.x-5.1         
  Core                    Breakpoint (breakpoint)                                                 Enabled   8.5.1           
  Custom                  Cart Empty Page Template Edit (cart_empty_page_template_edit)           Enabled                   
  Core                    CKEditor (ckeditor)                                                     Enabled   8.5.1           
  Clientside Validation   Clientside Validation (clientside_validation)                           Enabled                   
  Clientside Validation   Clientside Validation jQuery (clientside_validation_jquery)             Enabled                   
  Core                    Color (color)                                                           Enabled   8.5.1           
  Core                    Comment (comment)                                                       Enabled   8.5.1           
  Commerce                Commerce (commerce)                                                     Enabled                   
  Commerce (contrib)      Commerce Agree to Terms (commerce_agree_terms)                          Enabled   8.x-1.x-dev     
  Commerce                Commerce Cart (commerce_cart)                                           Enabled                   
  Commerce                Commerce Cart Blocks (commerce_cart_blocks)                             Enabled   8.x-1.x         
  Commerce                Commerce Checkout (commerce_checkout)                                   Enabled                   
  Custom                  Commerce Email Change (commerce_email_change)                           Enabled   1               
  Commerce                Commerce Log (commerce_log)                                             Enabled                   
  Commerce                Commerce Order (commerce_order)                                         Enabled                   
  Costum (contrib)        Commerce other services (commerce_other_services)                       Enabled                   
  Commerce                Commerce Payment (commerce_payment)                                     Enabled                   
  Commerce (contrib)      Commerce PayPal (commerce_paypal)                                       Enabled   8.x-1.0-beta1   
  Commerce                Commerce Price (commerce_price)                                         Enabled                   
  Commerce                Commerce Product (commerce_product)                                     Enabled                   
  Commerce                Commerce Promotion (commerce_promotion)                                 Enabled                   
  Commerce                Commerce Store (commerce_store)                                         Enabled                   
  Commerce                Commerce Tax (commerce_tax)                                             Enabled                   
  Core                    Configuration Manager (config)                                          Enabled   8.5.1           
  Multilingual            Configuration Translation (config_translation)                          Enabled   8.5.1           
  Core                    Contact (contact)                                                       Enabled   8.5.1           
  Other                   Contact storage (contact_storage)                                       Enabled   8.x-1.0-beta9   
  Custom                  Contact Storage Export (contact_storage_export)                         Enabled   8.x-1.11        
  Custom                  Contact Us Email Change (contact_us_email_change)                       Enabled   1               
  Multilingual            Content Translation (content_translation)                               Enabled   8.5.1           
  Core                    Contextual Links (contextual)                                           Enabled   8.5.1           
  Community               Contribute (contribute)                                                 Enabled   8.x-1.0-beta7   
  Custom                  Copyright (copyright)                                                   Enabled   1               
  Web services            Serialization (CSV) (csv_serialization)                                 Enabled   8.x-1.3         
  Chaos tool suite        Chaos tools (ctools)                                                    Enabled   8.x-3.0         
  Field types             Datetime (datetime)                                                     Enabled   8.5.1           
  Core                    Database Logging (dblog)                                                Enabled   8.5.1           
  Development             Devel (devel)                                                           Enabled   8.x-1.2         
  Display Suite           Display Suite (ds)                                                      Enabled   8.x-3.1         
  Display Suite           Display Suite Switch View Mode (ds_switch_view_mode)                    Enabled   8.x-3.1         
  Field types             Dynamic Entity Reference (dynamic_entity_reference)                     Enabled   8.x-1.5         
  Core                    Internal Dynamic Page Cache (dynamic_page_cache)                        Enabled   8.5.1           
  Core                    Text Editor (editor)                                                    Enabled   8.5.1           
  Other                   Embed (embed)                                                           Enabled   8.x-1.0         
  Other                   Entity (entity)                                                         Enabled   8.x-1.0-beta1   
  Filters                 Entity Embed (entity_embed)                                             Enabled                   
  Other                   Entity Legal (entity_legal)                                             Enabled   8.x-2.0-beta1   
  Field types             Entity Reference Revisions (entity_reference_revisions)                 Enabled   8.x-1.4         
  Core                    Field (field)                                                           Enabled   8.5.1           
  Core                    Field UI (field_ui)                                                     Enabled   8.5.1           
  Field types             File (file)                                                             Enabled   8.5.1           
  Core                    Filter (filter)                                                         Enabled   8.5.1           
  Statistics              Google Analytics (google_analytics)                                     Enabled   8.x-2.2         
  Statistics              Google Tag Manager (google_tag)                                         Enabled   8.x-1.0         
  Core                    Help (help)                                                             Enabled   8.5.1           
  Core                    History (history)                                                       Enabled   8.5.1           
  Spam control            Honeypot (honeypot)                                                     Enabled   8.x-1.27        
  Other                   HTTP Response Headers (http_response_headers)                           Enabled   8.x-2.0-alpha1  
  Field types             Image (image)                                                           Enabled   8.5.1           
  Media                   Imce File Manager (imce)                                                Enabled   8.x-1.6         
  Fields                  Inline Entity Form (inline_entity_form)                                 Enabled   8.x-1.0-beta1   
  Security                Key (key)                                                               Enabled   8.x-1.7         
  Development             Devel Kint (kint)                                                       Enabled   8.x-1.2         
  Multilingual            Language (language)                                                     Enabled   8.5.1           
  Core                    Layout Discovery (layout_discovery)                                     Enabled   8.5.1           
  Field types             Link (link)                                                             Enabled   8.5.1           
  Custom                  Linkit (linkit)                                                         Enabled   8.x-5.0-beta6   
  Multilingual            Interface Translation (locale)                                          Enabled   8.5.1           
  Other                   Login with email or username (login_emailusername)                      Enabled                   
  Mail                    Mail System (mailsystem)                                                Enabled   8.x-4.1         
  Media                   Media entity (media_entity)                                             Enabled   8.x-1.7         
  Media                   Media entity image (media_entity_image)                                 Enabled   8.x-1.2         
  Core                    Custom Menu Links (menu_link_content)                                   Enabled   8.5.1           
  Core                    Menu UI (menu_ui)                                                       Enabled   8.5.1           
  SEO                     Metatag (metatag)                                                       Enabled   8.x-1.4         
  SEO                     Metatag: Facebook (metatag_facebook)                                    Enabled   8.x-1.4         
  SEO                     Metatag: favicons (metatag_favicons)                                    Enabled   8.x-1.4         
  SEO                     Metatag: Google Plus (metatag_google_plus)                              Enabled   8.x-1.4         
  SEO                     Metatag: Mobile & UI Adjustments (metatag_mobile)                       Enabled   8.x-1.4         
  SEO                     Metatag: Open Graph (metatag_open_graph)                                Enabled   8.x-1.4         
  SEO                     Metatag: Open Graph Products (metatag_open_graph_products)              Enabled   8.x-1.4         
  SEO                     Metatag: Twitter Cards (metatag_twitter_cards)                          Enabled   8.x-1.4         
  SEO                     Metatag: Views (metatag_views)                                          Enabled   8.x-1.4         
  Field types             Mobile Number (mobile_number)                                           Enabled                   
  Custom                  Moderator Dashboard (moderator_dashboard)                               Enabled                   
  Core                    Node (node)                                                             Enabled   8.5.1           
  Field types             Options (options)                                                       Enabled   8.5.1           
  Core                    Internal Page Cache (page_cache)                                        Enabled   8.5.1           
  Layout                  Page Manager (page_manager)                                             Enabled   8.x-4.0-beta2   
  Layout                  Page Manager UI (page_manager_ui)                                       Enabled   8.x-4.0-beta2   
  Panels                  Panels (panels)                                                         Enabled   8.x-4.2         
  Core                    Path (path)                                                             Enabled   8.5.1           
  Input filters           Pathologic (pathologic)                                                 Enabled                   
  Other                   Paypal Currency Exchange (paypal_currency_exchange)                     Enabled                   
  Other                   Persistent Login (persistent_login)                                     Enabled   8.x-1.0-alpha4  
  Multilingual            Translation template extractor (potx)                                   Enabled   8.x-1.x-dev     
  Administration          Password Reset Landing Page (PRLP) (prlp)                               Enabled   8.x-1.3         
  Other                   Profile (profile)                                                       Enabled   8.x-1.0-rc1     
  Core                    RDF (rdf)                                                               Enabled   8.5.1           
  Registration            Registration Role (registration_role)                                   Enabled   8.x-1.0-beta1   
  Custom                  Remove Generator (remove_generator)                                     Enabled                   
  Custom                  Remove Localtask Persistent Login (remove_localtask_persistent_login)   Enabled   1               
  Core                    Responsive Image (responsive_image)                                     Enabled   8.5.1           
  Core                    Search (search)                                                         Enabled   8.5.1           
  Security                Security Review (security_review)                                       Enabled                   
  Custom                  Send SMS Mail (send_sms_mail)                                           Enabled                   
  Web services            Serialization (serialization)                                           Enabled   8.5.1           
  Core                    Shortcut (shortcut)                                                     Enabled   8.5.1           
  SMS Framework           SMS Framework (sms)                                                     Enabled   8.x-1.1         
  SMS Framework           SMS Blast (sms_blast)                                                   Enabled   8.x-1.1         
  SMS Framework           SMS Devel (sms_devel)                                                   Enabled   8.x-1.1         
  SMS Framework           Mobilyws for SMS Framework (sms_mobilyws)                               Enabled   8.x-1.1         
  SMS Framework           Send to phone (sms_sendtophone)                                         Enabled   8.x-1.1         
  SMS Framework           SMS User (sms_user)                                                     Enabled   8.x-1.1         
  Other                   Social Media Links Block (social_media_links)                           Enabled   8.x-2.6         
  Other                   State Machine (state_machine)                                           Enabled   8.x-1.0-beta3   
  Custom                  Strip Preview Button (strip_preview_button)                             Enabled                   
  Mail                    Swift Mailer (swiftmailer)                                              Enabled   8.x-1.0-beta2   
  Core                    System (system)                                                         Enabled   8.5.1           
  Core                    Taxonomy (taxonomy)                                                     Enabled   8.5.1           
  Field types             Telephone (telephone)                                                   Enabled   8.5.1           
  Custom                  Termsofuse User Registeration (termsofuse_user_registeration)           Enabled   1               
  Field types             Text (text)                                                             Enabled   8.5.1           
  Other                   Token (token)                                                           Enabled                   
  Core                    Toolbar (toolbar)                                                       Enabled   8.5.1           
  Core                    Tour (tour)                                                             Enabled   8.5.1           
  Other                   Typed Data (typed_data)                                                 Enabled                   
  Core                    Update Manager (update)                                                 Enabled   8.5.1           
  Core                    User (user)                                                             Enabled   8.5.1           
  Custom                  User Email Change (user_email_change)                                   Enabled   1               
  Video Embed Field       Video Embed Field (video_embed_field)                                   Enabled   8.x-1.5         
  Video Embed Field       Video Embed Media (video_embed_media)                                   Enabled   8.x-1.5         
  Video Embed Field       Video Embed WYSIWYG (video_embed_wysiwyg)                               Enabled   8.x-1.5         
  Core                    Views (views)                                                           Enabled   8.5.1           
  Views                   Views Bootstrap (views_bootstrap)                                       Enabled   8.x-3.0         
  Views                   Views Bulk Operations (views_bulk_operations)                           Enabled   8.x-2.0         
  Views                   Views Link Area (views_linkarea)                                        Enabled   8.x-1.0-beta1   
  Core                    Views UI (views_ui)                                                     Enabled   8.5.1           
  Webform                 Webform (webform)                                                       Enabled   8.x-5.0-rc3     
  custom                  Webform Add Local Task (webform_add_local_task)                         Enabled   1               
  Webform                 Webform Bootstrap (webform_bootstrap)                                   Enabled   8.x-5.0-rc3     
  Custom                  Webform Dependents Element (webform_dependents_element)                 Enabled                   
  Webform                 Webform Node (webform_node)                                             Enabled   8.x-5.0-rc3     
  Webform                 Webform Scheduled Email Handler (webform_scheduled_email)               Enabled   8.x-5.0-rc3     
  Webform                 Webform Templates (webform_templates)                                   Enabled   8.x-5.0-rc3     
  Webform                 Webform UI (webform_ui)                                                 Enabled   8.x-5.0-rc3     
  Webform                 Webform views (webform_views)                                           Enabled   8.x-5.0-alpha4  
  Field types             Weight (weight)                                                         Enabled   8.x-3.1-alpha1  
 ----------------------- ----------------------------------------------------------------------- --------- ----------------  

Comments

Sarahphp1 created an issue. See original summary.

berdir’s picture

Issue summary: View changes
0sarah0al’s picture

Title: when updating to 8.5.1, block content update 8400 do not run at all » when updating to 8.5.1, block content update 8400 does not run at all
berdir’s picture

Something seems to be wrong with the dependencies. block_content_update_8400() depends on content_translation_update_8400(), which must run first.

What does drush ev "var_dump(drupal_get_installed_schema_version('content_translation'))" display? (It should be 8400). If it is not, make sure that content_translation.install exists and contains that function.

As a workaround, you could comment out the content of block_content_update_dependencies() in block_content.install.

0sarah0al’s picture

StatusFileSize
new359.31 KB

Hi Berdir

the result of:
drush ev "var_dump(drupal_get_installed_schema_version('content_translation'))"

is int(-1)

And, content_translation.install exists and contains that functions. See image.

I will try to comment out block_content_update_dependencies() function and report the results back here.

0sarah0al’s picture

StatusFileSize
new118.29 KB

Yes,
When I commented out the function, it worked... finally

And I checked in the database, now I can see the 'status' field has been added..

So, either there is a bug in content_translation.install 4800 function or something else I have in my codebase that is causing the function not to run ,,,,

Thanks Berdir

berdir’s picture

-1 is SCHEMA_UNINSTALLED, so somehow, Drupal thinks that module isn't really installed, that's definitely weird.

On which version did you install this site, 8.4, 8.3, earlier?

I'm unsure how this should be dealt with in general, what we should do with an update that depends on something that doesn't have a schema version at all...

0sarah0al’s picture

I installed this site on D 8.3.

amateescu’s picture

Just out of curiosity, can you also show the output of:

drush ev "var_dump(\Drupal::moduleHandler()->moduleExists('content_translation'))"

If that returns TRUE, there's something really weird going on :)

0sarah0al’s picture

StatusFileSize
new59.91 KB

Hi ameetscu

It returned true ,,, :((((((

See image, please

sarikak’s picture

Hello,
I have some issue with the basic blocks displaying on my website.Basic blocks are only seen for admin role.
I have created the following ticket describing my concerns, Please check and share your feedback.

https://www.drupal.org/project/drupal/issues/2960331

berdir’s picture

If content_translation is enabled and the last installed schema version is null, then what you can do to fix that is running this:

drush ev "drupal_set_installed_schema_version('content_translation', 8400)"

That should manually set the version and allow you to run block_update_8400(). You should not run that if content_translation is not actually installed.

krith_18’s picture

Hi all,

Even i faced the same issue. I ran the below code in devel/php. This is just a temporary solution. If anyone finds a permanent solution please let us know. Thanks in advance!

Code:[run this in devel/php]

$b = entity_load("block_content", id);
$b->status->value = 1;
$b->save();

where, id is the custom block id

Run this code for each and every custom block so that it get saved without error. After saving the block, run update.php and the error get resolved.

mvpfi’s picture

Got fixed missing blocks matter by editing database straight. You only have to modify rows of the source language. For example: if site default language is en, do modifications only where langcode is en. Other languages will work after the source language is correctly set.

Table: block_content_field_data
Fields:
content_translation_source, change "und" => NULL
content_translation_outdated, change 0 => NULL
status, change 0 => 1

Table: block_content_field_data_revision
Search for row that has same id and langcode that on a row you made changes on the other table.
status, change 0 => 1

drush cr

Also, did try #13 and that worked as well.

armyguyinfl’s picture

0sarah0al’s picture

The problem is that update 8400 in content_translation reset the value of field: "content_translation_status" to NULL, while update 8400 in block_content removes this field entirely from the database, so update content_translation has to run before update block_content and hence the dependency. Which does not make sense to me ,,

Anyway, to re-iterate:

The update 8400 in block_content was never run in my case, so the fields 'status' were never added to the two tables: block_content_field_data AND block_content_field_revision
So, here are the steps I followed to resolve the issue, thanks to Berdir and the folks here in this thread:
Make sure that content_translation is enabled in your site.

1- check if schema version for content_translation is correct:
drush ev "var_dump(drupal_get_installed_schema_version('content_translation'))”

2- if you get: int(-1)
Run: drush ev "drupal_set_installed_schema_version('content_translation', 8400)"

3- check schema version is correct:
again, run: drush ev "var_dump(drupal_get_installed_schema_version('content_translation'))”
You should get: int(8400)

4- then run: drush updb
In order for the update 8400 to take place.

5- you still need to change the new "status" field values like what has been mentioned in comments #13 and #14
For me, I had to go with #14 because I did not know the ids of the blocks and there were many of them..

6- run: drush updb

To emphasize what krith_18 has said, this is a temporary solution.
Thank to everybody who helped and commented in this issue.

amateescu’s picture

Status: Active » Closed (duplicate)