You are here

ip_ranges.install in IP Ranges 7.2

Same filename and directory in other branches
  1. 8 ip_ranges.install
  2. 7 ip_ranges.install

Install functions for the ip_ranges module.

File

ip_ranges.install
View source
<?php

/**
 * @file
 * Install functions for the ip_ranges module.
 */

/**
 * Implements hook_schema().
 */
function ip_ranges_schema() {
  $schema['ip_ranges'] = array(
    'fields' => array(
      'bid' => array(
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'ip' => array(
        'type' => 'varchar',
        'length' => 31,
        'not null' => TRUE,
        'default' => '',
      ),
      'type' => array(
        'type' => 'varchar',
        'length' => 9,
        'not null' => TRUE,
        'default' => '',
      ),
      'description' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
    ),
    'primary key' => array(
      'bid',
    ),
    'indexes' => array(
      'bid' => array(
        'bid',
      ),
      'type' => array(
        'type',
      ),
    ),
  );
  return $schema;
}

/**
 * Added description field.
 */
function ip_ranges_update_7201(&$sandbox) {
  db_add_field('ip_ranges', 'description', array(
    'type' => 'varchar',
    'length' => 255,
    'not null' => TRUE,
    'default' => '',
  ));
}

Functions

Namesort descending Description
ip_ranges_schema Implements hook_schema().
ip_ranges_update_7201 Added description field.