Providing an upgrade path for your variables
Unfortunately, providing an upgrade path for variables used in modules for Drupal 6 or Drupal 7 is not as easy as simply fetching the values from the database and storing them into the new configuration system. You need to convert the variables into configuration objects, performing the correct data conversions and saving the values correctly.
Prior to Drupal 8, upgrading between major versions of Drupal was mainly done using hook_update_N()
. The developer used this hook to move the required data from the old data structure into the new one, and was responsible for all conversions needed for the data to work in the new version of the site. In 2013, during DrupalCon in Prague, the decision was made to disallow these old-style upgrades and use a new and much more flexible approach for this task: the Migrate module.
Migrating your data
The best way to securely upgrade existing variables to the new configuration system is by using Migrate (a module...