Skip to content

There is an error in vendor/magento/framework/Setup/Declaration/Schema/Declaration/SchemaBuilder.php at line: 253

I am upgrading the Magento version from 2.2.3 to 2.4.7-p2. After successfully running the composer update command, I encountered the following error when running the setup:upgrade command.

There is an error in /vendor/magento/framework/Setup/Declaration/Schema/Declaration/SchemaBuilder.php at line: 253
MagentoFrameworkSetupDeclarationSchemaDeclarationSchemaBuilder::processTable(): Return value must be of type MagentoFrameworkSetupDeclarationSchemaDtoTable, bool returned#0 /vendor/magento/framework/Setup/Declaration/Schema/Declaration/SchemaBuilder.php(150): MagentoFrameworkSetupDeclarationSchemaDeclarationSchemaBuilder->processTable()
#1 /vendor/magento/framework/Setup/Declaration/Schema/SchemaConfig.php(78): MagentoFrameworkSetupDeclarationSchemaDeclarationSchemaBuilder->build()
#2 /setup/src/Magento/Setup/Model/DeclarationInstaller.php(57): MagentoFrameworkSetupDeclarationSchemaSchemaConfig->getDeclarationConfig()
#3 /setup/src/Magento/Setup/Model/Installer.php(868): MagentoSetupModelDeclarationInstaller->installSchema()
#4 /setup/src/Magento/Setup/Model/Installer.php(916): MagentoSetupModelInstaller->declarativeInstallSchema()
#5 /setup/src/Magento/Setup/Console/Command/UpgradeCommand.php(147): MagentoSetupModelInstaller->installSchema()
#6 /vendor/symfony/console/Command/Command.php(326): MagentoSetupConsoleCommandUpgradeCommand->execute()
#7 /vendor/symfony/console/Application.php(1078): SymfonyComponentConsoleCommandCommand->run()
#8 /vendor/symfony/console/Application.php(324): SymfonyComponentConsoleApplication->doRunCommand()
#9 /vendor/magento/framework/Console/Cli.php(118): SymfonyComponentConsoleApplication->doRun()
#10 /vendor/symfony/console/Application.php(175): MagentoFrameworkConsoleCli->doRun()
#11 /bin/magento(23): SymfonyComponentConsoleApplication->run()
#12 {main}

After debugging, I found the issue is related to some default Magento tables. The affected tables are as follows:

store_website
store_group
store
core_config_data
admin_analytics_usage_version_log
directory_country
directory_country_format
directory_country_region
directory_country_region_name
directory_currency_rate
adminnotification_inbox
admin_system_messages
adobe_user_profile
admin_user
media_gallery_asset
media_gallery_keyword
media_gallery_asset_keyword
theme
theme_file
design_change
admin_user_session
password_reset_request_event
admin_user_expiration
admin_passwords
authorization_role
authorization_rule
eav_entity_type
eav_entity
eav_entity_datetime
eav_entity_decimal
eav_entity_int
eav_entity_text
eav_entity_varchar
eav_attribute
eav_entity_store
eav_attribute_set
eav_attribute_group
eav_entity_attribute
eav_attribute_option
eav_attribute_option_value
eav_attribute_label
eav_form_type
eav_form_type_entity
eav_form_fieldset
eav_form_fieldset_label
eav_form_element
customer_entity
customer_address_entity
customer_address_entity_datetime
customer_address_entity_decimal
customer_address_entity_int
customer_address_entity_text
customer_address_entity_varchar
customer_entity_datetime
customer_entity_decimal
customer_entity_int
customer_entity_text
customer_entity_varchar
customer_group
customer_eav_attribute
customer_form_attribute
customer_eav_attribute_website
customer_visitor
customer_log
customer_group_excluded_website
admin_adobe_ims_webapi
indexer_state
mview_state
variable
variable_value
cms_block
cms_block_store
cms_page
cms_page_store
oauth_consumer
oauth_token
oauth_nonce
integration
oauth_token_request_log
search_query
search_synonyms
catalog_product_entity
catalog_product_entity_datetime
catalog_product_entity_decimal
catalog_product_entity_int
catalog_product_entity_text
catalog_product_entity_varchar
catalog_product_entity_gallery
catalog_category_entity
catalog_category_entity_datetime
catalog_category_entity_decimal
catalog_category_entity_int
catalog_category_entity_text
catalog_category_entity_varchar
catalog_category_product
catalog_category_product_index