Drupal 8 no longer supports upgrading data from Drupal 7 using the database update system (update.php). Instead, Drupal core and contributed modules will provide data migration from Drupal 6 and 7 installations to Drupal 8 installations using a Drupal 8 data migration feature based on the Migrate module.
Minor and patch version upgrades will still use update.php, including (for example):
- 8.0.0 to 8.0.1
- 8.0.7 to 8.1.0
- 8.x-1.0 to 8.x-1.1
Impacts on contributed module developers
Use the migration API instead of hook_update_N() to migrate data to Drupal 8
To upgrade your module's data to Drupal 8 from Drupal 6 or 7, use the Drupal 8 Migration API to give module users a way to migrate the data from a Drupal 6 or 7 site to a newly architected Drupal 8 site. (See https://drupal.org/node/2141805 for an example.) hook_update_N() should only be used for minor version updates (for example, a schema change introduced in 8.x-1.1).
Schema version 8000 is reserved for the minimum core schema version
Previously, hook_update_N000() was used to denote the hook that provided an upgrade from Drupal N - 1 to Drupal N. Since this is no longer supported, the schema version 8000 is now reserved for the minimum installed version of core modules with no updates.
- The constant
SCHEMA_INSTALLEDis replaced with\Drupal::CORE_MINIMUM_SCHEMA_VERSION, which will have a value of 8000 for Drupal 8, 9000 for Drupal 9, etc. - Core modules should begin numbering their minor version update hooks with
hook_update_8001(). - Contributed modules should begin numbering their minor version update hooks with (e.g.)
hook_update_8100()for the 8.x-1.x branch of the module. (See the hook_update_N() API documentation for more information.) - Declaring
hook_update_8000()in a module is not allowed and will prevent updates for being run for that module.
Impacts on site owners
It is no longer supported to upgrade a Drupal 7 site to Drupal 8 directly. If you attempt to upgrade a site with a Drupal 7 database to Drupal 8, you will receive a requirements error. To upgrade to Drupal 8, install and configure a new Drupal 8 site mirroring your Drupal 7 site, and then migrate your data using the new Migrate in core functionality once it is complete in an upcoming Drupal 8 release.
Core API changes
Several update helper functions are removed.
- update_add_uuids()
- update_add_cache_columns()
- function update_prepare_stored_includes()
- function update_prepare_d8_bootstrap()
- function update_prepare_d8_language()
- function update_fix_d8_requirements()
- function update_variable_get()
- function update_variable_set()
- function update_variable_del()
- function update_variables_to_config()
- function update_install_default_config()
- function update_variables_to_state()
- function _update_8000_entity_get_display()
- function _update_8000_entity_get_form_display()
- function _update_8003_field_create_field()
- function _update_8003_field_create_instance()
- function _update_8006_field_write_data_sql()
- function _update_7000_node_get_types()
Additionally, update_extra_requirements() is replaced with specific functions update_system_schema_requirements() and update_settings_file_requirements().
A couple constants are altered as well.
- Removed
- const SCHEMA_INSTALLED = 0;
- const REQUIRED_D7_SCHEMA_VERSION = '7069';
- Added
- const \Drupal::CORE_MINIMUM_SCHEMA_VERSION = 8000;