You are here

function bootstrap_tour_schema in Bootstrap Tour 7.2

Same name and namespace in other branches
  1. 7 bootstrap_tour.install \bootstrap_tour_schema()

Implements hook_schema().

File

./bootstrap_tour.install, line 108

Code

function bootstrap_tour_schema() {
  $schema = array();
  if (db_table_exists('bootstrap_tour_old')) {

    /**
     * Legacy compatibility. If the 'bootstrap_tour' table exists, then we need
     * to keep it temporarily, so that we can migrate from it to the new
     * 'bootstrap_tour_tour' and 'bootstrap_tour_step' tables. Once that
     * migration is complete, the update hook will delete this table, and then
     * it will be gone forever.
     *
     * You may be saying "why not remove this from hook_schema() though, since
     * that won't delete the table if it already exists?" and you're a very
     * smart and wise person. The answer is that we need to keep this in
     * hook_schema() because we need the "export" key to exist on it (which you
     * can see below), otherwise the ctools function to load default/featurized/
     * exported/in-code tours doesn't know that they exist and just returns NULL.
     * And since we need to load legacy 1.x tours as part of the migrating to
     * the new 2.x tables, we need ctools to know about it until that migration
     * is complete.
     *
     * However, we can't actually name it bootstrap_tour because then
     * features makes a boostrap_tour_features_api function that returns
     * it as a key, which conflicts with the one entity creates and causes
     * update errors.
     *
     * @see bootstrap_tour_load_legacy_tours();
     */
    $schema['bootstrap_tour_old'] = bootstrap_tour_db_legacy_table();
  }
  $schema['bootstrap_tour_tour'] = bootstrap_tour_db_tour_table();
  $schema['bootstrap_tour_step'] = bootstrap_tour_db_step_table();
  return $schema;
}