You are here

sms_user.install in SMS Framework 6.2

File

modules/sms_user/sms_user.install
View source
<?php

/**
 * Implementation of hook_install().
 */
function sms_user_install() {
  drupal_install_schema('sms_user');
}

/**
 * Implementation of hook_schema().
 */
function sms_user_schema() {
  $schema['sms_user'] = array(
    'fields' => array(
      'uid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'number' => array(
        'type' => 'varchar',
        'not null' => TRUE,
        'length' => 32,
      ),
      'status' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'code' => array(
        'type' => 'varchar',
        'not null' => TRUE,
        'length' => 16,
      ),
      'gateway' => array(
        'type' => 'text',
      ),
    ),
    'primary key' => array(
      'number',
    ),
    'indexes' => array(
      'uid' => array(
        'uid',
      ),
    ),
  );
  return $schema;
}

/**
 * Implementation of hook_update().
 *
 * Drop the now dead delta field, and change primary key to number.
 */
function sms_user_update_1() {
  $ret = array();
  db_drop_primary_key($ret, 'sms_user');
  db_add_primary_key($ret, 'sms_user', array(
    'number',
  ));
  db_add_index($ret, 'sms_user', 'uid', array(
    'uid',
  ));
  db_drop_field($ret, 'sms_user', 'delta');
  return $ret;
}

/**
 * Implementation of hook_uninstall().
 */
function sms_user_uninstall() {
  drupal_uninstall_schema('sms_user');
  $variables = array(
    'sms_user_registration_enabled',
    'sms_user_allow_password',
    'sms_user_new_account_message',
  );
  foreach ($variables as $variable) {
    variable_del($variable);
  }
}

Functions

Namesort descending Description
sms_user_install Implementation of hook_install().
sms_user_schema Implementation of hook_schema().
sms_user_uninstall Implementation of hook_uninstall().
sms_user_update_1 Implementation of hook_update().