You are here

domain_prefix.install in Domain Access 6.2

Same filename and directory in other branches
  1. 5 domain_prefix/domain_prefix.install

Install file for the Domain Prefix module

File

domain_prefix/domain_prefix.install
View source
<?php

/**
 * @file
 * Install file for the Domain Prefix module
 */

/**
 * Implement hook_install()
 *
 * @ingroup drupal
 */
function domain_prefix_install() {
  drupal_install_schema('domain_prefix');
}

/**
 * Implement hook_schema()
 */
function domain_prefix_schema() {
  $schema['domain_prefix'] = array(
    'fields' => array(
      'domain_id' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'status' => array(
        'type' => 'int',
        'size' => 'small',
        'not null' => TRUE,
        'default' => 0,
      ),
      'tablename' => array(
        'type' => 'varchar',
        'length' => '80',
        'not null' => TRUE,
        'default' => '',
      ),
      'module' => array(
        'type' => 'varchar',
        'length' => '80',
        'not null' => TRUE,
        'default' => '',
      ),
      'source' => array(
        'type' => 'int',
        'size' => 'small',
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'indexes' => array(
      'domain_id' => array(
        'domain_id',
      ),
    ),
  );
  return $schema;
}

/**
 * Implement hook_uninstall()
 */
function domain_prefix_uninstall() {

  // We must drop all the created tables.
  $result = db_query("SELECT domain_id, tablename FROM {domain_prefix} WHERE status > 1");
  while ($table = db_fetch_array($result)) {
    $name = db_escape_table('domain_' . $table['domain_id'] . '_' . $table['tablename']);
    db_query("DROP TABLE {%s}", $name);
  }

  // Now drop the storage table.
  drupal_uninstall_schema('domain_prefix');
  variable_del('domain_prefix');
  variable_del('domain_prefix_options');
}

/**
 * Update note.
 *
 * Since versions prior to 5.x.1.0 are not supported, and ther are no schema changes from
 * 5.x.1 to 6.x.1, no update functions have been provided for Drupal 6.
 *
 * To upgrade from a release candidate, first upgrade the module to 5.x.1.0.  Then upgrade
 * to Drupal 6.
 *
 * Developer note: the next update will be update 2.
 */