You are here

ip_ranges.install in IP Ranges 8

Same filename and directory in other branches
  1. 7.2 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,
        'description' => 'Primary Key: Unique ip range ID.',
      ),
      'uuid' => array(
        'description' => 'Unique Key: Universally unique identifier for this entity.',
        'type' => 'varchar',
        'length' => 128,
        'not null' => FALSE,
      ),
      'ip_lower' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'length' => 15,
        'not null' => TRUE,
      ),
      'ip_higher' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'length' => 15,
        'not null' => TRUE,
      ),
      'type' => array(
        'type' => 'varchar',
        'length' => 9,
        'not null' => TRUE,
        'default' => '',
      ),
      'description' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
    ),
    'unique keys' => array(
      'uuid' => array(
        'uuid',
      ),
    ),
    'primary key' => array(
      'bid',
    ),
    'indexes' => array(
      'bid' => array(
        'bid',
      ),
      'type' => array(
        'type',
      ),
    ),
  );
  return $schema;
}

/**
 * Added description field for IP Ranges.
 */
function ip_ranges_update_8101() {
  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_8101 Added description field for IP Ranges.